arlas-web-components / Exports / AwcColorGeneratorLoader

Class: AwcColorGeneratorLoader

Hierarchy

AwcColorGeneratorLoader

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new AwcColorGeneratorLoader()

Inherited from

ColorGeneratorLoader.constructor

Properties

changekeysToColors$

changekeysToColors$: Observable<void>

Overrides

ColorGeneratorLoader.changekeysToColors$

Defined in

projects/arlas-components/src/lib/components/componentsUtils.ts:86


colorsSaturationWeight

colorsSaturationWeight: number = 0.5

Overrides

ColorGeneratorLoader.colorsSaturationWeight

Defined in

projects/arlas-components/src/lib/components/componentsUtils.ts:88


keysToColors

keysToColors: [string, string][]

Overrides

ColorGeneratorLoader.keysToColors

Defined in

projects/arlas-components/src/lib/components/componentsUtils.ts:87

Methods

getColor

getColor(key, externalKeysToColors, externalColorsSaturationWeight): string

This method generates a determistic color from the given key, a list of [key, color] and a saturation weight. - First the method checks if the [key,color] is defined in externalkeysToColors and returns the correspondant color.

  • If externalkeysToColors parameter is undefined, then the method checks if the [key,color] is defined in keysToColors attribute of the loader

  • If neither externalkeysToColors parameter nor keysToColors attribute are defined, then the color is generated using a determist method.

  • For this determinist method, the generated colors saturation scale can be tightened using externalColorsSaturationWeight parameter
  • If the parameter externalColorsSaturationWeight is undefined, the attribute colorsSaturationWeight is used instead.

Parameters

Name Type Description
key string The text from which the color is generated
externalKeysToColors [string, string][] -
externalColorsSaturationWeight number -

Returns

string

Overrides

ColorGeneratorLoader.getColor

Defined in

projects/arlas-components/src/lib/components/componentsUtils.ts:105


getTextColor

getTextColor(color): string

Parameters

Name Type
color any

Returns

string

Overrides

ColorGeneratorLoader.getTextColor

Defined in

projects/arlas-components/src/lib/components/componentsUtils.ts:127