Skip to main content

Rec. 2020 RGB

UHD video standard

Limits RGB color to video levels (64 to 940 for 10-bit or 256 to 3760 for 12-bit). Input bit depth must be 10 or 12. Conversion to Y'PbPr and Y'CbCr will fail as this module does not yet have gamma adjustment implemented.

This method does not currently support data levels.

RGB values may fall outside limits.

Alpha channel maintains data levels (0 - 1023 / 0 - 4095).

New Color

Color.from('rec2020rgb',[r, g, b, a?], {
round: boolean, // optional, defaults to true
bitDepth: number // optional, defaults to 10, must be 10 or 12
})

Conversion to

.to('rec2020rgb', {
round: boolean, // optional, defaults to true
bitDepth: number // optional, defaults to 10, must be 10 or 12
})

Get methods

.getR(): number
.getG(): number
.getB(): number
.getA(): number // if alpha is not set, defaults to (2 ** bitDepth) - 1
.getBitDepth(): number
.getMax(): number // (2 ** bitDepth) - 1

JavaScript

const Color = require('chromaticity-color-utilities')

const color1 = Color.from('rec2020rgb', [940, 64, 940])
const color1 = Color.from('rec2020rgb', [3760, 256, 3760], { bitDepth: 12 })

const color3 = color2.to('rec2020rgb')
const color3 = color2.to('rec2020rgb', { bitDepth: 10 })

TypeScript

import Color from 'chromaticity-color-utilities'

const c: Color.rec2020rgb = Color.from('rec2020rgb', [940, 64, 940])