Class Palette<T>
- Namespace
- Archipelago.MultiClient.Net.Colors
- Assembly
- Archipelago.MultiClient.Net.dll
Palette/theme support for client colors
public class Palette<T>
Type Parameters
T
The type of actual color in the palette, typically an engine- or framework-specific Color struct
- Inheritance
-
Palette<T>
- Inherited Members
Constructors
Palette(T, Dictionary<PaletteColor, T>)
Creates a custom palette
public Palette(T defaultColor, Dictionary<PaletteColor, T> palette)
Parameters
defaultColor
TThe default color for the palette
palette
Dictionary<PaletteColor, T>The colors in the palette. Note that this does not need to define a mapping for every PaletteColor if it is not desired.
Properties
DefaultColor
The default color to use in the palette when color is not specified, or the requested color is not in the palette
public T DefaultColor { get; }
Property Value
- T
this[PaletteColor?]
Retrieves a color from the palette
public T this[PaletteColor? color] { get; }
Parameters
color
PaletteColor?The palette color to look up
Property Value
- T
The requested color. Returns the default color if the requested color was null or not defined in this palette.
Methods
Edit(Dictionary<PaletteColor, T>)
Creates a copy of this palette with the specified colors replaced. The default color is preserved.
public Palette<T> Edit(Dictionary<PaletteColor, T> paletteEdits)
Parameters
paletteEdits
Dictionary<PaletteColor, T>A mapping specifying colors to replace
Returns
- Palette<T>
Edit(T, Dictionary<PaletteColor, T>)
Creates a copy of this palette with the specified colors replaced
public Palette<T> Edit(T newDefault, Dictionary<PaletteColor, T> paletteEdits)
Parameters
newDefault
TThe new default color
paletteEdits
Dictionary<PaletteColor, T>A mapping specifying colors to replace
Returns
- Palette<T>
Transform<U>(Func<T, U>)
Creates a copy of this palette with all values transformed to another type
public Palette<U> Transform<U>(Func<T, U> transform)
Parameters
transform
Func<T, U>A transformation function to convert to the new type
Returns
- Palette<U>
Type Parameters
U
The desired color type for the new palette