Vixen
feb85697
csharp
public readonly record struct SystemSemanticColors

The operating system's own semantic palette, as much of it as the platform can read.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The platform half of SystemPalette's dynamic roles, named by the CSS system colour each fills — so that the mapping from a platform's vocabulary onto the sheet's is made once, in the platform's reader, where the person writing it can see both names. PlatformInput.ApplySemanticColors writes every role that is not null with SystemPalette.SetPlatform, which survives the appearance and contrast changes that Reset the default tables underneath.

⚠ Every role is nullable separately, and a partial read is the normal case rather than a failure. A desktop has a word for some of these and not others — Windows has no mark colour, GNOME has no separator — and a role nobody supplied keeps following SystemPalette's own light, dark or high-contrast table, which is a browser's answer and a reasonable one. What a platform must never do is invent a value for a role it could not read: at the destination that is indistinguishable from having read it, and it would stop following the appearance the way the table does.

⚠ sRGB, like SystemAccent and for the same reason. Every platform hands its colours over in sRGB — NSColor through sRGBColorSpace, a COLORREF — while SystemPalette holds linear and its own remarks record that handing it sRGB makes a palette that is visibly too bright with nothing reporting it. The conversion happens once, at the PlatformInput boundary, rather than in each reader where the second one written is the one that forgets.

⚠ Not Mark, MarkText, AccentColor or AccentColorText. The first two no desktop names. The accent pair is SystemAccent, read on its own terms because it drives a theme token and a class the sheet keys on, and a second path to the same role would be two writers of one cell.

Fields and properties (13)

  • public Color4? Canvas

    The background of application content — CSS Canvas.

  • public Color4? CanvasText

    The text on it — CSS CanvasText; AppKit's labelColor.

  • public Color4? LinkText

    The colour of a link — CSS LinkText.

  • public Color4? ButtonFace

    The face of a push button — CSS ButtonFace.

  • public Color4? ButtonText

    The text on a button — CSS ButtonText.

  • public Color4? ButtonBorder

    The border of a button — CSS ButtonBorder; AppKit's separatorColor.

  • public Color4? Field

    The background of an input field — CSS Field.

  • public Color4? FieldText

    The text in it — CSS FieldText.

  • public Color4? Highlight

    The background of a selected item — CSS Highlight.

  • public Color4? HighlightText

    The text on a selected item — CSS HighlightText.

  • public Color4? GrayText

    Disabled or secondary text — CSS GrayText.

  • public static SystemSemanticColors Unknown

    What a platform with no way to read its semantic palette reports.

  • public bool IsKnown

    Whether the platform read any role at all.

Methods (1)

  • public SystemSemanticColors(Color4? Canvas = null, Color4? CanvasText = null, Color4? LinkText = null, Color4? ButtonFace = null, Color4? ButtonText = null, Color4? ButtonBorder = null, Color4? Field = null, Color4? FieldText = null, Color4? Highlight = null, Color4? HighlightText = null, Color4? GrayText = null)

    The operating system's own semantic palette, as much of it as the platform can read.

Used by (14)

  • DesktopAppearanceVixen.Platform.Desktop
  • DesktopAppearanceTestsVixen.Platform.Desktop.Tests
  • DesktopPlatformVixen.Platform.Desktop
  • HeadlessPlatformVixen.Platform.Headless
  • IPlatformVixen.Platform
  • MacOSSemanticColorTestsVixen.Platform.MacOS.Tests
  • MacOSSemanticColorsVixen.Platform.MacOS
  • PlatformInputVixen.Platform.Ui
  • SemanticColorWiringTestsVixen.Ui.Desktop.Tests
  • SystemPaletteWiringTestsVixen.Platform.Ui.Tests
  • WindowsSemanticColorsVixen.Platform.Windows
  • WindowsSemanticColorsTestsVixen.Platform.Windows.Tests
  • EditorHostTestsVixen.Editor.App.Tests
  • SwitchingPlatformVixen.Editor.App.Tests