Skip to main content

color

Normalizes a color to a RGB(A) value.

Signature

color(input: string | undefined, operations?: (color: IColorOperations) => void): string

Parameters

NameTypeOptionalDescription
inputstringNoSpecifies the input color (can be a hex, rgb, hsl or color name).
operations(color: IColorOperations) => voidYesOptional operations to perform.

Return value

Returns the color as a RGB(A) value.

Example

import { color } from "@tripetto/runner-fabric/color";

// Returns `rgb(255,0,0)`
color("red");

// Returns `rgb(0,0,0)`
color("blue", (color) => color.makeBlackOrWhite());