arlas-wui-toolkit / Exports / ArlasColorGeneratorLoader

Class: ArlasColorGeneratorLoader

This service allows to generate a color for a given term. - colors associated to terms in keysToColors are considered first - colors associated to terms from aggregations specified in colorsAggregations are considered second - if no color is associated to a term, the color is generated with a determinist method. - for generated colors, the saturation scale is tightened to the highest values with colorsSaturationWeight If an external externalKeysToColors list is given to the service getColor method, it is used insted of keysToColors If an external externalColorsSaturationWeight list is given to the service getColor method, it is used insted of colorsSaturationWeight

Hierarchy

  • ColorGeneratorLoader

ArlasColorGeneratorLoader

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ArlasColorGeneratorLoader(configService, collaborativesearchService)

Parameters

Name Type
configService ArlasConfigService
collaborativesearchService ArlasCollaborativesearchService

Overrides

ColorGeneratorLoader.constructor

Defined in

projects/arlas-toolkit/src/lib/tools/color-generator-loader.ts:27

Properties

changekeysToColors$

changekeysToColors$: Observable<void>

Overrides

ColorGeneratorLoader.changekeysToColors$

Defined in

projects/arlas-toolkit/src/lib/tools/color-generator-loader.ts:26


colorAggregations

colorAggregations: [Aggregation, Aggregation][]

Defined in

projects/arlas-toolkit/src/lib/tools/color-generator-loader.ts:24


colorsSaturationWeight

colorsSaturationWeight: number

Overrides

ColorGeneratorLoader.colorsSaturationWeight

Defined in

projects/arlas-toolkit/src/lib/tools/color-generator-loader.ts:22


keysToColors

keysToColors: [string, string][]

Overrides

ColorGeneratorLoader.keysToColors

Defined in

projects/arlas-toolkit/src/lib/tools/color-generator-loader.ts:21


keysToColorsMap

keysToColorsMap: Map<string, string>

Defined in

projects/arlas-toolkit/src/lib/tools/color-generator-loader.ts:23

Methods

getColor

getColor(key, externalKeysToColors?, externalColorsSaturationWeight?): string

Parameters

Name Type
key string
externalKeysToColors? [string, string][]
externalColorsSaturationWeight? number

Returns

string

Overrides

ColorGeneratorLoader.getColor

Defined in

projects/arlas-toolkit/src/lib/tools/color-generator-loader.ts:50


getTextColor

getTextColor(color): string

Parameters

Name Type
color string

Returns

string

Overrides

ColorGeneratorLoader.getTextColor

Defined in

projects/arlas-toolkit/src/lib/tools/color-generator-loader.ts:72


setKeysToColors

setKeysToColors(keysToColors): void

Set the keyToColors list. Updates the keysToColorsMap in order to be up to date with the list

Parameters

Name Type
keysToColors [string, string][]

Returns

void

Defined in

projects/arlas-toolkit/src/lib/tools/color-generator-loader.ts:100


updateKeywordColor

updateKeywordColor(keyword, color): void

updates the color of the given keyword if the keyword exists already. Otherwise it adds the new keyword and the corresponding color

Parameters

Name Type
keyword string
color string

Returns

void

Defined in

projects/arlas-toolkit/src/lib/tools/color-generator-loader.ts:81