Table of Contents

Class ColorPalette

Namespace
EncDotNet.S100.Pipelines
Assembly
EncDotNet.S100.Core.dll

A named set of colours used for portrayal, keyed by S-100 colour token.

public sealed class ColorPalette
Inheritance
ColorPalette
Inherited Members

Remarks

Portrayal catalogues load one palette per PaletteType from their colour profile and expose the active one through ActivePalette.

Constructors

ColorPalette(string, IReadOnlyDictionary<string, string>)

Creates a palette.

public ColorPalette(string name, IReadOnlyDictionary<string, string> colors)

Parameters

name string

The palette name.

colors IReadOnlyDictionary<string, string>

Colours keyed by colour token; the dictionary is used as-is, not copied.

Properties

Colors

Colours keyed by S-100 colour token (e.g. "DEPDW"), with values as #RRGGBB hex strings. Token matching follows the supplied dictionary's comparer.

public IReadOnlyDictionary<string, string> Colors { get; }

Property Value

IReadOnlyDictionary<string, string>

Default

An empty palette named "Day". Every token resolves to the Resolve(string) fallback; catalogues use it as the active palette until a real one has been loaded.

public static ColorPalette Default { get; }

Property Value

ColorPalette

Name

The palette name (e.g. "Day", "Dusk", "Night").

public string Name { get; }

Property Value

string

Methods

FromType(PaletteType)

Returns an empty placeholder palette named after type.

public static ColorPalette FromType(PaletteType type)

Parameters

type PaletteType

The palette type.

Returns

ColorPalette

Default for Day (and unknown values); otherwise a new empty palette named "Dusk" or "Night". The result carries no colours; real palettes come from a portrayal catalogue's colour profile.

Resolve(string)

Resolves a colour token to its hex colour.

public string Resolve(string token)

Parameters

token string

The S-100 colour token.

Returns

string

The token's hex colour, or "#000000" when the palette does not define it.

TryResolve(string, out string)

Attempts to resolve a colour token to its hex colour.

public bool TryResolve(string token, out string hex)

Parameters

token string

The S-100 colour token.

hex string

When this method returns true, the token's hex colour.

Returns

bool

true when the palette defines token.