aboutsummaryrefslogtreecommitdiff
path: root/src/flat-button.vala
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-03-01 13:46:07 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-03-01 13:46:07 +0100
commita4537a44bffc689d71714ac0d6b327877af237cc (patch)
tree7765df0861fe1a3cf755390e835c17d45f065f8f /src/flat-button.vala
parent5c9019b87b830f5d9d2b2f8aabfec26b345a1238 (diff)
downloadarctica-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/flat-button.vala')
-rw-r--r--src/flat-button.vala26
1 files changed, 24 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)