Methods
(static) hexCssColor(r, g, b) → {string}
Return a html/css hex color string for an r,g,b opaque color (a=255). Hex strings do not support alpha. Both #nnn and #nnnnnn forms supported. Default is to check for the short hex form.
Name | Type | Description |
---|---|---|
r | number | Integer value for red channel |
g | number | Integer value for green channel |
b | number | Integer value for blue channel |
A css hex color string #nnn or #nnnnnn, n in [0,F] hex
- Type:
- string
(static) hslCssColor(h, sopt, lopt, aopt) → {string}
Convert 4 ints, h,s,l,a, h in [0-360], s,l in [0-100]% a in [0-255] to a css color string. See hsl().
NOTE: h=0 and h=360 are the same, use h in 0-359 for unique colors.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
h | number | |||
s | number | <optional> | 100 | |
l | number | <optional> | 50 | |
a | number | <optional> | 255 |
A css HSL color string
- Type:
- string
(static) rgbaCssColor(r, g, b, aopt) → {string}
Convert 4 r,g,b,a ints in [0-255] ("a" defaulted to 255) to a css color string.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
r | number | integer in [0, 255] for red channel | ||
g | number | integer in [0, 255] for green channel | ||
b | number | integer in [0, 255] for blue channel | ||
a | number | <optional> | 255 | integer in [0, 255] for alpha/opacity channel |
A rgb(r,g,b) or rgba(r,g,b,a) css color string
- Type:
- string