https://commons.wikimedia.org/wiki/
File:CIExy1931.svg
https://en.wikipedia.org/wiki/
File:SRGB_chromaticity_CIE1931.svg
https://en.wikipedia.org/wiki/
File:CIE1931xy_gamut_comparison_
of_sRGB_P3_Rec2020.svg
red
#ff0000
rgb(255, 0, 0)
rgba(255,0,0, 100%)
hsl(0, 100%, 50%)
hsla(0, 100%, 50%, 100%)
red 0-255
green 0-255
blue 0-255
https://en.wikipedia.org/wiki/
File:CIE1931xy_gamut_comparison_
of_sRGB_P3_Rec2020.svg
Old and improved:
#FF000000
rgb(0 255 0 / 1)
hsl(0 100% 50% / 1)
New:
hwb(0 0% 0%)
color(sRGB 0 1 0)
color(display-p3 0.92 0.2 0.14)
lab(54.29 80.8 69.89)
lch(54.29 106.84 40.86)
oklab(62.8% 0.22 0.13)
oklch(62.8% 0.26 30)
Old and improved:
#FF000000
rgb(0 255 0 / 1)
hsl(0 100% 50% / 1)
New:
hwb(0 0% 0%)
color(sRGB 0 1 0)
color(display-p3 0.92 0.2 0.14)
lab(54.29 80.8 69.89)
lch(54.29 106.84 40.86)
oklab(62.8% 0.22 0.13)
oklch(62.8% 0.26 30)
Old and improved:
#FF000000
rgb(0 255 0 / 1)
hsl(0 100% 50% / 1)
New:
hwb(0 0% 0%)
color(sRGB 0 1 0)
color(display-p3 0.92 0.2 0.14)
lab(54.29 80.8 69.89)
lch(54.29 106.84 40.86)
oklab(62.8% 0.22 0.13)
oklch(62.8% 0.26 30)
hue - 0-360
saturation - 0%-100%
lightness - 0%-100%
https://en.wikipedia.org/wiki/
File:SRGB_chromaticity_CIE1931.svg
Old and improved:
#FF000000
rgb(0 255 0 / 1)
hsl(0 100% 50% / 1)
New:
hwb(0 0% 0%)
color(sRGB 0 1 0)
color(display-p3 0.92 0.2 0.14)
lab(54.29 80.8 69.89)
lch(54.29 106.84 40.86)
oklab(62.8% 0.22 0.13)
oklch(62.8% 0.26 30)
Old and improved:
#FF000000
rgb(0 255 0 / 1)
hsl(0 100% 50% / 1)
New:
hwb(0 0% 0%)
color(sRGB 0 1 0)
color(display-p3 0.92 0.2 0.14)
lab(54.29 80.8 69.89)
lch(54.29 106.84 40.86)
oklab(62.8% 0.22 0.13)
oklch(62.8% 0.26 30)
Old and improved:
#FF000000
rgb(0 255 0 / 1)
hsl(0 100% 50% / 1)
New:
hwb(0 0% 0%)
color(sRGB 0 1 0)
color(display-p3 0.92 0.2 0.14)
lab(54.29 80.8 69.89)
lch(54.29 106.84 40.86)
oklab(62.8% 0.22 0.13)
oklch(62.8% 0.26 30)
lightness – 0%-100%
a – 0-1, cartesian coordinates between green and red.
b – 0-1, cartesian coordinates between blue and yellow.
lightness – 0%-100%
chroma – 0 to infinity.
hue – 0-360.
Old and improved:
#FF000000
rgb(0 255 0 / 1)
hsl(0 100% 50% / 1)
New:
hwb(0 0% 0%)
color(sRGB 0 1 0)
color(display-p3 0.92 0.2 0.14)
lab(54.29 80.8 69.89)
lch(54.29 106.84 40.86)
oklab(62.8% 0.22 0.13)
oklch(62.8% 0.26 30)
oklch()
is one of these formats and is the easiest for people to read and modify.oklch(75% 0.1 60)
oklch(75% 0.1 120)
oklch(75% 0.1 180)
oklch(75% 0.1 240)
oklch(75% 0.1 300)
oklch(75% 0.1 380)
Normal:
Hovered:
Disabled:
Normal:
Hovered:
Disabled:
.martian {
background: oklch(69.73% 0.155 112.79);
}
@media (color-gamut: p3) {
.martian {
background: oklch(69.73% 0.176 112.79);
/* You'll only see the preview with P3 monitors */
}
}
.oklch {
background: linear-gradient(in oklab, blue, green);
}
.button {
background: var(--button-color);
}
.button:hover {
/* One :hover for normal, secondary, and error states */
background: oklch(from var(--button-color) calc(l + 10%) c h);
}
.button {
--button-color: var(--accent);
}
.button.is-secondary {
--button-color: var(--dimmed);
}
.button.is-error {
--button-color: var(--error);
}