Skip to content

Rgb interface ​

An sRGB color, each channel from 0 to 255.

ts
import type { Rgb } from 'utils';

Signature ​

ts
export interface Rgb {
  readonly r: number;
  readonly g: number;
  readonly b: number;

Tests ​

Line coverage: 0 %.

Source ​

src/color/rgb.ts (on GitHub)

Used by ​

  • getContrastingTextColor: Picks the text color, pure black or pure white, that reads best on a background.
  • getSvgFillColor: Reads the fill color of an SVG element as rendered, whatever sets it: attribute, class, inherited style.
Source code
ts
/** An sRGB color, each channel from 0 to 255. */
export interface Rgb {
  readonly r: number;
  readonly g: number;
  readonly b: number;
}

Keywords: rgb, colors, interface

Generated from the JSDoc of the sources.