sRGB
The sRGB color space is registered in Color
by default
Properties
Name: srgb
White Point: D65 / 2˚
Coordinates:
Name | Range* |
---|---|
r | [0, 1] |
g | [0, 1] |
b | [0, 1] |
* Range denotes in gamut colors, but the color space supports an extended range beyond the gamut.
The sRGB space is a standard RGB (red, green, blue) color space that HP and Microsoft created cooperatively in 1996 to use on monitors, printers, and the Web. sRGB stands for "Standard RGB". It is the most widely used color space and is supported by most operating systems, software programs, monitors, and printers.
Channel Aliases
Channels | Aliases |
---|---|
r | red |
g | green |
b | blue |
Input/Output
Parsed input and string output formats support all valid CSS forms:
black // Color name
#RRGGBBAA // Hex
rgb(r g b / a) // RGB function
rgb(r, g, b) // Legacy RGB Function
rgba(r, g, b, a) // Legacy RGBA function
color(srgb r g b / a) // Color function
When manually creating a color via raw data or specifying a color space as a parameter in a function, the color space name is always used:
Color("srgb", [0, 0, 0], 1)
color(srgb r g b / a)
form, but the default string output will be the rgb(r g b / a)
form. >>> Color('red').to_string()
'rgb(255 0 0)'
>>> Color('orange').to_string(comma=True)
'rgb(255, 165, 0)'
>>> Color('yellow').to_string(percent=True)
'rgb(100% 100% 0%)'
>>> Color('green').to_string(names=True)
'green'
>>> Color('blue').to_string(hex=True)
'#0000ff'
>>> Color('indigo').to_string(color=True)
'color(srgb 0.29412 0 0.5098)'
Registering
from coloraide import Color as Base
from coloraide.spaces.srgb.css import sRGB
class Color(Base): ...
Color.register(sRGB())