Files
FWS-Kitty/tools/cmd/at/set_background_opacity.go
T
BlackAngelTV 7e7d249099 chore: import official kitty sources from upstream
Bring the kovidgoyal/kitty codebase in as the base of FWS-Kitty,
vendored at upstream commit 91fb38a without its git history.
2026-11-04 11:20:47 +01:00

18 lines
375 B
Go

// License: GPLv3 Copyright: 2022, Kovid Goyal, <kovid at kovidgoyal.net>
package at
import (
"fmt"
"math"
"strconv"
)
func parse_opacity(arg string) (float64, error) {
ans, err := strconv.ParseFloat(arg, 64)
if err != nil || math.IsNaN(ans) {
return 0, fmt.Errorf("Invalid opacity %#v: must be a number between 0 and 1", arg)
}
return max(0, min(ans, 1)), nil
}