[gtk/wip/jimmac/adjust-for-contemporary-trends] Adwaita: remove edge highlights




commit ec58e8ff05a50f5ce53b1ca6eb20b2263c426cc7
Author: Jakub Steiner <jimmac gmail com>
Date:   Fri Jan 8 21:03:30 2021 +0100

    Adwaita: remove edge highlights
    
      - flat is the name of the game
      - kids scream make it flat
      - simplify mixins

 gtk/theme/Adwaita/_common.scss  |  15 ++----
 gtk/theme/Adwaita/_drawing.scss | 114 ++++++----------------------------------
 2 files changed, 20 insertions(+), 109 deletions(-)
---
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index 625744278c..3c2f312924 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -206,7 +206,6 @@ window.assistant {
   border: none;
   background-color: $osd_bg_color;
   background-clip: padding-box;
-  text-shadow: 0 1px black;
   -gtk-icon-shadow: 0 1px black;
 
 }
@@ -644,8 +643,7 @@ button {
     &.flat {
       @include button(undecorated);
 
-      box-shadow: none; //FIXME respect no edge on the button mixin
-      text-shadow: 0 1px black;
+      box-shadow: none;
       -gtk-icon-shadow: 0 1px black;
 
       &:hover { @include button(osd-hover); }
@@ -2345,7 +2343,6 @@ switch {
   border-radius: 14px;
   color: $fg_color;
   background-color: $dark_fill;
-  text-shadow: 0 1px transparentize(black, 0.9);
   transition: $focus_transition;
 
   @include focus-ring($offset: 0, $outer: true);
@@ -2356,8 +2353,6 @@ switch {
     color: $selected_fg_color;
     border-color: $switch_borders_color;
     background-color: $switch_bg_color;
-    text-shadow: 0 1px transparentize($switch_borders_color, 0.5),
-                 0 0 2px transparentize(white, 0.4);
   }
 
   &:disabled {
@@ -2376,13 +2371,13 @@ switch {
     border-radius: 50%;
     transition: $button_transition;
 
-    @include button(normal, $edge: $shadow_color);
+    @include button(normal);
   }
   
   > image { color: transparent; } /* only show i / o for the accessible theme */
 
   &:hover > slider {
-    @include button(hover, $edge: $shadow_color);
+    @include button(hover);
   }
 
   &:checked > slider { border: 1px solid $switch_borders_color; }
@@ -2677,14 +2672,14 @@ scale {
   }
 
   > trough > slider {
-    @include button(normal-alt, $edge: $shadow_color);
+    @include button(normal-alt);
 
     border: 1px solid darken($alt_borders_color, 3%);
     border-radius: 100%;
     transition: $button_transition;
     transition-property: background, border, box-shadow;
 
-    &:hover { @include button(hover, $edge: $shadow_color); }
+    &:hover { @include button(hover); }
 
     &:active { border-color: $selected_borders_color; }
 
diff --git a/gtk/theme/Adwaita/_drawing.scss b/gtk/theme/Adwaita/_drawing.scss
index 87dcad9130..767c012dc6 100644
--- a/gtk/theme/Adwaita/_drawing.scss
+++ b/gtk/theme/Adwaita/_drawing.scss
@@ -22,12 +22,6 @@
   }
 }
 
-@function _widget_edge($c:$borders_edge) {
-// outer highlight "used" on most widgets
-  @if $c == none { @return none; }
-  @else { @return 0 1px $c; }
-}
-
 @mixin _shadows($list...) {
 //
 // Helper mixin to stack up to box-shadows;
@@ -43,22 +37,17 @@
 
 // entries
 
-@mixin entry($t, $fc:$focus_border_color, $edge: none) {
+@mixin entry($t, $fc:$focus_border_color) {
 //
 // Entries drawing function
 //
 // $t: entry type
 // $fc: focus color
-// $edge: set to none to not draw the bottom edge or specify a color to not
-//        use the default one
 //
 // possible $t values:
 // normal, focus, insensitive, backdrop, backdrop-insensitive, osd, osd-focus, osd-backdrop, block_cursor;
 //
 
-  $_blank_edge: if($edge == none, none, 0 1px transparentize($edge, 1));
-  $_entry_edge: if($edge == none, none, _widget_edge($edge));
-
   @if $t==normal {
     color: $text_color;
     border-color: $borders_color;
@@ -69,19 +58,16 @@
     color: $insensitive_fg_color;
     border-color: $borders_color;
     background-color: $insensitive_bg_color;
-    box-shadow: $_entry_edge;
   }
   @if $t==backdrop {
     color: $backdrop_text_color;
     border-color: $backdrop_borders_color;
     background-color: $backdrop_base_color;
-    box-shadow: $_blank_edge;
   }
   @if $t==backdrop-insensitive {
     color: $backdrop_insensitive_color;
     border-color: $backdrop_borders_color;
     background-color: $insensitive_bg_color;
-    box-shadow: $_blank_edge;
   }
   @if $t==osd {
     color: $osd_text_color;
@@ -89,7 +75,6 @@
     background-color: transparentize(opacify($osd_borders_color, 1), 0.5);
     background-clip: padding-box;
     box-shadow: none;
-    text-shadow: 0 1px black;
     -gtk-icon-shadow: 0 1px black;
   }
   @if $t==osd-focus {
@@ -97,26 +82,18 @@
     border-color: $selected_bg_color;
     background-color: transparentize(opacify($osd_borders_color, 1), 0.5);
     background-clip: padding-box;
-    text-shadow: 0 1px black;
-    -gtk-icon-shadow: 0 1px black;
   }
   @if $t==osd-insensitive {
     color: $osd_insensitive_fg_color;
     border-color: $osd_borders_color;
     background-color: $osd_insensitive_bg_color;
     background-clip: padding-box;
-    box-shadow: none;
-    text-shadow: none;
-    -gtk-icon-shadow: none;
   }
   @if $t==osd-backdrop {
     color: $osd_text_color;
     border-color: $osd_borders_color;
     background-color: transparentize(opacify($osd_borders_color, 1), 0.5);
     background-clip: padding-box;
-    box-shadow: none;
-    text-shadow: none;
-    -gtk-icon-shadow: none;
   }
   @if $t==block_cursor {
     color: $base_color;
@@ -132,40 +109,19 @@
 }
 
 
-@function _button_hilight_color($c) {
-//
-// calculate the right top highlight color for buttons
-//
-// $c: base color;
-//
-  @if lightness($c)>95% { @return white; }
-  @else if lightness($c)>90% { @return transparentize(white, 0.2); }
-  @else if lightness($c)>80% { @return transparentize(white, 0.5); }
-  @else if lightness($c)>50% { @return transparentize(white, 0.8); }
-  @else if lightness($c)>40% { @return transparentize(white, 0.9); }
-  @else { @return transparentize(white, 0.98); }
-}
-
-
-
-@mixin button($t, $c:$bg_color, $tc:$fg_color, $edge: none) {
+@mixin button($t, $c:$bg_color, $tc:$fg_color) {
 //
 // Button drawing function
 //
 // $t:    button type,
 // $c:    base button color for colored* types
 // $tc:   optional text color for colored* types
-// $edge: set to none to not draw the bottom edge or specify a color to not
-//        use the default one
 //
 // possible $t values:
 // normal, hover, active, insensitive, insensitive-active,
 // backdrop, backdrop-active, backdrop-insensitive, backdrop-insensitive-active,
 // osd, osd-hover, osd-active, osd-insensitive, osd-backdrop, undecorated
 //
-  $_hilight_color: _button_hilight_color($c);
-  $_button_edge: if($edge == none, none, _widget_edge($edge));
-  $_blank_edge: if($edge == none, none, _widget_edge(transparentize($edge,1)));
   $_button_shadow: 0 1px 2px transparentize($shadow_color, 0.03);
 
   @if $t==normal {
@@ -178,7 +134,7 @@
     border-bottom-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color);
     background-image: if($variant == 'light', linear-gradient(to top, darken($c, 4%) 2px, $c),
                                               linear-gradient(to top, darken($c,1%) 2px, $c));
-    @include _shadows(inset 0 1px $_hilight_color, $_button_edge, $_button_shadow);
+    @include _shadows($_button_shadow);
   }
 
   @else if $t==hover {
@@ -190,11 +146,11 @@
     border-bottom-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color);
     @if $variant == 'light' {
       background-image: linear-gradient(to top, darken($c,16%), darken($c,8%) 1px);
-      @include _shadows(inset 0 1px darken($c,1%), $_button_edge, $_button_shadow);
+      @include _shadows($_button_shadow);
     }
     @else {
       background-image: linear-gradient(to top, darken($c,4%) 20%, darken($c, 3%) 90%);
-      @include _shadows(inset 0 1px $c, $_button_edge, $_button_shadow);
+      @include _shadows($_button_shadow);
     }
   }
 
@@ -207,13 +163,11 @@
     border-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color); //colored buttons
     @if $variant == 'light' {
       background-image: linear-gradient(to bottom, lighten($c, 5%) 20%, $c 90%);
-      @include _shadows(inset 0 1px _button_hilight_color(lighten($c, 6%)),
-                        $_button_edge, $_button_shadow);
+      @include _shadows($_button_shadow);
     }
     @else {
       background-image: linear-gradient(to bottom, darken($c, 3%) 20%, darken($c, 6%) 90%);
-      @include _shadows(inset 0 1px $_hilight_color,
-                        $_button_edge, $_button_shadow);
+      @include _shadows($_button_shadow);
     }
   }
 
@@ -224,10 +178,7 @@
     color: $tc;
     border-color: if($c != $bg_color, _border_color($c), $borders_color);
     background-image: if($variant == 'light', image(darken($c, 14%)), image(darken($c, 9%)));
-    @include _shadows(inset 0 1px transparentize($_hilight_color, 1), $_button_edge);
-
-    text-shadow: none;
-    -gtk-icon-shadow: none;
+    box-shadow: none;
   }
 
   @else if $t==insensitive {
@@ -239,11 +190,6 @@
     color: if($tc != $fg_color, mix($tc, $_bg, 50%), $insensitive_fg_color);
     border-color: if($c != $bg_color, _border_color($c), $insensitive_borders_color);
     background-image: image($_bg);
-    text-shadow: none;
-    -gtk-icon-shadow: none;
-    // white with 0 alpha to avoid an ugly transition, since no color means
-    // black with 0 alpha
-    @include _shadows(inset 0 1px transparentize(white, 1), $_button_edge);
   }
 
   @else if $t==insensitive-active {
@@ -256,9 +202,7 @@
     color: if($c != $bg_color, mix($tc, $_bg, 60%), $insensitive_fg_color);
     border-color: $_bc;
     background-image: image($_bg);
-    // white with 0 alpha to avoid an ugly transition, since no color means
-    // black with 0 alpha
-    @include _shadows(inset 0 1px transparentize(white, 1), $_button_edge);
+    box-shadow: none;
   }
 
   @else if $t==backdrop {
@@ -271,9 +215,7 @@
     color: if($tc != $fg_color, mix($tc, $_bg, 80%), $backdrop_fg_color);
     border-color: if($c != $bg_color, $_bc, $backdrop_borders_color);
     background-image: image($_bg);
-    text-shadow: none;
-    -gtk-icon-shadow: none;
-    @include _shadows(inset 0 1px transparentize(white, 1), $_blank_edge);
+    box-shadow: none;
   }
 
   @else if $t==backdrop-active {
@@ -286,7 +228,7 @@
     color: if($tc != $fg_color, mix($tc, $_bg, 80%), $backdrop_fg_color);
     border-color: if($c != $bg_color, $_bc, $backdrop_borders_color);
     background-image: image($_bg);
-    @include _shadows(inset 0 1px transparentize(white, 1), $_blank_edge);
+    box-shadow: none;
   }
 
   @else if $t==backdrop-insensitive {
@@ -300,11 +242,7 @@
     color: if($c != $bg_color, mix($tc, $_bg, 35%), $backdrop_insensitive_color);
     border-color: if($c != $bg_color, $_bc, $backdrop_borders_color);
     background-image: image($_bg);
-    text-shadow: none;
-    -gtk-icon-shadow: none;
-    // white with 0 alpha to avoid an ugly transition, since no color means
-    // black with 0 alpha
-    @include _shadows(inset 0 1px transparentize(white, 1), $_blank_edge);
+    box-shadow: none;
   }
 
   @else if $t==backdrop-insensitive-active {
@@ -318,7 +256,7 @@
     color: if($c != $bg_color, mix($tc, $_bg, 35%), $backdrop_insensitive_color);
     border-color: if($c != $bg_color, $_bc, $backdrop_borders_color);
     background-image: image($_bg);
-    @include _shadows(inset 0 1px transparentize(white, 1), $_blank_edge);
+    box-shadow: none;
   }
 
   @else if $t==osd {
@@ -333,9 +271,6 @@
     background-color: transparent;
     background-image: image($_bg);
     background-clip: padding-box;
-    box-shadow: inset 0 1px transparentize(white, 0.9);
-    text-shadow: none;
-    -gtk-icon-shadow: none;
   }
 
   @else if $t==osd-hover {
@@ -349,9 +284,6 @@
     background-color: transparent;
     background-image: image($_bg);
     background-clip: padding-box;
-    box-shadow: inset 0 1px transparentize(white, 0.9);
-    text-shadow: none;
-    -gtk-icon-shadow: none;
   }
 
   @else if $t==osd-active {
@@ -366,8 +298,6 @@
     background-image: image($_bg);
     background-clip: padding-box;
     box-shadow: none;
-    text-shadow: none;
-    -gtk-icon-shadow: none;
   }
 
   @else if $t==osd-insensitive {
@@ -379,9 +309,6 @@
     background-color: transparent;
     background-image: image($osd_insensitive_bg_color);
     background-clip: padding-box;
-    box-shadow: none;
-    text-shadow: none;
-    -gtk-icon-shadow: none;
   }
 
   @else if $t==osd-backdrop {
@@ -395,9 +322,6 @@
     background-color: transparent;
     background-image: image($_bg);
     background-clip: padding-box;
-    box-shadow: none;
-    text-shadow: none;
-    -gtk-icon-shadow: none;
   }
 
   @else if $t==undecorated {
@@ -407,17 +331,12 @@
     border-color: transparent;
     background-color: transparent;
     background-image: none;
-
-    @include _shadows(inset 0 1px transparentize(white, 1), $_blank_edge);
-
-    text-shadow: none;
-    -gtk-icon-shadow: none;
+    box-shadow: none;
   }
   @else if $t==undecorated-hover {
     border-color: transparent;
     background-image: none;
     box-shadow: none;
-    text-shadow: none;
     @if $variant == 'light' {
       background-color: darken($c,14%);
     } @else {
@@ -428,7 +347,6 @@
     border-color: transparent;
     background-image: none;
     box-shadow: none;
-    text-shadow: none;
     @if $variant == 'light' {
       background-color: darken($c,30%);
     }
@@ -438,12 +356,11 @@
   }
 }
 
-@mixin headerbar_fill($c:$headerbar_bg_color, $hc:$top_hilight, $ov: none) {
+@mixin headerbar_fill($c:$headerbar_bg_color, $ov: none) {
 //
 // headerbar fill
 //
 // $c:  base color
-// $hc: top highlight color
 // $ov: a background layer for background shorthand (hence no commas!)
 //
   $gradient: linear-gradient(to top, darken($c, 2%), lighten($c, 1%));
@@ -453,7 +370,6 @@
   @if $ov != none { background: $c $ov, $gradient; }
   @else { background: $c $gradient; }
 
-  box-shadow: inset 0 1px $hc; // top highlight
 }
 
 @mixin overshoot($p, $t:normal, $c:$fg_color) {


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