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 | |
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.
-rw-r--r-- | data/org.ArcticaProject.arctica-greeter.gschema.xml | 4 | ||||
-rw-r--r-- | src/background.vala | 26 | ||||
-rw-r--r-- | src/settings.vala | 1 |
3 files changed, 30 insertions, 1 deletions
diff --git a/data/org.ArcticaProject.arctica-greeter.gschema.xml b/data/org.ArcticaProject.arctica-greeter.gschema.xml index d3eb5c5..b8085af 100644 --- a/data/org.ArcticaProject.arctica-greeter.gschema.xml +++ b/data/org.ArcticaProject.arctica-greeter.gschema.xml @@ -9,6 +9,10 @@ <default>'#4B1635'</default> <summary>Background color (e.g. #772953), set before wallpaper is seen</summary> </key> + <key name="high-contrast-background-color" type="s"> + <default>'#000000'</default> + <summary>Background color (e.g. #000000 or #FFFFFF) for high contrast mode</summary> + </key> <key name="togglebox-font-fgcolor" type="s"> <default>'#808080'</default> <summary>Font foreground color (e.g. #A0A0A0) for non-active/-hovered and non-selected session names in the session list</summary> 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"; |