Captain is currently in ALPHA. We are happy to get your feedback
Core API
Utils Color

Module: utils/color

Table of contents

Functions

Functions

getContrast

getContrast(background, foreground): Object

Parameters

NameType
backgroundstring
foregroundstring

Returns

Object

NameType
aaboolean
aaaboolean
contrastnumber

Defined in

utils/color.ts:61 (opens in a new tab)


getContrastColor

getContrastColor(hexColor): string

Parameters

NameType
hexColorstring

Returns

string

Defined in

utils/color.ts:1 (opens in a new tab)


getRelativeLuminance

getRelativeLuminance(rgb): number

Parameters

NameType
rgb[number, number, number]

Returns

number

Defined in

utils/color.ts:7 (opens in a new tab)


hexToRGB

hexToRGB(hex): [number, number, number]

Parameters

NameType
hexstring

Returns

[number, number, number]

Defined in

utils/color.ts:16 (opens in a new tab)


mixColors

mixColors(color1, color2, percentage): string

Parameters

NameType
color1string
color2string
percentagenumber

Returns

string

Defined in

utils/color.ts:48 (opens in a new tab)


rgbToHex

rgbToHex(r, g, b): string

Parameters

NameType
rnumber
gnumber
bnumber

Returns

string

Defined in

utils/color.ts:32 (opens in a new tab)