Color

Color Utility Functions.

interface Rgb 
extends NumberRecord {
  b: number
  g: number
  r: number
}
interface RgbObject 
extends ValueRecord {
  b: Value
  g: Value
  r: Value
}
interface Rgba 
extends Rgb {
  a: number
  b: number
  g: number
  r: number
}
interface RgbaObject 
extends RgbObject {
  a: Value
  b: Value
  g: Value
  r: Value
}
function colorFromRgb(
  rgb: Rgb
): string
/**
 * Assures color is a hex code, computing
 * from style if necessary.
 */
function colorHex(
  color: string
): string
function colorHexToRgb(
  hex: string
): Rgb
function colorMixRbg(
  fromRgb: Rgb, 
  toRgb: Rgb, 
  amountToMix?: number
): Rgb
function colorMixRbga(
  fromRgba: Rgba, 
  toRgba: Rgba, 
  amountToMix?: number
): Rgba
/** WCAG 2.1 colour contrast algorithm */
function colorRgbDifference(
  color: string, 
  light?: string, 
  dark?: string
): string
function colorRgbToHex(
  rgb: RgbObject
): string
function colorRgbaToHex(
  object: RgbaObject
): string
function colorToRgb(
  value: string
): Rgb
function colorValid(
  color: string
): boolean
function colorValidHex(
  value: string
): boolean
function colorValidServer(
  color: string
): boolean
/**
 * Make color string safe for use in a
 * command.
 */
function commandColor(
  color: string
): string
function svgColorMask(
  svgImage: Element, 
  id: string, 
  transparency: Transparency, 
  size: Size, 
  rect?: Rect, 
  fill?: string
): SvgElement
function tweenColor(
  value: string, 
  valueEnd: string, 
  time: Time, 
  range: TimeRange
): string