Class ColorPalette
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
The colours offered in the colour chooser, and how readable a colour is on the app's dark surfaces.
public static class ColorPalette
- Inheritance
-
ColorPalette
- Inherited Members
Remarks
The swatches are picked for this app, not a general palette: every one of them reads on the dark card the console and the notices are drawn on. Three rows of the same eight hues, from vivid to pastel, and a last row with the app's own defaults so going back to one is a click away.
Readability is the WCAG contrast ratio, the measure accessibility guidelines use: 21 for white on black, 1 for a colour on itself. Text wants 4.5; a mark that only has to be seen — a level's dot or badge — 3.
Fields
DarkSurface
The card the console and the notices are drawn on: translucent white over black.
public static readonly Color DarkSurface
Field Value
- Color
MarkContrast
A mark that only has to be seen: what the notice levels have to reach.
public const double MarkContrast = 3
Field Value
RowLength
How many swatches a row has.
public const int RowLength = 8
Field Value
Swatches
Four rows of eight, in reading order.
public static readonly IReadOnlyList<string> Swatches
Field Value
TextContrast
Text: what console colours have to reach.
public const double TextContrast = 4.5
Field Value
Methods
Contrast(Color, Color)
The WCAG contrast ratio between two colours, from 1 to 21.
public static double Contrast(Color a, Color b)
Parameters
aColorbColor
Returns
ReadsWellOnDark(Color, double)
Whether color reaches threshold on DarkSurface.
public static bool ReadsWellOnDark(Color color, double threshold)
Parameters
colorColorthresholddouble
Returns
ToHex(Color)
The colour as the settings store it: #RRGGBB, upper case, no alpha.
public static string ToHex(Color c)
Parameters
cColor
Returns
TryParse(string?)
A colour from #RRGGBB, or null when the text is not one (yet).
public static Color? TryParse(string? hex)
Parameters
hexstring
Returns
- Color?