Skip to content

arlas-wui-toolkit > "src/app/services/color-generator-loader/color-generator-loader.service" > 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

ArlasColorGeneratorLoader

Implements

  • ColorGeneratorLoader

Index

Constructors

Properties

Methods


Constructors

constructor

new ArlasColorGeneratorLoader(configService: ArlasConfigService, collaborativesearchService: ArlasCollaborativesearchService): ArlasColorGeneratorLoader

Defined in src/app/services/color-generator-loader/color-generator-loader.service.ts:24

Parameters:

Name Type
configService ArlasConfigService
collaborativesearchService ArlasCollaborativesearchService

Returns: ArlasColorGeneratorLoader


Properties

colorAggregations

● colorAggregations: Array<[Aggregation, Aggregation]>

Defined in src/app/services/color-generator-loader/color-generator-loader.service.ts:24


colorsSaturationWeight

● colorsSaturationWeight: number

Defined in src/app/services/color-generator-loader/color-generator-loader.service.ts:22


keysToColors

● keysToColors: Array<[string, string]> = new Array<[string, string]>()

Defined in src/app/services/color-generator-loader/color-generator-loader.service.ts:21


keysToColorsMap

● keysToColorsMap: Map<string, string> = new Map()

Defined in src/app/services/color-generator-loader/color-generator-loader.service.ts:23


Methods

getColor

getColor(key: string, externalKeysToColors?: Array<[string, string]>, externalColorsSaturationWeight?: number): string

Defined in src/app/services/color-generator-loader/color-generator-loader.service.ts:43

Parameters:

Name Type
key string
Optional externalKeysToColors Array<[string, string]>
Optional externalColorsSaturationWeight number

Returns: string


getTextColor

getTextColor(color: string): string

Defined in src/app/services/color-generator-loader/color-generator-loader.service.ts:65

Parameters:

Name Type
color string

Returns: string