StyleColor struct Core
A colour in an ArionStyle: a fixed colour, or a theme token (Tokens) read from the active theme each time it is drawn - so a style written with tokens follows every theme switch without being written again. A fixed Rgba converts implicitly.
public readonly struct StyleColor : IEquatable<StyleColor>
- Namespace
- ArionUI.Presentation.Controls
- Package
- ArionUI.Presentation ·
dotnet add package ArionUI.Presentation --prerelease - Implements
- IEquatable<StyleColor>
Properties
Token
public string? Token { get; }The token's name ("accent", "card-fill"); null for a fixed colour.
Methods
Equals
public override bool Equals(object? obj);
Equals
public bool Equals(StyleColor other);
FromToken
public static StyleColor FromToken(string name, Func<ArionTheme, Rgba> read);A named theme colour, read from the theme at draw time.
Parameters
nameThe token's name, as a text form would spell it.
readReads the colour from a theme.
GetHashCode
public override int GetHashCode();
Resolve
public Rgba Resolve(ArionTheme theme);The colour under theme.
ToString
public override string ToString();The token's name, or the fixed colour.
WithAlpha
public StyleColor WithAlpha(byte value);The same colour (or token) with its alpha replaced - a token stays a token.
Operators
operator !=
public static bool operator !=(StyleColor left, StyleColor right);Different colours or tokens.
operator ==
public static bool operator ==(StyleColor left, StyleColor right);Equal colours or equal tokens.
operator implicit
public static implicit operator StyleColor(Rgba color);A fixed colour.
