Xui.ToolKit.UI.Design
Assembly: Xui.ToolKit.UI · C# declarations · Assembly overview
Types
class ColorGroupenum ColorHarmonyreadonly struct CurveTokenenum DesignSystemChangeclass DesignSystemViewinterface IColorSysteminterface IDesignSysteminterface IDesignSystemChangeNotificationsinterface IMotionSysteminterface IShapeSysteminterface ISpacingSysteminterface ITypographySystemenum MotionPreferenceenum MotionPresetenum NeutralStylereadonly struct Oklchreadonly struct OklchRampenum ShapePresetenum SizingPresetreadonly struct SpacingScalereadonly struct SpringTokenreadonly struct TextStylereadonly struct TextStyleGroupclass XuiDesignSystemreadonly struct XuiDesignSystemOptions
class ColorGroup
A group of four semantically related colors derived from a single tonal palette, together with the underlying OKLCH ramp that generated them. Shared by all consumers; interaction colors are derived once on demand instead of copied into individual views.
public sealed class ColorGroup
{
public bool IsDark { get; init; }
public Color HoverBackground { get; }
public Color PressedBackground { get; }
public Color PressedContainer { get; }
public Color ToggleHoverBackground { get; }
public Color SelectedPressedBackground { get; }
public Color Background { get; init; }
public Color Foreground { get; init; }
public Color Container { get; init; }
public Color OnContainer { get; init; }
public OklchRamp Ramp { get; init; }
public nfloat BackgroundLightness { get; init; }
public static ColorGroup FromRamp(OklchRamp ramp, bool isDark);
}
Color ColorGroup.Background
public Color Background { get; init; }
Strong, saturated action color (ramp at tone 0.56 light / 0.75 dark). Use as fill for filled buttons, active indicators, primary UI elements.
NFloat ColorGroup.BackgroundLightness
public nfloat BackgroundLightness { get; init; }
The lightness value (0–1) used to produce Xui.ToolKit.UI.Design.ColorGroup.Background from the ramp. Enables relative hover/press offset computation.
Color ColorGroup.Container
public Color Container { get; init; }
Light tinted fill from the same palette (ramp at tone 0.90 light / 0.30 dark). Use for tonal buttons, chips, and highlighted list rows.
Color ColorGroup.Foreground
public Color Foreground { get; init; }
Black or white text/icon color on Background, selected by its actual luminance.
ColorGroup ColorGroup.FromRamp(OklchRamp ramp, bool isDark)
public static ColorGroup FromRamp(OklchRamp ramp, bool isDark);
Creates a Xui.ToolKit.UI.Design.ColorGroup from a tonal ramp and color scheme.
Color ColorGroup.HoverBackground
public Color HoverBackground { get; }
Background for a hovered filled control.
bool ColorGroup.IsDark
public bool IsDark { get; init; }
Whether this group belongs to a dark appearance palette.
Color ColorGroup.OnContainer
public Color OnContainer { get; init; }
Text/icon color on top of Container (ramp at tone 0.10 light / 0.90 dark).
Color ColorGroup.PressedBackground
public Color PressedBackground { get; }
Background for a pressed filled control.
Color ColorGroup.PressedContainer
public Color PressedContainer { get; }
Pressed state layer for an outline or text control.
OklchRamp ColorGroup.Ramp
public OklchRamp Ramp { get; init; }
The full tonal ramp for this palette entry (Lightness 0 to 1 at the group's hue). Use for computing hover/press state colors.
Color ColorGroup.SelectedPressedBackground
public Color SelectedPressedBackground { get; }
Pressed background within a segmented selection.
Color ColorGroup.ToggleHoverBackground
public Color ToggleHoverBackground { get; }
Hovered active toggle track.
enum ColorHarmony
Color-scheme relationship used to derive secondary/tertiary hues from a primary hue.
public enum ColorHarmony
{
Complementary,
Analogous,
SplitComplementary,
Triadic,
Tetradic,
}
ColorHarmony.Analogous
Analogous
Secondary = H + 30°, Tertiary = H + 60°.
ColorHarmony.Complementary
Complementary
Secondary = H + 180°.
ColorHarmony.SplitComplementary
SplitComplementary
Secondary = H + 150°, Tertiary = H + 210°.
ColorHarmony.Tetradic
Tetradic
Secondary = H + 90°, Tertiary = H + 180°, Quaternary = H + 270°.
ColorHarmony.Triadic
Triadic
Secondary = H + 120°, Tertiary = H + 240°.
readonly struct CurveToken
An easing curve paired with a default duration for animation. Wraps Xui.Core.Animation.Easing.CubicBezier from Xui.Core.Animation.
public readonly struct CurveToken
{
public Easing.CubicBezier Curve { get; init; }
public TimeSpan DefaultDuration { get; init; }
}
CubicBezier CurveToken.Curve
public Easing.CubicBezier Curve { get; init; }
The cubic Bezier easing curve.
TimeSpan CurveToken.DefaultDuration
public TimeSpan DefaultDuration { get; init; }
Default duration for this easing curve.
enum DesignSystemChange
Token groups affected by a live design-system update.
[Flags]
public enum DesignSystemChange
{
None = 0,
Colors = 1,
Typography = 2,
Spacing = 4,
Shape = 8,
Motion = 16,
All = Colors | Typography | Spacing | Shape | Motion,
}
DesignSystemChange.All
All = Colors | Typography | Spacing | Shape | Motion
Initial application or a complete refresh of every token group.
DesignSystemChange.Colors
Colors = 1
Palette or appearance changed; redraw without layout.
DesignSystemChange.Motion
Motion = 16
Animation preferences or timings changed.
DesignSystemChange.None
None = 0
No tokens changed.
DesignSystemChange.Shape
Shape = 8
Corner radii changed; redraw without layout.
DesignSystemChange.Spacing
Spacing = 4
Spacing or control sizing changed; measure and arrange again.
DesignSystemChange.Typography
Typography = 2
Font family or metrics changed; measure and arrange again.
class DesignSystemView
Provides a device-aware design system to a subtree of controls.
public sealed class DesignSystemView : View
{
public DesignSystemView(View content, XuiDesignSystemOptions? options = null);
public override int Count { get; }
public override View this[int index] { get; }
public override object? GetService(Type type);
protected override void OnActivate();
protected override void OnDeactivate();
protected override Size MeasureCore(Size available, IMeasureContext context);
protected override void ArrangeCore(Rect rect, IMeasureContext context);
}
DesignSystemView.DesignSystemView(View content, XuiDesignSystemOptions? options = null)
public DesignSystemView(View content, XuiDesignSystemOptions? options = null);
Wraps content with the supplied theme, or the default Xui theme.
void DesignSystemView.ArrangeCore(Rect rect, IMeasureContext context)
protected override void ArrangeCore(Rect rect, IMeasureContext context);
Override to arrange children within this view's final frame.
int DesignSystemView.Count
public override int Count { get; }
Returns the number of child views. Used by layout containers and traversal logic. Leaf views should return 0.
object? DesignSystemView.GetService(Type type)
public override object? GetService(Type type);
Resolves a service of the given type by walking up the parent chain. Returns null if no ancestor provides the service.
View DesignSystemView.this[int index]
public override View this[int index] { get; }
Indexer to access child views by index. Layout containers should implement this to expose their children.
Size DesignSystemView.MeasureCore(Size available, IMeasureContext context)
protected override Size MeasureCore(Size available, IMeasureContext context);
Override to compute the desired border-edge size.
void DesignSystemView.OnActivate()
protected override void OnActivate();
Called when this view becomes active — it will receive events, render, and animate. Override this to start animations, subscribe to data sources, or acquire resources.
void DesignSystemView.OnDeactivate()
protected override void OnDeactivate();
Called when this view becomes dormant — it should stop animations, timers, and event subscriptions. The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
interface IColorSystem
Provides color roles derived from a seed palette, grouped into semantic Xui.ToolKit.UI.Design.ColorGroup bundles and a set of neutral/structural colors.
public interface IColorSystem
{
ColorGroup Application { get; }
ColorGroup Surface { get; }
ColorGroup Neutral { get; }
Color Outline { get; }
Color OutlineVariant { get; }
ColorGroup Primary { get; }
ColorGroup Secondary { get; }
ColorGroup Tertiary { get; }
ColorGroup Warning { get; }
ColorGroup Error { get; }
Color FocusRing { get; }
OklchRamp GetTonalRamp(nfloat hueDegrees, nfloat chroma);
bool IsDark { get; }
}
ColorGroup IColorSystem.Application
ColorGroup Application { get; }
The application canvas color group. Background = window/screen fill, Foreground = body text, Container = card/panel fill, OnContainer = card text.
ColorGroup IColorSystem.Error
ColorGroup Error { get; }
Error / destructive state group (from the Error tonal ramp).
Color IColorSystem.FocusRing
Color FocusRing { get; }
Focus ring color (typically Tertiary.Background at full opacity).
OklchRamp IColorSystem.GetTonalRamp(NFloat hueDegrees, NFloat chroma)
OklchRamp GetTonalRamp(nfloat hueDegrees, nfloat chroma);
Returns a full tonal ramp for any hue/chroma combination.
bool IColorSystem.IsDark
bool IsDark { get; }
True if the current effective color scheme is dark.
ColorGroup IColorSystem.Neutral
ColorGroup Neutral { get; }
Low-chroma interactive group matching the surface tone. Used for quiet buttons, toolbars, and controls that should not compete with Primary/Secondary/Tertiary.
Color IColorSystem.Outline
Color Outline { get; }
Neutral border/divider color (mid-tone).
Color IColorSystem.OutlineVariant
Color OutlineVariant { get; }
Lighter neutral border/divider variant.
ColorGroup IColorSystem.Primary
ColorGroup Primary { get; }
Brand / primary action group (from the Primary tonal ramp).
ColorGroup IColorSystem.Secondary
ColorGroup Secondary { get; }
Supporting / secondary action group (from the Secondary tonal ramp).
ColorGroup IColorSystem.Surface
ColorGroup Surface { get; }
The surface (card/panel) color group, slightly elevated from Application. Background = card fill, Foreground = card body text, Container = alternate surface (e.g. alternating table row, hover bg), OnContainer = secondary text on alternate surface.
ColorGroup IColorSystem.Tertiary
ColorGroup Tertiary { get; }
Tertiary highlight / accent group (from the Tertiary tonal ramp).
ColorGroup IColorSystem.Warning
ColorGroup Warning { get; }
Warning / caution state group (yellow-orange tonal ramp).
interface IDesignSystem
Root interface for the Xui Design System. Resolved from the parent-chain service provider via GetService<IDesignSystem>().
public interface IDesignSystem
{
IColorSystem Colors { get; }
ITypographySystem Typography { get; }
ISpacingSystem Spacing { get; }
IShapeSystem Shape { get; }
IMotionSystem Motion { get; }
event Action<DesignSystemChange>? Changed;
}
event Action<DesignSystemChange>? IDesignSystem.Changed
event Action<DesignSystemChange>? Changed;
Raised with the affected token groups after an update; consumers invalidate only the required passes.
IColorSystem IDesignSystem.Colors
IColorSystem Colors { get; }
Color tokens and palette math.
IMotionSystem IDesignSystem.Motion
IMotionSystem Motion { get; }
Motion tokens (curves and springs).
IShapeSystem IDesignSystem.Shape
IShapeSystem Shape { get; }
Shape / corner-radius tokens.
ISpacingSystem IDesignSystem.Spacing
ISpacingSystem Spacing { get; }
Spacing tokens derived from the 4-pt grid.
ITypographySystem IDesignSystem.Typography
ITypographySystem Typography { get; }
Typography scale.
interface IDesignSystemChangeNotifications
Receives a design-token update after a view has resolved its Xui.ToolKit.UI.Design.IDesignSystem. Implementations read shared tokens from the retained provider and invalidate only affected passes.
public interface IDesignSystemChangeNotifications
{
void OnDesignTokenChange(DesignSystemChange changes);
}
void IDesignSystemChangeNotifications.OnDesignTokenChange(DesignSystemChange changes)
void OnDesignTokenChange(DesignSystemChange changes);
Responds to the changed token groups without duplicating theme state on the view.
interface IMotionSystem
Provides motion tokens for animations.
public interface IMotionSystem
{
MotionPreference Preference { get; }
bool ReducedMotion { get; }
CurveToken EmphasizedDecelerate { get; }
CurveToken EmphasizedAccelerate { get; }
CurveToken Standard { get; }
CurveToken StandardDecelerate { get; }
CurveToken StandardAccelerate { get; }
CurveToken Linear { get; }
SpringToken SpringBouncy { get; }
SpringToken SpringResponsive { get; }
SpringToken SpringSmooth { get; }
}
CurveToken IMotionSystem.EmphasizedAccelerate
CurveToken EmphasizedAccelerate { get; }
Elements leaving the screen — (0.3, 0.0, 0.8, 0.15), 200 ms.
CurveToken IMotionSystem.EmphasizedDecelerate
CurveToken EmphasizedDecelerate { get; }
Elements entering the screen — (0.05, 0.7, 0.1, 1.0), 400 ms.
CurveToken IMotionSystem.Linear
CurveToken Linear { get; }
Progress bars, continuous — (0.0, 0.0, 1.0, 1.0), any duration.
MotionPreference IMotionSystem.Preference
MotionPreference Preference { get; }
Whether springs or curves are preferred for interactive feedback.
bool IMotionSystem.ReducedMotion
bool ReducedMotion { get; }
True if the user has requested reduced motion (accessibility).
SpringToken IMotionSystem.SpringBouncy
SpringToken SpringBouncy { get; }
Art / lifestyle apps, button press — stiffness 600, damping 0.5.
SpringToken IMotionSystem.SpringResponsive
SpringToken SpringResponsive { get; }
Default interactive feedback — stiffness 300, damping 0.8.
SpringToken IMotionSystem.SpringSmooth
SpringToken SpringSmooth { get; }
Business / utility apps, modals — stiffness 200, damping 1.0.
CurveToken IMotionSystem.Standard
CurveToken Standard { get; }
General transitions — (0.2, 0.0, 0.0, 1.0), 300 ms.
CurveToken IMotionSystem.StandardAccelerate
CurveToken StandardAccelerate { get; }
Quick dismissals — (0.3, 0.0, 1.0, 1.0), 200 ms.
CurveToken IMotionSystem.StandardDecelerate
CurveToken StandardDecelerate { get; }
Settling transitions — (0.0, 0.0, 0.0, 1.0), 250 ms.
interface IShapeSystem
Provides corner-radius tokens scaled by Xui.ToolKit.UI.Design.IShapeSystem.RoundnessFactor.
public interface IShapeSystem
{
nfloat RoundnessFactor { get; }
CornerRadius None { get; }
CornerRadius ExtraSmall { get; }
CornerRadius Small { get; }
CornerRadius Medium { get; }
CornerRadius Large { get; }
CornerRadius ExtraLarge { get; }
CornerRadius Full { get; }
}
CornerRadius IShapeSystem.ExtraLarge
CornerRadius ExtraLarge { get; }
16 pt base, scaled by RoundnessFactor.
CornerRadius IShapeSystem.ExtraSmall
CornerRadius ExtraSmall { get; }
2 pt base, scaled by RoundnessFactor.
CornerRadius IShapeSystem.Full
CornerRadius Full { get; }
9999 pt — fully round (pill).
CornerRadius IShapeSystem.Large
CornerRadius Large { get; }
12 pt base, scaled by RoundnessFactor.
CornerRadius IShapeSystem.Medium
CornerRadius Medium { get; }
8 pt base, scaled by RoundnessFactor.
CornerRadius IShapeSystem.None
CornerRadius None { get; }
0 pt — no rounding.
NFloat IShapeSystem.RoundnessFactor
nfloat RoundnessFactor { get; }
Global multiplier for all corner radii (default 1.0).
CornerRadius IShapeSystem.Small
CornerRadius Small { get; }
4 pt base, scaled by RoundnessFactor.
interface ISpacingSystem
Provides two parallel spacing scales:
Xui.ToolKit.UI.Design.ISpacingSystem.Passive— for layout, content gaps, margins, card padding.Xui.ToolKit.UI.Design.ISpacingSystem.Active— for interactive leaf elements (button padding, input fields, hit targets). On desktop, Active aligns with Passive (tight). On touch, Active shifts up so that buttons/inputs get generous padding while layout stays compact.
public interface ISpacingSystem
{
SpacingScale Passive { get; }
SpacingScale Active { get; }
nfloat None { get; }
}
SpacingScale ISpacingSystem.Active
SpacingScale Active { get; }
Interactive element spacing scale (shifted up for touch targets).
NFloat ISpacingSystem.None
nfloat None { get; }
0 pt.
SpacingScale ISpacingSystem.Passive
SpacingScale Passive { get; }
Layout/content spacing scale.
interface ITypographySystem
Provides the typography scale. All FontSize values are pre-multiplied by the accessibility font scale.
public interface ITypographySystem
{
TextStyle Display { get; }
TextStyleGroup Headline { get; }
TextStyleGroup Title { get; }
TextStyleGroup Body { get; }
TextStyleGroup Label { get; }
string DefaultFontFamily { get; }
}
TextStyleGroup ITypographySystem.Body
TextStyleGroup Body { get; }
12–16 pt — Reading and UI text.
string ITypographySystem.DefaultFontFamily
string DefaultFontFamily { get; }
The default font family used across the application.
TextStyle ITypographySystem.Display
TextStyle Display { get; }
57 pt — Hero, marketing, splash.
TextStyleGroup ITypographySystem.Headline
TextStyleGroup Headline { get; }
24–32 pt — Page and section titles.
TextStyleGroup ITypographySystem.Label
TextStyleGroup Label { get; }
11–14 pt — Buttons, badges, captions.
TextStyleGroup ITypographySystem.Title
TextStyleGroup Title { get; }
14–22 pt — Card headers, toolbars, tabs.
enum MotionPreference
Whether the application prefers curve-based (Bezier) or spring-based (physics) animations.
public enum MotionPreference
{
Curve,
Spring,
}
MotionPreference.Curve
Curve
Duration + cubic Bezier easing.
MotionPreference.Spring
Spring
Spring physics (stiffness + damping).
enum MotionPreset
Controls animation timing and whether animations are enabled.
public enum MotionPreset
{
None,
Short,
Normal,
Long,
}
MotionPreset.Long
Long
Slow/deliberate animations (200% of normal duration). Useful for review/accessibility.
MotionPreset.None
None
No animations — all transitions snap instantly.
MotionPreset.Normal
Normal
Normal animation timing (default).
MotionPreset.Short
Short
Short/snappy animations (50% of normal duration).
enum NeutralStyle
Controls the relationship between Application and Surface background colors.
public enum NeutralStyle
{
Monochrome,
SecondaryApp,
SecondarySurface,
TertiaryApp,
TertiarySurface,
}
NeutralStyle.Monochrome
Monochrome
Both Application and Surface are desaturated neutral gray. No hue tint.
NeutralStyle.SecondaryApp
SecondaryApp
Application gets a subtle Secondary hue tint, Surface stays neutral. Suitable for apps with many panels/surfaces where the app background groups them.
NeutralStyle.SecondarySurface
SecondarySurface
Surface gets a subtle Secondary hue tint, Application stays neutral. Suitable when few panels appear and most widgets sit directly on the app background.
NeutralStyle.TertiaryApp
TertiaryApp
Application gets a subtle Tertiary hue tint, Surface stays neutral.
NeutralStyle.TertiarySurface
TertiarySurface
Surface gets a subtle Tertiary hue tint, Application stays neutral.
readonly struct Oklch
OKLCH perceptual color space (Oklab-based Lightness, Chroma, Hue). Interpolation in OKLCH produces vivid, perceptually uniform color transitions. See: https://bottosson.github.io/posts/oklab/
public readonly struct Oklch
{
public nfloat L { get; init; }
public nfloat C { get; init; }
public nfloat H { get; init; }
public Oklch(nfloat l, nfloat c, nfloat h);
public Oklch(Color color);
public Color ToColor();
public static nfloat MaxSrgbChroma(nfloat lightness, nfloat hueDegrees);
public static implicit operator Color(Oklch oklch);
public static implicit operator Oklch(Color color);
}
Oklch.Oklch(NFloat l, NFloat c, NFloat h)
public Oklch(nfloat l, nfloat c, nfloat h);
Creates a new OKLCH color value.
Oklch.Oklch(Color color)
public Oklch(Color color);
Converts an sRGB Xui.Core.Canvas.Color to OKLCH.
NFloat Oklch.C
public nfloat C { get; init; }
Colorfulness (0.0 = neutral gray; typical max ~0.37 for sRGB gamut).
NFloat Oklch.H
public nfloat H { get; init; }
Hue angle in degrees (0–360).
NFloat Oklch.L
public nfloat L { get; init; }
Perceptual lightness (0.0 = black, 1.0 = white).
NFloat Oklch.MaxSrgbChroma(NFloat lightness, NFloat hueDegrees)
public static nfloat MaxSrgbChroma(nfloat lightness, nfloat hueDegrees);
Returns the maximum chroma representable in sRGB for the given lightness and hue. Uses bisection search: for a candidate chroma, convert OKLCH to sRGB and check whether all channels are in [0, 1].
Color Oklch.ToColor()
public Color ToColor();
Converts this OKLCH value back to an sRGB Xui.Core.Canvas.Color.
Oklch.implicit operator Oklch(Color color)
public static implicit operator Oklch(Color color);
Converts an sRGB Xui.Core.Canvas.Color to OKLCH.
Oklch.implicit operator Color(Oklch oklch)
public static implicit operator Color(Oklch oklch);
Converts this OKLCH value to an sRGB Xui.Core.Canvas.Color.
readonly struct OklchRamp
A gamut-aware tonal ramp that maps t in [0, 1] to a color at lightness t. At each lightness, chroma is clamped to the sRGB gamut boundary for the hue, ensuring every output color is representable without clipping.
public readonly struct OklchRamp
{
public nfloat Hue { get; init; }
public nfloat TargetChroma { get; init; }
public OklchRamp(nfloat hueDegrees, nfloat targetChroma);
public Color this[nfloat t] { get; }
}
OklchRamp.OklchRamp(NFloat hueDegrees, NFloat targetChroma)
public OklchRamp(nfloat hueDegrees, nfloat targetChroma);
Creates a gamut-aware tonal ramp for the given hue and target chroma.
hueDegrees— Hue angle in degrees (0–360).targetChroma— Desired chroma level (will be clamped to sRGB gamut at each lightness).
NFloat OklchRamp.Hue
public nfloat Hue { get; init; }
Hue angle in degrees (0–360).
Color OklchRamp.this[NFloat t]
public Color this[nfloat t] { get; }
Evaluates the ramp at position t in [0, 1], returning an sRGB Color. t maps to lightness; chroma is gamut-clamped.
NFloat OklchRamp.TargetChroma
public nfloat TargetChroma { get; init; }
Requested target chroma (clamped to sRGB gamut at each lightness).
enum ShapePreset
Predefined shape profiles that control corner radius tokens across the design system.
public enum ShapePreset
{
Square,
Desktop,
Rounded,
RoundedPill,
Soft,
}
ShapePreset.Desktop
Desktop
Classic desktop style: slight container radius (~7pt), square buttons and inputs. Typical of macOS and Windows window chrome.
ShapePreset.Rounded
Rounded
Modern dialog style: large outer radius, smaller inner radius, small button radius (3–5pt). Similar to macOS alerts and Android Material dialogs.
ShapePreset.RoundedPill
RoundedPill
Same as Rounded but with fully-round (pill) buttons.
ShapePreset.Soft
Soft
Maximum roundness: large container radius, pill buttons. High visual softness.
ShapePreset.Square
Square
All corners square (0 radius everywhere).
enum SizingPreset
Predefined sizing profiles that control spacing tokens, minimum hit-test radius, and overall density of the UI.
public enum SizingPreset
{
Desktop,
TouchEnabled,
Mobile,
}
SizingPreset.Desktop
Desktop
Compact desktop: small spacing, small hit targets (4pt), precise pointer assumed. Suitable for dense desktop applications with mouse input.
SizingPreset.Mobile
Mobile
Mobile: generous spacing, large hit targets (22pt), finger-friendly. Suitable for phones and tablets.
SizingPreset.TouchEnabled
TouchEnabled
Touch-enabled desktop: same compact layout as Desktop but with larger hit targets (22pt). Good for laptop touchscreens and stylus-enabled desktops.
readonly struct SpacingScale
A set of spacing values on a geometric scale (S through XXXL). Used for both passive (layout/content) and active (interactive leaf) spacing.
public readonly struct SpacingScale
{
public nfloat S { get; init; }
public nfloat M { get; init; }
public nfloat L { get; init; }
public nfloat XL { get; init; }
public nfloat XXL { get; init; }
public nfloat XXXL { get; init; }
public nfloat MinHitTarget { get; init; }
}
NFloat SpacingScale.L
public nfloat L { get; init; }
Large spacing.
NFloat SpacingScale.M
public nfloat M { get; init; }
Medium spacing.
NFloat SpacingScale.MinHitTarget
public nfloat MinHitTarget { get; init; }
Minimum hit-test dimension for small interactive elements (icon buttons, tree toggles, etc.). On Desktop this is small (e.g. 20pt), on touch it's finger-sized (e.g. 44pt). Use as MinimumWidth/MinimumHeight on compact clickable views.
NFloat SpacingScale.S
public nfloat S { get; init; }
Small spacing.
NFloat SpacingScale.XL
public nfloat XL { get; init; }
Extra-large spacing.
NFloat SpacingScale.XXL
public nfloat XXL { get; init; }
2× extra-large spacing.
NFloat SpacingScale.XXXL
public nfloat XXXL { get; init; }
3× extra-large spacing.
readonly struct SpringToken
Spring physics parameters for animation.
public readonly struct SpringToken
{
public float Stiffness { get; init; }
public float Damping { get; init; }
}
float SpringToken.Damping
public float Damping { get; init; }
Damping ratio (1.0 = critically damped, less than 1.0 = bouncy).
float SpringToken.Stiffness
public float Stiffness { get; init; }
Spring stiffness (higher = faster oscillation).
readonly struct TextStyle
An immutable snapshot of a single text style from the typography scale.
public readonly struct TextStyle()
{
public string FontFamily { get; init; }
public nfloat FontSize { get; init; }
public nfloat LineHeight { get; init; }
public nfloat LetterSpacing { get; init; }
public FontWeight FontWeight { get; init; }
public FontStyle FontStyle { get; init; }
}
TextStyle.TextStyle()
public TextStyle();
An immutable snapshot of a single text style from the typography scale.
string TextStyle.FontFamily
public string FontFamily { get; init; }
Font family name.
NFloat TextStyle.FontSize
public nfloat FontSize { get; init; }
Font size in points (pre-multiplied by accessibility scale).
FontStyle TextStyle.FontStyle
public FontStyle FontStyle { get; init; }
Font style (normal, italic, oblique).
FontWeight TextStyle.FontWeight
public FontWeight FontWeight { get; init; }
Font weight (100–900).
NFloat TextStyle.LetterSpacing
public nfloat LetterSpacing { get; init; }
Additional letter spacing in points.
NFloat TextStyle.LineHeight
public nfloat LineHeight { get; init; }
Line height in points.
readonly struct TextStyleGroup
A group of three related text styles at small, medium, and large sizes.
public readonly struct TextStyleGroup
{
public TextStyle S { get; init; }
public TextStyle M { get; init; }
public TextStyle L { get; init; }
}
TextStyle TextStyleGroup.L
public TextStyle L { get; init; }
Large variant.
TextStyle TextStyleGroup.M
public TextStyle M { get; init; }
Medium variant.
TextStyle TextStyleGroup.S
public TextStyle S { get; init; }
Small variant.
class XuiDesignSystem
Concrete implementation of Xui.ToolKit.UI.Design.IDesignSystem that derives a complete set of design tokens from a small number of seed properties and the current Xui.Core.DI.IDeviceInfo.
public class XuiDesignSystem : IDesignSystem
{
public XuiDesignSystem(XuiDesignSystemOptions options, IDeviceInfo device);
public void Update(XuiDesignSystemOptions options, IDeviceInfo device);
public IColorSystem Colors { get; }
public ITypographySystem Typography { get; }
public ISpacingSystem Spacing { get; }
public IShapeSystem Shape { get; }
public IMotionSystem Motion { get; }
public event Action<DesignSystemChange>? Changed;
public void NotifyChanged(DesignSystemChange changes = DesignSystemChange.All);
}
XuiDesignSystem.XuiDesignSystem(XuiDesignSystemOptions options, IDeviceInfo device)
public XuiDesignSystem(XuiDesignSystemOptions options, IDeviceInfo device);
Creates a new design system from the given options and device info.
event Action<DesignSystemChange>? XuiDesignSystem.Changed
public event Action<DesignSystemChange>? Changed;
Raised with the affected token groups after an update; consumers invalidate only the required passes.
IColorSystem XuiDesignSystem.Colors
public IColorSystem Colors { get; }
Color tokens and palette math.
IMotionSystem XuiDesignSystem.Motion
public IMotionSystem Motion { get; }
Motion tokens (curves and springs).
void XuiDesignSystem.NotifyChanged(DesignSystemChange changes = DesignSystemChange.All)
public void NotifyChanged(DesignSystemChange changes = DesignSystemChange.All);
Raises the Xui.ToolKit.UI.Design.XuiDesignSystem.Changed event, causing widgets to re-query tokens.
IShapeSystem XuiDesignSystem.Shape
public IShapeSystem Shape { get; }
Shape / corner-radius tokens.
ISpacingSystem XuiDesignSystem.Spacing
public ISpacingSystem Spacing { get; }
Spacing tokens derived from the 4-pt grid.
ITypographySystem XuiDesignSystem.Typography
public ITypographySystem Typography { get; }
Typography scale.
void XuiDesignSystem.Update(XuiDesignSystemOptions options, IDeviceInfo device)
public void Update(XuiDesignSystemOptions options, IDeviceInfo device);
Updates the retained palette in place and rebuilds only other changed token groups.
readonly struct XuiDesignSystemOptions
Value-type options for constructing or updating a Xui.ToolKit.UI.Design.XuiDesignSystem without allocating a configuration object.
public readonly struct XuiDesignSystemOptions
{
public XuiDesignSystemOptions();
public nfloat PrimaryHue { get; init; }
public nfloat? SecondaryHue { get; init; }
public nfloat? TertiaryHue { get; init; }
public nfloat? NeutralHue { get; init; }
public ColorHarmony Harmony { get; init; }
public nfloat Chroma { get; init; }
public nfloat? PrimaryLightness { get; init; }
public nfloat RoundnessFactor { get; init; }
public ShapePreset Shape { get; init; }
public SizingPreset Sizing { get; init; }
public NeutralStyle NeutralStyle { get; init; }
public MotionPreference MotionPreference { get; init; }
public MotionPreset Motion { get; init; }
public string DefaultFontFamily { get; init; }
}
XuiDesignSystemOptions.XuiDesignSystemOptions()
public XuiDesignSystemOptions();
Initializes the default design-system settings.
NFloat XuiDesignSystemOptions.Chroma
public nfloat Chroma { get; init; }
Target chroma for the primary palette (typical range 0.10–0.35). Default: 0.15.
string XuiDesignSystemOptions.DefaultFontFamily
public string DefaultFontFamily { get; init; }
Default font family for all text styles. Default: system-ui.
ColorHarmony XuiDesignSystemOptions.Harmony
public ColorHarmony Harmony { get; init; }
Color harmony used to derive secondary/tertiary hues. Default: SplitComplementary.
MotionPreset XuiDesignSystemOptions.Motion
public MotionPreset Motion { get; init; }
Animation timing preset. Default: Normal.
MotionPreference XuiDesignSystemOptions.MotionPreference
public MotionPreference MotionPreference { get; init; }
Preferred animation style. Default: Curve.
NFloat? XuiDesignSystemOptions.NeutralHue
public nfloat? NeutralHue { get; init; }
Optional neutral hue override. If null, derived as primary hue desaturated.
NeutralStyle XuiDesignSystemOptions.NeutralStyle
public NeutralStyle NeutralStyle { get; init; }
Controls the hue relationship between Application and Surface backgrounds. Default: Monochrome.
NFloat XuiDesignSystemOptions.PrimaryHue
public nfloat PrimaryHue { get; init; }
Primary brand hue in degrees (0–360). Required.
NFloat? XuiDesignSystemOptions.PrimaryLightness
public nfloat? PrimaryLightness { get; init; }
Optional primary action lightness (0–1). Null uses the appearance's default action tone.
NFloat XuiDesignSystemOptions.RoundnessFactor
public nfloat RoundnessFactor { get; init; }
Global corner-radius multiplier (0.0 = square, 1.0 = default, 2.0 = very round). Default: 1.0.
NFloat? XuiDesignSystemOptions.SecondaryHue
public nfloat? SecondaryHue { get; init; }
Optional secondary hue override. If null, derived from Xui.ToolKit.UI.Design.XuiDesignSystemOptions.Harmony.
ShapePreset XuiDesignSystemOptions.Shape
public ShapePreset Shape { get; init; }
Shape preset controlling corner radius tokens. Default: Soft.
SizingPreset XuiDesignSystemOptions.Sizing
public SizingPreset Sizing { get; init; }
Sizing preset controlling spacing and hit-test targets. Default: Mobile.
NFloat? XuiDesignSystemOptions.TertiaryHue
public nfloat? TertiaryHue { get; init; }
Optional tertiary/accent hue override. If null, derived from Xui.ToolKit.UI.Design.XuiDesignSystemOptions.Harmony.