DesktopAppearance record

Namespace Runic.Platform in Runic.Platform 0.23.0

public sealed record DesktopAppearance : IEquatable<DesktopAppearance>

Inherits or implements IEquatable.

Unknown optional preferences remain null rather than becoming false.

Constructors

DesktopAppearance

public DesktopAppearance(DesktopColorScheme ColorScheme = DesktopColorScheme.NoPreference, DesktopAccentColor? AccentColor = null, bool? HighContrast = null, bool? ReducedMotion = null)

Unknown optional preferences remain null rather than becoming false.

Properties

AccentColor

public DesktopAccentColor? AccentColor { get; init; }

No documentation.

ColorScheme

public DesktopColorScheme ColorScheme { get; init; }

No documentation.

Contrast

public DesktopContrast? Contrast { get; init; }

The desktop's contrast preference; null when the desktop has no such setting or it could not be read.

Remarks

Windows reports DesktopContrast.ForcedColors while a contrast theme is on, macOS DesktopContrast.More with "Increase contrast", and Linux DesktopContrast.More when the Settings portal's org.freedesktop.appearance contrast is 1 (GNOME's "High Contrast"). Setting it sets DesktopAppearance.HighContrast too.

HighContrast

public bool? HighContrast { get; init; }

Whether the desktop asks for more contrast in any form: true for DesktopContrast.More and DesktopContrast.ForcedColors, false for DesktopContrast.NoPreference, and null while DesktopAppearance.Contrast is null.

Remarks

Derived from DesktopAppearance.Contrast, which tells the two apart. Setting it to true sets DesktopAppearance.Contrast to DesktopContrast.More unless it already asks for more contrast, and false sets DesktopContrast.NoPreference.

ReducedMotion

public bool? ReducedMotion { get; init; }

No documentation.

SystemColors

public DesktopSystemColors? SystemColors { get; init; }

The palette the desktop forces while DesktopAppearance.Contrast is DesktopContrast.ForcedColors; null otherwise, and where the desktop has none to report (macOS, Linux).

Remarks

It is null whenever DesktopAppearance.Contrast is not DesktopContrast.ForcedColors, also when it was set: appearance with { Contrast = DesktopContrast.NoPreference } drops the palette, and a palette set without forced colours is ignored, also by equality.

TextScale

public double? TextScale { get; init; }

The desktop's text size preference as a factor of the default text size: 1 for the default, 1.5 for text half as large again; null when the desktop has no such setting or it could not be read. Multiply font sizes by it, as a CSS root font size would be, independently of the display scale.

Exceptions

ArgumentOutOfRangeException

The value is not a finite number greater than 0.

Remarks

Windows reports the Accessibility "Text size" setting (1 to 2.25), and Linux GNOME's text scaling factor (0.5 to 3) where the Settings portal exposes it. macOS has no system-wide setting that applications can read and reports null.

Methods

Equals

public bool Equals(DesktopAppearance? other)

Inherits documentation from IEquatable.Equals.

GetHashCode

public override int GetHashCode()

Inherits documentation from Object.GetHashCode.