[libadwaita/wip/exalm/selection-color: 3/3] stylesheet: Use lighter selection color




commit a2ab6d0402f0cbb3374cf13b6df91553e3724295
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon May 3 17:54:18 2021 +0500

    stylesheet: Use lighter selection color
    
    Fixes https://gitlab.gnome.org/GNOME/libadwaita/-/issues/109

 src/stylesheet/_common.scss              | 10 ++++++++++
 src/stylesheet/widgets/_entries.scss     |  6 +++++-
 src/stylesheet/widgets/_labels.scss      |  7 +++++--
 src/stylesheet/widgets/_spin-button.scss |  6 +++++-
 src/stylesheet/widgets/_views.scss       |  8 +++++++-
 5 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/src/stylesheet/_common.scss b/src/stylesheet/_common.scss
index 11b1bc1..9b6f354 100644
--- a/src/stylesheet/_common.scss
+++ b/src/stylesheet/_common.scss
@@ -51,6 +51,16 @@ dnd {
   &:disabled { color: mix($selected_fg_color, $selected_bg_color, 50%); }
 }
 
+%text_selection {
+  background-color: desaturate(transparentize($selected_bg_color, 0.7), 100%);
+  color: transparent;
+}
+
+%text_selection_focused {
+  background-color: transparentize($selected_bg_color, 0.7);
+  color: transparent;
+}
+
 :not(window):drop(active):focus,
 :not(window):drop(active) { // FIXME needs to be done widget by widget, this wildcard should really die
   border-color: $drop_target_color;
diff --git a/src/stylesheet/widgets/_entries.scss b/src/stylesheet/widgets/_entries.scss
index 52cca6c..415bc34 100644
--- a/src/stylesheet/widgets/_entries.scss
+++ b/src/stylesheet/widgets/_entries.scss
@@ -23,7 +23,11 @@ entry {
       }
 
       > selection {
-        @extend %selected_items;
+        @extend %text_selection;
+
+        &:focus-within:not(:backdrop) {
+          @extend %text_selection_focused;
+        }
       }
     }
 
diff --git a/src/stylesheet/widgets/_labels.scss b/src/stylesheet/widgets/_labels.scss
index d9decbc..a96ba21 100644
--- a/src/stylesheet/widgets/_labels.scss
+++ b/src/stylesheet/widgets/_labels.scss
@@ -6,8 +6,11 @@ label {
   }
 
   > selection {
-    background-color: $selected_bg_color;
-    color: $selected_fg_color;
+    @extend %text_selection;
+  }
+
+  &:focus:not(:backdrop) > selection {
+    @extend %text_selection_focused;
   }
 
   &:disabled {
diff --git a/src/stylesheet/widgets/_spin-button.scss b/src/stylesheet/widgets/_spin-button.scss
index 578217c..f5b07d4 100644
--- a/src/stylesheet/widgets/_spin-button.scss
+++ b/src/stylesheet/widgets/_spin-button.scss
@@ -109,10 +109,14 @@ spinbutton {
       padding: 0;
       border-radius: 0;
 
-      > selection { @extend %selected_items; }
+      > selection { @extend %text_selection; }
       > block-cursor { @include entry(block_cursor); }
     }
 
+    &:focus-within:not(:backdrop) > text > selection {
+      @extend %text_selection_focused;
+    }
+
     > button {
       min-height: 32px;
       min-width: 32px;
diff --git a/src/stylesheet/widgets/_views.scss b/src/stylesheet/widgets/_views.scss
index 50167b8..db4bdb4 100644
--- a/src/stylesheet/widgets/_views.scss
+++ b/src/stylesheet/widgets/_views.scss
@@ -21,7 +21,13 @@ textview {
   > text {
     @extend %view;
 
-    > selection { &:focus, & { @extend %selected_items; }}
+    > selection {
+      @extend %text_selection;
+
+      &:focus:not(:backdrop) {
+        @extend %text_selection_focused;
+      }
+    }
   }
 
   > border {


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