Involved Source Files Package csscolorparser provides function for parsing CSS color string as defined in the W3C's CSS color module level 4.named_colors.go
R, G, B, A values in the range 0..1Afloat64Bfloat64Gfloat64Rfloat64 Clamp restricts R, G, B, A values to the range 0..1. HexString returns CSS hexadecimal string. Implement the Go TextMarshaler interface Name returns name of this color if its available. Implement the Go color.Color interface. RGBA255 returns R, G, B, A values in the range 0..255 RGBString returns CSS RGB string. Implement the Go TextUnmarshaler interface
Color : encoding.TextMarshaler
*Color : encoding.TextUnmarshaler
Color : image/color.Color
func FromHsl(h, s, l, a float64) Color
func FromHsv(h, s, v, a float64) Color
func FromHwb(h, w, b, a float64) Color
func FromLab(l, a, b, alpha float64) Color
func FromLch(l, c, h, alpha float64) Color
func FromLinearRGB(r, g, b, a float64) Color
func FromOklab(l, a, b, alpha float64) Color
func FromOklch(l, c, h, alpha float64) Color
func Parse(s string) (Color, error)
func Color.Clamp() Color
Package-Level Functions (total 9)
FromHsl creates a Color from HSL colors.
Arguments:
- h: Hue angle [0..360]
- s: Saturation [0..1]
- l: Lightness [0..1]
- a: Alpha [0..1]
FromHsv creates a Color from HSV colors.
Arguments:
- h: Hue angle [0..360]
- s: Saturation [0..1]
- v: Value [0..1]
- a: Alpha [0..1]
FromHwb creates a Color from HWB colors.
Arguments:
- h: Hue angle [0..360]
- w: Whiteness [0..1]
- b: Blackness [0..1]
- a: Alpha [0..1]
FromLinearRGB creates a Color from linear-light RGB colors.
Arguments:
- r: Red value [0..1]
- g: Green value [0..1]
- b: Blue value [0..1]
- a: Alpha value [0..1]
FromOklab creates a Color from Oklab colors.
Arguments:
- l: Perceived lightness
- a: How green/red the color is
- b: How blue/yellow the color is
- alpha: Alpha [0..1]
FromOklch creates a Color from OKLCh colors.
Arguments:
- l: Perceived lightness
- c: Chroma
- h: Hue angle in radians
- alpha: Alpha [0..1]
Parse parses CSS color string and returns, if successful, a Color.
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.