diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-09-18 10:34:00 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-09-18 13:00:38 +0200 |
commit | 72e03f97098259582e055191378f1c47ea34cc6c (patch) | |
tree | c176a93afd022d30390b5c9b1360ba2394b505e9 /src | |
parent | 7cbf0b144767bcfcf5aa7bae82700160fc489ab5 (diff) | |
download | arctica-greeter-72e03f97098259582e055191378f1c47ea34cc6c.tar.gz arctica-greeter-72e03f97098259582e055191378f1c47ea34cc6c.tar.bz2 arctica-greeter-72e03f97098259582e055191378f1c47ea34cc6c.zip |
a11y: Disable background image when in high-contrast mode.
This adds a configurable 'high-contrast-background-color' gsetting
parameter (defaulting to #000000), so the high contrast bgcolor becomes
customizable.
Diffstat (limited to 'src')
-rw-r--r-- | src/background.vala | 26 | ||||
-rw-r--r-- | src/settings.vala | 1 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/background.vala b/src/background.vala index 70813ea..a0a2af1 100644 --- a/src/background.vala +++ b/src/background.vala @@ -421,6 +421,25 @@ public class Background : Gtk.Fixed } } + private string _highcontrast_bgcolor = null; + public string highcontrast_bgcolor { + get { + if (_highcontrast_bgcolor == null) + { + var settings_bgcolor = AGSettings.get_string (AGSettings.KEY_HIGH_CONTRAST_BACKGROUND_COLOR); + var color = Gdk.RGBA (); + + if (settings_bgcolor == "" || !color.parse (settings_bgcolor)) + { + settings_bgcolor = "#000000"; + } + + _highcontrast_bgcolor = settings_bgcolor; + } + return _highcontrast_bgcolor; + } + } + private string _system_background; public string? system_background { get { @@ -722,7 +741,12 @@ public class Background : Gtk.Fixed private BackgroundLoader load_background (string? filename) { - if (filename == null) + var agsettings = new AGSettings (); + if (agsettings.high_contrast) + { + filename = highcontrast_bgcolor; + } + else if (filename == null) { filename = fallback_bgcolor; } else diff --git a/src/settings.vala b/src/settings.vala index 68ce674..7e8306d 100644 --- a/src/settings.vala +++ b/src/settings.vala @@ -28,6 +28,7 @@ public class AGSettings : Object { public const string KEY_BACKGROUND = "background"; public const string KEY_BACKGROUND_COLOR = "background-color"; + public const string KEY_HIGH_CONTRAST_BACKGROUND_COLOR = "high-contrast-background-color"; public const string KEY_BACKGROUND_MODE = "background-mode"; public const string KEY_DRAW_USER_BACKGROUNDS = "draw-user-backgrounds"; public const string KEY_DRAW_GRID = "draw-grid"; |