Table of Contents

Class ApplicationPalette

Namespace
EncDotNet.S100.Portrayals.Application
Assembly
EncDotNet.S100.Portrayals.dll

The colours of a portrayal defined in code rather than by an S-100 portrayal catalogue: named colour tokens, each with a Day, Dusk and Night value. It produces the ColorPalette that drawing instructions' colour tokens and SVG palette classes resolve against.

public sealed class ApplicationPalette
Inheritance
ApplicationPalette
Inherited Members

Remarks

A catalogue-backed product reads its palettes from the catalogue's colour profile (S-100 Part 9 ยง9-13). A code-defined portrayal, such as the SoundCharts S-104 water level, has no colour profile, so it declares its tokens here. Pick token names that don't clash with S-100 Part 9 tokens (prefix them with the product, e.g. S104INK), so a symbol never resolves against the wrong colour.

Constructors

ApplicationPalette(string, IReadOnlyDictionary<string, PaletteColors>)

Creates a palette.

public ApplicationPalette(string name, IReadOnlyDictionary<string, PaletteColors> tokens)

Parameters

name string

The palette's name; each ColorPalette it produces is named "{name} {palette}", e.g. "S-104 Day".

tokens IReadOnlyDictionary<string, PaletteColors>

The colours keyed by colour token. Tokens are matched ordinally.

Exceptions

ArgumentException

A token is null, empty or whitespace.

Properties

Name

The palette's name.

public string Name { get; }

Property Value

string

Tokens

The colours keyed by colour token.

public IReadOnlyDictionary<string, PaletteColors> Tokens { get; }

Property Value

IReadOnlyDictionary<string, PaletteColors>

Methods

GetColorPalette(PaletteType)

The ColorPalette for palette: every token's colour as a #RRGGBB hex string. The Day, Dusk and Night palettes are built once and shared.

public ColorPalette GetColorPalette(PaletteType palette)

Parameters

palette PaletteType

The palette; an unknown value gets the Day colours.

Returns

ColorPalette

Resolve(string, PaletteType)

The colour of token in palette.

public RgbaColor Resolve(string token, PaletteType palette)

Parameters

token string

The colour token.

palette PaletteType

The palette; Day for an unknown palette.

Returns

RgbaColor

Exceptions

KeyNotFoundException

The palette doesn't define token.