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
namestringThe palette's name; each ColorPalette it produces is named
"{name} {palette}", e.g."S-104 Day".tokensIReadOnlyDictionary<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
Tokens
The colours keyed by colour token.
public IReadOnlyDictionary<string, PaletteColors> Tokens { get; }
Property Value
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
palettePaletteTypeThe palette; an unknown value gets the Day colours.
Returns
Resolve(string, PaletteType)
The colour of token in palette.
public RgbaColor Resolve(string token, PaletteType palette)
Parameters
tokenstringThe colour token.
palettePaletteTypeThe palette; Day for an unknown palette.
Returns
Exceptions
- KeyNotFoundException
The palette doesn't define
token.