SkinDefinitionText

public static class SkinDefinitionText
The text form of a skin definition. One property per line:
// comment
Lit.Shades.Apex.Normal = #E2E2E2
Lit.Shades.Slab.Normal = Lit.Shades.Apex.Normal | Luminance -20%
Lit.Shape.Corners      = 3
Lit.Icons.Filter       = Saturation -70% | Mix Lit.Canvas.Paper 10%
Lit.Wires.Dash.Null    = 4 1
Colour literals use CSS notation: hex, oklch(), oklab() or rgb(), with an optional alpha after a slash. A filter is a bare stack of colour modifiers, or None. A dash pattern is dash and gap lengths in multiples of the wire width, or Solid. Everything else is this format's own.

Fields

NoFilter

#
public const string NoFilter = "None"
The word an empty filter is written as.

SolidDash

#
public const string SolidDash = "Solid"
The word a solid stroke is written as.

Methods

Parse

#
public static bool Parse(string text, SkinDefinition definition, List<string> errors)
Parse definition text into an existing definition. Lines that cannot be read are reported and skipped; the rest are applied.
text (string)Definition text.
definition (SkinDefinition)Definition to add bindings to.
errors (List<string>)Receives one message per faulty line, with its line number.
True if every line was read.

TryParseBinding

#
public static bool TryParseBinding(string text, PropertyType kind, out Binding binding, out string error)
text (string)
kind (PropertyType)
binding (out Binding)
error (out string)

TryParseColour

#
public static bool TryParseColour(string text, out Colour colour)
Parse a colour literal in CSS notation: #RGB, #RRGGBB, #RRGGBBAA, oklch(L C H), oklab(L a b) or rgb(r g b), each optionally followed by "/ alpha" where alpha is a fraction or a percentage.
text (string)
colour (out Colour)

TryParseDash

#
public static bool TryParseDash(string text, out float[] dash, out string error)
Parse a dash pattern: lengths separated by spaces or commas, or SolidDash.
text (string)
dash (out float[])
error (out string)

TryParseFilter

#
public static bool TryParseFilter(string text, out Modifier[] filter, out string error)
Parse a filter: colour modifiers separated by pipes, or NoFilter.
text (string)
filter (out Modifier[])
error (out string)

Write

#
public static string Write(SkinDefinition definition)
definition (SkinDefinition)

WriteColour

#
public static string WriteColour(Colour colour)
Write a colour literal. Colours defined in Oklab become oklch(); everything else becomes hex, rounded to the 8-bit grid. rgb() is still read, never written.
colour (Colour)

WriteDash

#
public static string WriteDash(float[] dash)
Write a dash pattern as its lengths separated by spaces, or SolidDash when there are none.
dash (float[])

WriteFilter

#
public static string WriteFilter(Modifier[] filter)
Write a filter as its modifiers separated by pipes, or NoFilter when there are none.
filter (Modifier[])

WriteLength

#
public static string WriteLength(double length)
length (double)