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

Implements

  • ColorGeneratorLoader

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ArlasColorGeneratorLoader(configService, collaborativesearchService)

Parameters

Name Type
configService ArlasConfigService
collaborativesearchService ArlasCollaborativesearchService

Defined in

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

Properties

colorAggregations

colorAggregations: [Aggregation, Aggregation][]

Defined in

projects/arlas-toolkit/src/lib/services/color-generator-loader/color-generator-loader.service.ts:25


colorsSaturationWeight

colorsSaturationWeight: number

Implementation of

ColorGeneratorLoader.colorsSaturationWeight

Defined in

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


keysToColors

keysToColors: [string, string][]

Implementation of

ColorGeneratorLoader.keysToColors

Defined in

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


keysToColorsMap

keysToColorsMap: Map<string, string>

Defined in

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

Methods

getColor

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

Parameters

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

Returns

string

Implementation of

ColorGeneratorLoader.getColor

Defined in

projects/arlas-toolkit/src/lib/services/color-generator-loader/color-generator-loader.service.ts:44


getTextColor

getTextColor(color): string

Parameters

Name Type
color string

Returns

string

Implementation of

ColorGeneratorLoader.getTextColor

Defined in

projects/arlas-toolkit/src/lib/services/color-generator-loader/color-generator-loader.service.ts:66


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/services/color-generator-loader/color-generator-loader.service.ts:93


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/services/color-generator-loader/color-generator-loader.service.ts:75