ColorCode
The content of key
shall represent a color in RGB
or HSL
format with optional alpha channel.
Refer to the valid examples for syntax.
Standard color pickers will provide a valid format.
Parameter table
param | unit | required | description |
---|---|---|---|
key | yes | The key of the value to be a color code (key ). | |
allowAlpha | no | Allow the use of alpha channel (transparency). |
How to setup
The rule makes sure that the provided key
can be read as a color by most tools.
Examples
value | valid | allowAlpha | description |
---|---|---|---|
#fc4 | ✅ | Reduced HEX starting with # | |
0xfc4 | ✅ | 1 | Reduced HEX starting with 0x |
#ffcc44 | ✅ | Full HEX starting with # | |
0xffcc44ff | ✅ | 1 | Full HEX with alpha starting with 0x |
rgb(255, 204, 68) | ✅ | RGB function | |
rgba(255, 20, 68, 0.8) | ✅ | 1 | RGB function with alpha channel |
hsl(0.12, 1.00, 0.63) | ✅ | HSL function |