Skip to main content

Rec. 709 RGB

HD video standard

Limits RGB color to video levels (16 - 235 for 8-bit or 64 to 940 for 10-bit). Input bit depth must be 8 or 10. 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 - 255 / 0 - 1023).

New Color

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

Conversion to

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

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('rec709rgb', [235, 16, 235])
const color1 = Color.from('rec709rgb', [940, 64, 940], { bitDepth: 10 })

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

TypeScript

import Color from 'chromaticity-color-utilities'

const c: Color.rec709rgb = Color.from('rec709rgb', [235, 16, 235])