Vixen
dd8b0a81
csharp
public static class LinuxAccent

The accent colour the desktop is set to, asked of gsettings.

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

Remarks

org.gnome.desktop.interface accent-color, which arrived with GNOME 47. It is the same source LinuxAppearance reads color-scheme from and it is read the same way, so everything that file records about spawning gsettings applies here too — including that this is why the desktop appearance is read once and not polled.

⚠ The setting is a name and not a colour, so this desktop needs the table macOS went out of its way to avoid. MacOSAccent is written against +[NSColor controlAccentColor] precisely so that Apple's eight accent colours stay Apple's rather than becoming eight constants in this repository. GNOME offers no equivalent — accent-color answers 'teal', and the colour that name stands for lives in libadwaita's stylesheet — so the table below is unavoidable rather than a shortcut, and it is a table this repository now owns and will have to follow. The values are libadwaita's own AdwAccentColor definitions.

⚠ White is the text colour for every one of the nine, and that is GNOME's answer rather than a guess. libadwaita defines a single accent-fg-color of #ffffff and pairs it with all nine accents; the accents are chosen dark enough for that to hold. This matters more than it looks: PlatformInput.ApplyAccent puts root.system-accent on for the accent and its text or not at all, so a reader that answered the accent alone would fill AccentColor and leave --accent exactly where it was.

A name this does not know is Unknown and not the default blue. GNOME may add a tenth, and answering a colour for a name whose colour is not known here would be indistinguishable at the destination from having read it — SystemAccent's own remarks are about exactly that. An older GNOME with no such key, a desktop with no gsettings, and a name from the future all land in the same honest place.

Returned in sRGB, because SystemAccent is: the conversion to linear happens once, at the PlatformInput boundary that knows what a SystemPalette holds.

Methods (1)

Used by (2)

  • DesktopAppearanceVixen.Platform.Desktop
  • LinuxAccentTestsVixen.Platform.Linux.Tests