[libadwaita/wip/cdavis/recoloring-api: 2/2] Split suggested and accent colors




commit adbdafe9975559f56f04c0d33593474d989e8b90
Author: Christopher Davis <christopherdavis gnome org>
Date:   Sun Nov 21 21:53:59 2021 -0800

    Split suggested and accent colors

 demo/adw-demo-window.c                      |  3 +++
 src/adw-color-theme.c                       |  9 +++++++++
 src/adw-color-theme.h                       |  2 ++
 src/stylesheet/_colors.scss                 |  4 ++++
 src/stylesheet/widgets/_buttons.scss        | 12 ++++++------
 src/stylesheet/widgets/_message-dialog.scss |  2 +-
 6 files changed, 25 insertions(+), 7 deletions(-)
---
diff --git a/demo/adw-demo-window.c b/demo/adw-demo-window.c
index 97f1a749..2cbc44dc 100644
--- a/demo/adw-demo-window.c
+++ b/demo/adw-demo-window.c
@@ -494,6 +494,9 @@ color_row_create_cb (AdwEnumListItem *item)
   case ADW_COLOR_ACCENT_BG_COLOR:
     title = _("Accent Color");
     break;
+  case ADW_COLOR_SUGGESTED_BG_COLOR:
+    title = _("Suggested Color");
+    break;
   case ADW_COLOR_DESTRUCTIVE_BG_COLOR:
     title = _("Destructive Color");
     break;
diff --git a/src/adw-color-theme.c b/src/adw-color-theme.c
index f1d16df3..c88693cf 100644
--- a/src/adw-color-theme.c
+++ b/src/adw-color-theme.c
@@ -263,6 +263,10 @@ adw_color_theme_constructed (GObject *object)
   set_color (self, "accent_fg_color", calculate_accent_fg (&color));
   set_color (self, "accent_color", hueshift_accent (self, &color));
 
+  set_color (self, "suggested_bg_color", color);
+  set_color (self, "suggested_fg_color", calculate_accent_fg (&color));
+  set_color (self, "suggested_color", hueshift_accent (self, &color));
+
   color = GDK_RGBA ("e01b24");
   set_color (self, "destructive_bg_color", color);
   set_color (self, "destructive_fg_color", calculate_accent_fg (&color));
@@ -436,6 +440,11 @@ adw_color_theme_set_color_from_rgba (AdwColorTheme *self,
     set_color (self, "accent_fg_color", calculate_accent_fg (rgba));
     set_color (self, "accent_color", hueshift_accent (self, rgba));
     break;
+  case ADW_COLOR_SUGGESTED_BG_COLOR:
+    set_color (self, "suggested_bg_color", *rgba);
+    set_color (self, "suggested_fg_color", calculate_accent_fg (rgba));
+    set_color (self, "suggested_color", hueshift_accent (self, rgba));
+    break;
   case ADW_COLOR_DESTRUCTIVE_BG_COLOR:
     set_color (self, "destructive_bg_color", *rgba);
     set_color (self, "destructive_fg_color", calculate_accent_fg (rgba));
diff --git a/src/adw-color-theme.h b/src/adw-color-theme.h
index 8097c488..848e3fbf 100644
--- a/src/adw-color-theme.h
+++ b/src/adw-color-theme.h
@@ -22,6 +22,8 @@ G_BEGIN_DECLS
 typedef enum {
   ADW_COLOR_ACCENT_BG_COLOR,
 
+  ADW_COLOR_SUGGESTED_BG_COLOR,
+
   ADW_COLOR_DESTRUCTIVE_BG_COLOR,
 
   ADW_COLOR_SUCCESS_COLOR,
diff --git a/src/stylesheet/_colors.scss b/src/stylesheet/_colors.scss
index 6ff2eb86..ad9c2d95 100644
--- a/src/stylesheet/_colors.scss
+++ b/src/stylesheet/_colors.scss
@@ -9,6 +9,10 @@ $accent_bg_color: gtkcolor(accent_bg_color);
 $accent_fg_color: gtkcolor(accent_fg_color);
 $accent_color: gtkcolor(accent_color);
 
+$suggested_bg_color: gtkcolor(suggested_bg_color);
+$suggested_fg_color: gtkcolor(suggested_fg_color);
+$suggested_color: gtkcolor(suggested_color);
+
 $destructive_bg_color: gtkcolor(destructive_bg_color);
 $destructive_fg_color: gtkcolor(destructive_fg_color);
 $destructive_color: gtkcolor(destructive_color);
diff --git a/src/stylesheet/widgets/_buttons.scss b/src/stylesheet/widgets/_buttons.scss
index abb3fa33..60d0e3e3 100644
--- a/src/stylesheet/widgets/_buttons.scss
+++ b/src/stylesheet/widgets/_buttons.scss
@@ -196,10 +196,10 @@ button {
   &.suggested-action {
     @extend %opaque_button;
 
-    color: $accent_fg_color;
+    color: $suggested_fg_color;
 
     &, &:checked {
-      background-color: $accent_bg_color;
+      background-color: $suggested_bg_color;
     }
   }
 
@@ -369,8 +369,8 @@ menubutton {
   &.pill > button { @extend %pill_button; }
 
   &.suggested-action {
-    background-color: $accent_bg_color;
-    color: $accent_fg_color;
+    background-color: $suggested_bg_color;
+    color: $suggested_fg_color;
   }
 
   &.destructive-action {
@@ -514,8 +514,8 @@ splitbutton {
   }
 
   &.suggested-action {
-    background-color: $accent_bg_color;
-    color: $accent_fg_color;
+    background-color: $suggested_bg_color;
+    color: $suggested_fg_color;
   }
 
   &.destructive-action {
diff --git a/src/stylesheet/widgets/_message-dialog.scss b/src/stylesheet/widgets/_message-dialog.scss
index 48be0c12..e90d3506 100644
--- a/src/stylesheet/widgets/_message-dialog.scss
+++ b/src/stylesheet/widgets/_message-dialog.scss
@@ -45,7 +45,7 @@ window.dialog.message {
         }
 
         &.suggested-action {
-          color: $accent_color;
+          color: $suggested_color;
         }
 
         &.destructive-action {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]