diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-03-01 13:46:07 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-03-01 13:46:07 +0100 |
commit | a4537a44bffc689d71714ac0d6b327877af237cc (patch) | |
tree | 7765df0861fe1a3cf755390e835c17d45f065f8f /src | |
parent | 5c9019b87b830f5d9d2b2f8aabfec26b345a1238 (diff) | |
download | arctica-greeter-a4537a44bffc689d71714ac0d6b327877af237cc.tar.gz arctica-greeter-a4537a44bffc689d71714ac0d6b327877af237cc.tar.bz2 arctica-greeter-a4537a44bffc689d71714ac0d6b327877af237cc.zip |
src/flat-button.vala: Allow color-theming (etc.) of buttons created via the FlatButton class.
Diffstat (limited to 'src')
-rw-r--r-- | src/flat-button.vala | 26 | ||||
-rw-r--r-- | src/settings.vala | 2 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/flat-button.vala b/src/flat-button.vala index cf846b8..4b989b7 100644 --- a/src/flat-button.vala +++ b/src/flat-button.vala @@ -29,8 +29,30 @@ public class FlatButton : Gtk.Button try { var style = new Gtk.CssProvider (); - style.load_from_data ("* {outline-width: 1px; - }", -1); + style.load_from_data ("GtkButton, button {\n" + + " border-width: 1px;\n" + + " background-color: %s;\n".printf(AGSettings.get_string (AGSettings.KEY_FLATBUTTON_BGCOLOR)) + + " border-color: %s\n;".printf(AGSettings.get_string (AGSettings.KEY_FLATBUTTON_BORDERCOLOR)) + + "}\n" + + "button:hover,\n" + + "button:active,\n" + + "button:hover:active,\n" + + "button.selected:hover,\n" + + "button.selected {\n" + + " border-width: 1px;\n" + + " background-color: %s;\n".printf(AGSettings.get_string (AGSettings.KEY_FLATBUTTON_BGCOLOR)) + + " border-color: %s\n;".printf(AGSettings.get_string (AGSettings.KEY_FLATBUTTON_BORDERCOLOR)) + + "}\n" + + "button.high_contrast {\n" + + " background-color: %s;\n".printf ("rgba(70, 70, 70, 1.0)") + + " border-color: %s\n;".printf ("rgba(0, 0, 0, 1.0)") + + "}\n" + + "button.high_contrast:hover,\n" + + "button.high_contrast:active,\n" + + "button.high_contrast:hover:active,\n" + + "button.high_contrast.selected {\n" + + " background-color: %s;\n".printf ("rgba(0, 0, 0, 1.0)") + + "}\n", -1); get_style_context ().add_provider (style, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); } catch (Error e) diff --git a/src/settings.vala b/src/settings.vala index 9eef320..c90f3da 100644 --- a/src/settings.vala +++ b/src/settings.vala @@ -55,6 +55,8 @@ public class AGSettings : Object public const string KEY_REMOTE_SERVICE_CONFIGURE_URI = "remote-service-configure-uri"; public const string KEY_TOGGLEBOX_FONT_FGCOLOR = "togglebox-font-fgcolor"; public const string KEY_TOGGLEBOX_BUTTON_BGCOLOR = "togglebox-button-bgcolor"; + public const string KEY_FLATBUTTON_BGCOLOR = "flatbutton-bgcolor"; + public const string KEY_FLATBUTTON_BORDERCOLOR = "flatbutton-bordercolor"; public const string KEY_ENABLE_HIDPI = "enable-hidpi"; public const string KEY_MENUBAR_ALPHA = "menubar-alpha"; |