ColorSpace Object
-
primariesstring - The color primaries of the color space. Can be one of the following values:bt709- BT709 primaries (also used for sRGB)bt470m- BT470M primariesbt470bg- BT470BG primariessmpte170m- SMPTE170M primariessmpte240m- SMPTE240M primariesfilm- Film primariesbt2020- BT2020 primariessmptest428-1- SMPTEST428-1 primariessmptest431-2- SMPTEST431-2 primariesp3- P3 primariesxyz-d50- XYZ D50 primariesadobe-rgb- Adobe RGB primariesapple-generic-rgb- Apple Generic RGB primarieswide-gamut-color-spin- Wide Gamut Color Spin primariesebu-3213-e- EBU 3213-E primariescustom- Custom primariesinvalid- Invalid primaries
-
transferstring - The transfer function of the color space. Can be one of the following values:bt709- BT709 transfer functionbt709-apple- BT709 Apple transfer functiongamma18- Gamma 1.8 transfer functiongamma22- Gamma 2.2 transfer functiongamma24- Gamma 2.4 transfer functiongamma28- Gamma 2.8 transfer functionsmpte170m- SMPTE170M transfer functionsmpte240m- SMPTE240M transfer functionlinear- Linear transfer functionlog- Log transfer functionlog-sqrt- Log Square Root transfer functioniec61966-2-4- IEC61966-2-4 transfer functionbt1361-ecg- BT1361 ECG transfer functionsrgb- sRGB transfer functionbt2020-10- BT2020-10 transfer functionbt2020-12- BT2020-12 transfer functionpq- PQ (Perceptual Quantizer) transfer functionsmptest428-1- SMPTEST428-1 transfer functionhlg- HLG (Hybrid Log-Gamma) transfer functionsrgb-hdr- sRGB HDR transfer functionlinear-hdr- Linear HDR transfer functioncustom- Custom transfer functioncustom-hdr- Custom HDR transfer functionscrgb-linear-80-nits- scRGB Linear 80 nits transfer functioninvalid- Invalid transfer function
-
matrixstring - The color matrix of the color space. Can be one of the following values:rgb- RGB matrixbt709- BT709 matrixfcc- FCC matrixbt470bg- BT470BG matrixsmpte170m- SMPTE170M matrixsmpte240m- SMPTE240M matrixycocg- YCoCg matrixbt2020-ncl- BT2020 NCL matrixydzdx- YDzDx matrixgbr- GBR matrixinvalid- Invalid matrix
-
rangestring - The color range of the color space. Can be one of the following values:limited- Limited color range (RGB values ranging from 16 to 235)full- Full color range (RGB values from 0 to 255)derived- Range defined by the transfer function and matrixinvalid- Invalid range
Common ColorSpace definitions
Standard Color Spaces
sRGB:
const cs = {
primaries: 'bt709',
transfer: 'srgb',
matrix: 'rgb',
range: 'full'
}
Display P3:
const cs = {
primaries: 'p3',
transfer: 'srgb',
matrix: 'rgb',
range: 'full'
}
XYZ D50:
const cs = {
primaries: 'xyz-d50',
transfer: 'linear',
matrix: 'rgb',
range: 'full'
}
HDR Color Spaces
Extended sRGB (extends sRGB to all real values):
const cs = {
primaries: 'bt709',
transfer: 'srgb-hdr',
matrix: 'rgb',
range: 'full'
}
scRGB Linear (linear transfer function for all real values):
const cs = {
primaries: 'bt709',
transfer: 'linear-hdr',
matrix: 'rgb',
range: 'full'
}
scRGB Linear 80 Nits (with an SDR white level of 80 nits):
const cs = {
primaries: 'bt709',
transfer: 'scrgb-linear-80-nits',
matrix: 'rgb',
range: 'full'
}
HDR10 (BT.2020 primaries with PQ transfer function):
const cs = {
primaries: 'bt2020',
transfer: 'pq',
matrix: 'rgb',
range: 'full'
}
HLG (BT.2020 primaries with HLG transfer function):
const cs = {
primaries: 'bt2020',
transfer: 'hlg',
matrix: 'rgb',
range: 'full'
}
Video Color Spaces
Rec. 601 (SDTV):
const cs = {
primaries: 'smpte170m',
transfer: 'smpte170m',
matrix: 'smpte170m',
range: 'limited'
}
Rec. 709 (HDTV):
const cs = {
primaries: 'bt709',
transfer: 'bt709',
matrix: 'bt709',
range: 'limited'
}
JPEG (typical color space for JPEG images):
const cs = {
primaries: 'bt709',
transfer: 'srgb',
matrix: 'smpte170m',
range: 'full'
}