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.
ParseColors returns an iterator that lazily parses a comma-separated list
of CSS colors.
Commas inside parentheses are not treated as separators, so functional
notations such as "rgb(255, 0, 0)" or "hsl(120, 100%, 50%)" stay intact.
Empty entries (e.g. from a trailing comma) are skipped.
Each iteration yields the parsed color and an error. If a color fails to
parse, the error includes the offending token and iteration continues,
letting the caller decide whether to stop (break) or skip.
Example:
for c, err := range csscolorparser.ParseColors("red, #00ff00, rgb(0, 0, 255)") {
if err != nil {
log.Println(err)
continue
}
fmt.Println(c.HexString())
}
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.