@univerjscoreclassesColorkit

@univerjs/core v0.5.0-beta.1Docs


Class: ColorKit

Constructors

new ColorKit()

new ColorKit(color): ColorKit

Parameters

ParameterType
colorundefined | string | Color | ColorKit

Returns

ColorKit

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:236

Accessors

isValid

Get Signature

get isValid(): boolean
Returns

boolean

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:271

Methods

darken()

darken(amount): ColorKit

Parameters

ParameterTypeDefault value
amountnumber10

Returns

ColorKit

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:340


getAlpha()

getAlpha(): number

Returns

number

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:374


getBrightness()

getBrightness(): number

Returns

number

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:368


getLuminance()

getLuminance(): number

Returns

number

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:354


isDark()

isDark(): boolean

Returns

boolean

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:378


isLight()

isLight(): boolean

Returns

boolean

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:382


lighten()

lighten(amount): ColorKit

Parameters

ParameterTypeDefault value
amountnumber10

Returns

ColorKit

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:330


setAlpha()

setAlpha(value): ColorKit

Parameters

ParameterType
valuenumber

Returns

ColorKit

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:350


toHexString()

toHexString(allowShort?): string

Parameters

ParameterType
allowShort?boolean

Returns

string

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:291


toHsl()

toHsl(): IHslColor

Returns

IHslColor

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:326


toHsv()

toHsv(): IHsvColor

Returns

IHsvColor

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:322


toRgb()

toRgb(): IRgbColor

Returns

IRgbColor

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:275


toRgbString()

toRgbString(): string

Returns

string

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:279


toString()

toString(): string

Returns

string

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:287


getContrastRatio()

static getContrastRatio(foreground, background): number

Parameters

ParameterType
foregroundstring | Color | ColorKit
backgroundstring | Color | ColorKit

Returns

number

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:228


mix()

static mix(
   color1, 
   color2, 
   amount): ColorKit

Parameters

ParameterType
color1string | Color | ColorKit
color2string | Color | ColorKit
amountnumber

Returns

ColorKit

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/color/color-kit.ts:204