@univerjscoreclassesColorkit

@univerjs/core v0.5.4


Class: ColorKit

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

Constructors

new ColorKit()

new ColorKit(color): ColorKit

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

Parameters

ParameterType
colorundefined | string | Color | ColorKit

Returns

ColorKit

Accessors

isValid

Get Signature

get isValid(): boolean

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

Returns

boolean

Methods

darken()

darken(amount): ColorKit

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

Parameters

ParameterTypeDefault value
amountnumber10

Returns

ColorKit


getAlpha()

getAlpha(): number

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

Returns

number


getBrightness()

getBrightness(): number

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

Returns

number


getLuminance()

getLuminance(): number

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

Returns

number


isDark()

isDark(): boolean

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

Returns

boolean


isLight()

isLight(): boolean

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

Returns

boolean


lighten()

lighten(amount): ColorKit

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

Parameters

ParameterTypeDefault value
amountnumber10

Returns

ColorKit


setAlpha()

setAlpha(value): ColorKit

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

Parameters

ParameterType
valuenumber

Returns

ColorKit


toHexString()

toHexString(allowShort?): string

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

Parameters

ParameterType
allowShort?boolean

Returns

string


toHsl()

toHsl(): IHslColor

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

Returns

IHslColor


toHsv()

toHsv(): IHsvColor

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

Returns

IHsvColor


toRgb()

toRgb(): IRgbColor

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

Returns

IRgbColor


toRgbString()

toRgbString(): string

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

Returns

string


toString()

toString(): string

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

Returns

string


getContrastRatio()

static getContrastRatio(foreground, background): number

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

Parameters

ParameterType
foregroundstring | Color | ColorKit
backgroundstring | Color | ColorKit

Returns

number


mix()

static mix(
   color1, 
   color2, 
   amount): ColorKit

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

Parameters

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

Returns

ColorKit