From 038b06d868cc9e920a008ed4b2cba2676e55408d Mon Sep 17 00:00:00 2001 From: Sam Hewitt Date: Mon, 18 Nov 2024 17:17:00 -0330 Subject: [PATCH] style: Adjust the focus logic to accommodate accent color - adjust definitions for focus/accent related colors - rework the focus mixins to better match how libadwaita handles accent color and focus Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7989 Part-of: --- data/theme/gnome-shell-sass/_colors.scss | 2 +- data/theme/gnome-shell-sass/_default-colors.scss | 13 +++++++------ data/theme/gnome-shell-sass/_drawing.scss | 15 +++++++++------ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/data/theme/gnome-shell-sass/_colors.scss b/data/theme/gnome-shell-sass/_colors.scss index 87eed2998..b3a52b6f6 100644 --- a/data/theme/gnome-shell-sass/_colors.scss +++ b/data/theme/gnome-shell-sass/_colors.scss @@ -66,4 +66,4 @@ $active_bg_color: if($variant=='light', darken($bg_color, 11%), lighten($bg_colo $active_fg_color: if($variant=='light', darken($fg_color, 11%), lighten($fg_color, 12%)); // accent colors -$accent_borders_color: if($variant== 'light', st-darken(-st-accent-color, 15%), st-lighten(-st-accent-color, 15%)); +$accent_borders_color: if($variant== 'light', st-darken(-st-accent-color, 20%), st-lighten(-st-accent-color, 30%)); diff --git a/data/theme/gnome-shell-sass/_default-colors.scss b/data/theme/gnome-shell-sass/_default-colors.scss index f8c0ecdb2..df7bfb6ec 100644 --- a/data/theme/gnome-shell-sass/_default-colors.scss +++ b/data/theme/gnome-shell-sass/_default-colors.scss @@ -4,6 +4,9 @@ $_base_color_dark: #222226; $_base_color_light: #fafafb; +// accent colors +$accent_color: if($variant== 'light', -st-accent-color, st-mix(-st-accent-color, $light_1, 60%)); + // colors for destructive elements $destructive_bg_color: if($variant == 'light', $red_3, $red_4); $destructive_fg_color: $light_1; @@ -28,23 +31,21 @@ $link_visited_color: st-transparentize($link_color, .6); // special cased widget definitions $background_mix_factor: if($variant == 'light', 12%, 9%); // used to boost the color of backgrounds in different variants -$border_opacity: if($variant == 'light', .85, .9); // change the border opacity in different variants // shadows $shadow_color: if($variant == 'light', rgba(0,0,0,.05), rgba(0,0,0,0.2)); $text_shadow_color: if($variant == 'light', rgba(255,255,255,0.3), rgba(0,0,0,0.2)); -// focus colors -$focus_color: -st-accent-color; -$focus_border_color: st-transparentize($focus_color, 0.5); +// border opacities +$border_opacity: if($variant == 'light', .85, .9); // change the border opacity in different variants +$focus_border_opacity: .2; // High Contrast overrides @if $contrast == 'high' { // increase border opacity $border_opacity: .5; + $focus_border_opacity: .1; // remove shadows $shadow_color: transparent; $text_shadow_color: transparent; - // less transparent focus color - $focus_border_color: st-transparentize($focus_color, 0.2); } diff --git a/data/theme/gnome-shell-sass/_drawing.scss b/data/theme/gnome-shell-sass/_drawing.scss index b4aa80308..8e9c8c947 100644 --- a/data/theme/gnome-shell-sass/_drawing.scss +++ b/data/theme/gnome-shell-sass/_drawing.scss @@ -20,7 +20,7 @@ } // Function to mix the color and make the focus background -@function focus_bg_color($bg, $fc:$focus_color) { +@function focus_bg_color($bg, $fc:$accent_color) { @return st-mix($fc, $bg, 5%); } @@ -54,10 +54,13 @@ } // Draw the focus ring -@mixin focus_ring($width: 2px, $fc: $focus_border_color, $border: false) { - box-shadow: inset 0 0 0 $width $fc !important; +@mixin focus_ring($width: 2px, $fc: $accent_color, $border: false) { + + $focus_color: st-transparentize($fc, $focus_border_opacity); + + box-shadow: inset 0 0 0 $width $focus_color !important; @if $border { - border:$width solid $fc !important; + border:$width solid $focus_color !important; box-shadow: none; } } @@ -90,7 +93,7 @@ // entry colors $entry_fg_color: $c; $entry_bg_color: mix($c, $bc, $background_mix_factor); - $entry_focus_color: $focus_color; + $entry_focus_color: $accent_color; // entry color overrides for lockscreen style @if $style == 'lockscreen' { @@ -128,7 +131,7 @@ // focus styles @if $type == 'focus' { - @include focus_ring(); + @include focus_ring($fc:$entry_focus_color); background-color: focus_bg_color($entry_bg_color); color: $entry_fg_color;