From 30c2a29a8b1bac3a45881257288dfeb5422db593 Mon Sep 17 00:00:00 2001 From: Mate Date: Wed, 9 Jun 2021 07:52:21 +0200 Subject: fix YaruOK case mismatch --- desktop-themes/YaruOk/gtk-3.0/_drawing.scss | 661 ++++++++++++++++++++++++++++ 1 file changed, 661 insertions(+) create mode 100644 desktop-themes/YaruOk/gtk-3.0/_drawing.scss (limited to 'desktop-themes/YaruOk/gtk-3.0/_drawing.scss') diff --git a/desktop-themes/YaruOk/gtk-3.0/_drawing.scss b/desktop-themes/YaruOk/gtk-3.0/_drawing.scss new file mode 100644 index 00000000..d03a2642 --- /dev/null +++ b/desktop-themes/YaruOk/gtk-3.0/_drawing.scss @@ -0,0 +1,661 @@ +// Drawing mixins + + + +// generic drawing of more complex things + +@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; +// + $shadows: null; + + @each $shadow in $list { + @if $shadow!=none { $shadows: $shadows, $shadow; } + } + + box-shadow: $shadows; +} + +// entries // Yaru change: we detached focus from selection +@function entry_focus_border($fc:$focus_border_color) { + @if $variant == 'light' { @return $fc; } + @else { @return $focus_border_color } +} + +@function entry_focus_shadow($fc:$focus_border_color) { @return inset 0 0 0 1px $fc; } // Yaru change: we detached focus from selection + +@mixin entry($t, $fc:$focus_border_color, $edge: none) { // Yaru change: we detached focus from selection +// +// 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; +// + + $_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; + background-color: $base_color; + @include _shadows(entry_focus_shadow(transparentize($fc, 1)), $_entry_edge); + // for the transition to work the number of shadows in different states needs to match, hence the transparent shadow here. + } + @if $t==focus { + box-shadow: inset 0px 1px $button_default_box_shadow_color, + inset 1px 0px $button_default_box_shadow_color, + inset -1px 0px $button_default_box_shadow_color, + inset 0px -1px $button_default_box_shadow_color; + border-color: $button_default_border_color; + } + @if $t==insensitive { + 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; + border-color: $osd_borders_color; + 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 { + color: $osd_text_color; + border-color: $selected_bg_color; + background-color: transparentize(opacify($osd_borders_color, 1), 0.5); + background-clip: padding-box; + box-shadow: entry_focus_shadow($fc); + 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; + } +} + +// buttons + +@function _border_color($c, $darker: false) { + @if $darker == true { @return darken($c, 20%); } + @else { @return darken($c, 10%); } +} + +@function _text_shadow_color ($tc: $fg_color, $bg: $bg_color) { +// +// calculate the color of text shadows +// +// $tc is the text color +// $bg is the background color +// + $_lbg: lightness($bg)/100%; + @if lightness($tc)<50% { @return transparentize(white, 1-$_lbg/($_lbg*1.3)); } + @else { @return transparentize(black, $_lbg*0.8); } +} + +@function _button_hilight_color($c) { +// +// calculate the right top hilight 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_text_shadow ($tc:$fg_color, $bg:$bg_color) { +// +// helper function for the text emboss effect +// +// $tc is the optional text color, not the shadow color +// +// TODO: this functions needs a way to deal with special cases +// + + $_shadow: _text_shadow_color($tc, $bg); + + @if lightness($tc)<50% { + text-shadow: 0 1px $_shadow; + -gtk-icon-shadow: 0 1px $_shadow; + } + @else { + text-shadow: 0 -1px $_shadow; + -gtk-icon-shadow: 0 -1px $_shadow; + } +} + +@mixin button($t, $c:$bg_color, $tc:$fg_color, $edge: none) { +// +// 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 +// +// This mixin sets the $button_fill global variable which containts the button background-image +// + $_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 { + // + // normal button + // + color: $tc; + outline-color: $focus_border_color; // Yaru change: we detached focus from selection + border-color: if($c != $bg_color, _border_color($c), $borders_color); + // border-bottom-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color); + // Yaru change: we don't want to use gradients on buttons + + background-image: linear-gradient(to bottom, $button_gradient_a,$button_gradient_b 50%, $button_gradient_c 50%, $button_gradient_d ); + @include _button_text_shadow($tc, $c); + @include _shadows(0 1px transparentize(black, 0.95)); // Yaru change: stronger shadows for flatter buttons + } + + @else if $t==hover { + // + // hovered button + // + color: $tc; + outline-color: $focus_border_color; // Yaru change: we detached focus from selection + border-color: if($c != $bg_color, _border_color($c), $borders_color); + border-bottom-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color); + + + @include _button_text_shadow($tc, lighten($c, 6%)); + @include _shadows(inset 0 1px _button_hilight_color(lighten($c, 6%)), $_button_edge, $_button_shadow); + background-color: $selected_bg_color; + box-shadow: 0 1px transparentize(black, if($variant=='light', 0.85, 0.9)); // Yaru change: stronger shadows for flatter buttons + background-image: linear-gradient(to bottom, + $button_hover_gradient_a 5%, + $button_hover_gradient_b 95%, + $button_hover_gradient_c); + } + + @if $t==normal-alt { + // + // normal button alternative look + // + color: $tc; + outline-color: $focus_border_color; // Yaru change: we detached focus from selection + border-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color); + @include _button_text_shadow($tc, $c); + @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); + } + @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(0 1px transparentize(black, 0.95)); // Yaru change: stronger shadows for flatter buttons + background-image: image(if($variant=='light', lighten($c, 10%), $warm_gray)); // Yaru change: brighter alt + background-clip: padding-box; // Yaru change: fix background overflow + } + + @else if $t==hover-alt { + // + // hovered button alternative look + // + color: $tc; + outline-color: $focus_border_color; // Yaru change: we detached focus from selection + border-color: if($c != $bg_color, _border_color($c, true), $alt_borders_color); + @if $variant == 'light' { + $button_fill: linear-gradient(to bottom, lighten($c, 9%) 10%, lighten($c, 4%) 90%) !global; + @include _shadows(inset 0 1px _button_hilight_color(lighten($c, 6%)), + $_button_edge, $_button_shadow); + } + @else { + $button_fill: linear-gradient(to bottom, $c 20%, darken($c, 4%) 90%) !global; + @include _shadows(inset 0 1px $_hilight_color, + $_button_edge, $_button_shadow); + } + background-image: image(if($variant=='light', lighten($c, 16%), lighten($warm_gray, 4%))); // Yaru change: brighter alt hover + box-shadow: 0 1px transparentize(black, 0.85); // Yaru change: stronger shadows for flatter buttons + } + + @else if $t==active { + // + // pushed button + // + color: $tc; + outline-color: $focus_border_color; // Yaru change: we detached focus from selection + border-color: if($c != $bg_color, _border_color($c), $borders_color); + + background-image: linear-gradient(to bottom,$button_active_gradient_a, + $button_active_gradient_b 3px, + $button_active_gradient_c 4px, + $button_active_gradient_d 50%, + $button_active_gradient_e 50%, + $button_active_gradient_f); + @include _shadows(inset 0 1px transparentize($_hilight_color, 1), $_button_edge); + + text-shadow: none; + -gtk-icon-shadow: none; + } + + @else if $t==insensitive { + // + // insensitive button + // + $_bg: if($c != $bg_color, mix($c, $base_color, 85%), $insensitive_bg_color); + + 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: linear-gradient(to bottom, $button_insensitive_gradient_a,$button_insensitive_gradient_b 50%, $button_insensitive_gradient_c 50%, $button_insensitive_gradient_d ); + 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 { + // + // insensitive pushed button + // + $_bg: if($variant == 'light', darken(mix($c, $base_color, 85%), 8%), darken(mix($c, $base_color, 85%), 6%)); + $_bc: if($c != $bg_color, _border_color($c), $insensitive_borders_color); + + color: if($c != $bg_color, mix($tc, $_bg, 60%), $insensitive_fg_color); + border-color: $_bc; + $button_fill: image($_bg) !global; + background-image: linear-gradient(to bottom, + $button_active_insensitive_gradient_a, + $button_active_insensitive_gradient_b 3px, + $button_active_insensitive_gradient_c 4px, + $button_active_insensitive_gradient_d 50%, + $button_active_insensitive_gradient_e 50%, + $button_active_insensitive_gradient_f); + // 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==backdrop { + // + // backdrop button + // + $_bg: if($c != $bg_color, $c, $backdrop_bg_color); + $_bc: if($variant == 'light', $c, _border_color($c)); + + color: if($tc != $fg_color, mix($tc, $_bg, 80%), $backdrop_fg_color); + border-color: if($c != $bg_color, $_bc, $backdrop_borders_color); + //see at normal + background-image: linear-gradient(to bottom, $button_gradient_a,$button_gradient_b 50%, $button_gradient_c 50%, $button_gradient_d ); + text-shadow: none; + -gtk-icon-shadow: none; + @include _shadows(inset 0 1px transparentize(white, 1), $_blank_edge); + } + + @else if $t==backdrop-active { + // + // backdrop pushed button + // + $_bg: if($variant == 'light', darken(mix($c, $base_color, 85%), 8%), darken(mix($c, $base_color, 85%), 4%)); + $_bc: if($variant == 'light', $_bg ,_border_color($c)); + + color: if($tc != $fg_color, mix($tc, $_bg, 80%), $backdrop_fg_color); + border-color: if($c != $bg_color, $_bc, $backdrop_borders_color); + $button_fill: image($_bg) !global; + background-image: $button_fill; + @include _shadows(inset 0 1px transparentize(white, 1), $_blank_edge); + } + + @else if $t==backdrop-insensitive { + // + // backdrop insensitive button + // + + $_bg: if($c != $bg_color, mix($c, $base_color, 85%), if($variant=='light', $insensitive_bg_color, lighten($insensitive_bg_color, 3%))); // Yaru change + $_bc: if($variant == 'light', $_bg,_border_color($c)); + + color: if($c != $bg_color, mix($tc, $_bg, 35%), $backdrop_insensitive_color); + border-color: if($c != $bg_color, $_bc, $backdrop_borders_color); + background-image: linear-gradient(to bottom, $button_insensitive_gradient_a,$button_insensitive_gradient_b 50%, $button_insensitive_gradient_c 50%, $button_insensitive_gradient_d ); + 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); + } + + @else if $t==backdrop-insensitive-active { + // + // backdrop insensitive pushed button + // + + $_bg: if($variant == 'light', darken(mix($c, $base_color, 85%), 8%), darken(mix($c, $base_color, 85%), 4%)); + $_bc: if($variant == 'light', $_bg, _border_color($c)); + + color: if($c != $bg_color, mix($tc, $_bg, 35%), $backdrop_insensitive_color); + border-color: if($c != $bg_color, $_bc, $backdrop_borders_color); + $button_fill: image($_bg) !global; + background-image: $button_fill; + @include _shadows(inset 0 1px transparentize(white, 1), $_blank_edge); + } + + @else if $t==osd { + // + // normal osd button + // + $_bg: if($c != $bg_color, transparentize($c, 0.5), lighten($osd_bg_color, 9%)); // Yaru change: make osd buttons visible + + color: $osd_fg_color; + border-color: $osd_borders_color; + background-color: transparent; + $button_fill: image($_bg) !global; + background-image: $button_fill; + background-clip: padding-box; + // box-shadow: inset 0 1px transparentize(white, 0.9); // Yaru change: remove the shadow + text-shadow: 0 1px black; + -gtk-icon-shadow: 0 1px black; + outline-color: transparentize($osd_fg_color, 0.7); + } + + @else if $t==osd-hover { + // + // active osd button + // + $_bg: if($c != $bg_color, transparentize($c, 0.3), lighten($osd_bg_color, 12%)); + + color: white; + border-color: $osd_borders_color; + background-color: transparent; + $button_fill: image($_bg) !global; + background-image: $button_fill; + background-clip: padding-box; + // box-shadow: inset 0 1px transparentize(white, 0.9); // Yaru change: remove the shadow + text-shadow: 0 1px black; + -gtk-icon-shadow: 0 1px black; + outline-color: transparentize($osd_fg_color, 0.7); + } + + @else if $t==osd-active { + // + // active osd button + // + $_bg: if($c != $bg_color, $c, $osd_borders_color); + + color: white; + border-color: $osd_borders_color; + background-color: transparent; + $button_fill: image($_bg) !global; + background-image: $button_fill; + background-clip: padding-box; + box-shadow: none; + text-shadow: none; + -gtk-icon-shadow: none; + outline-color: transparentize($osd_fg_color, 0.7); + } + + @else if $t==osd-insensitive { + // + // insensitive osd button + // + color: $osd_insensitive_fg_color; + border-color: $osd_borders_color; + background-color: transparent; + $button_fill: image($osd_insensitive_bg_color) !global; + background-image: $button_fill; + background-clip: padding-box; + box-shadow: none; + text-shadow: none; + -gtk-icon-shadow: none; + } + + @else if $t==osd-backdrop { + // + // backdrop osd button + // + $_bg: if($c != $bg_color, transparentize($c, 0.5), $osd_bg_color); + + color: $osd_fg_color; + border-color: $osd_borders_color; + background-color: transparent; + $button_fill: image($_bg) !global; + background-image: $button_fill; + background-clip: padding-box; + box-shadow: none; + text-shadow: none; + -gtk-icon-shadow: none; + } + + @else if $t==undecorated { + // + // reset + // + border-color: transparent; + background-color: transparent; + $button_fill: none !global; + background-image: $button_fill; + + @include _shadows(inset 0 1px transparentize(white, 1), $_blank_edge); + + text-shadow: none; + -gtk-icon-shadow: none; + } +} + +@mixin headerbar_fill($c:$headerbar_color, $hc:$top_hilight, $ov: none) { +// +// headerbar fill +// +// $c: base color +// $hc: top highlight color +// $ov: a background layer for background shorthand (hence no commas!) +// + background-image: linear-gradient(to bottom, +gtkshade($selected_bg_color, 1.08) , +gtkshade($selected_bg_color, 1.02) 50%, +gtkshade($selected_bg_color, 1.0) 50%, +gtkshade($selected_bg_color, 0.94)); + + + + &:backdrop{ + background-image: linear-gradient(to bottom, + gtkshade($bg_color, 0.99) , +gtkshade($bg_color, 0.95) 50%, +gtkshade($bg_color, 0.93)50%, +gtkshade($bg_color, 0.89)); + + } +} + +@mixin overshoot($p, $t:normal, $c:$fg_color) { +// +// overshoot +// +// $p: position +// $t: type +// $c: base color +// +// possible $p values: +// top, bottom, right, left +// +// possible $t values: +// normal, backdrop +// + + $_small_gradient_length: 5%; + $_big_gradient_length: 100%; + + $_position: center top; + $_small_gradient_size: 100% $_small_gradient_length; + $_big_gradient_size: 100% $_big_gradient_length; + + @if $p==bottom { + $_position: center bottom; + $_linear_gradient_direction: to top; + } + + @else if $p==right { + $_position: right center; + $_small_gradient_size: $_small_gradient_length 100%; + $_big_gradient_size: $_big_gradient_length 100%; + } + + @else if $p==left { + $_position: left center; + $_small_gradient_size: $_small_gradient_length 100%; + $_big_gradient_size: $_big_gradient_length 100%; + } + + $_small_gradient_color: $c; + $_big_gradient_color: $c; + + @if $c==$fg_color { + $_small_gradient_color: darken($borders_color, 10%); + $_big_gradient_color: $fg_color; + + @if $t==backdrop { $_small_gradient_color: $backdrop_borders_color; } + } + + $_small_gradient: -gtk-gradient(radial, + $_position, 0, + $_position, 0.5, + to($_small_gradient_color), + to(transparentize($_small_gradient_color, 1))); + + $_big_gradient: -gtk-gradient(radial, + $_position, 0, + $_position, 0.6, + from(transparentize($_big_gradient_color, 0.93)), + to(transparentize($_big_gradient_color, 1))); + + @if $t==normal { + background-image: $_small_gradient, $_big_gradient; + background-size: $_small_gradient_size, $_big_gradient_size; + } + + @else if $t==backdrop { + background-image: $_small_gradient; + background-size: $_small_gradient_size; + } + + background-repeat: no-repeat; + background-position: $_position; + + background-color: transparent; // reset some properties to be sure to not inherit them somehow + border: none; // + box-shadow: none; // +} + +/*************************** + * Check and Radio buttons * + ***************************/ + + @mixin check($t, $c:$bg_color, $tc:$fg_color, $checked: false) { + // Check/Radio drawing function + // + // $t: check/radio type, + // $c: base button color for colored* types + // $tc: optional text color for colored* types + // $checked: bool to chose between checked/unchecked + // + // possible $t values: + // normal, hover, active, insensitive, backdrop, backdrop-insensitive + + $_border_color: if($c==$checkradio_bg_color, $c, $alt_borders_color); + $_dim_border_color: transparentize($_border_color, if($variant == 'light', 0.3, 0.7)); + + @if $t==normal { // Yaru change: no gradients, better borders + background-clip: if($checked, border-box, padding-box); + background-image: image(white); + border-color: $_border_color; + box-shadow: 0 1px transparentize(black, 0.95); + color: $fg_color; + } + + @if $t==hover { + background-image: image($core_color_a); + border-color: darken($core_color_a , 20%); + } + + @if $t==active { + border-color: $borders_color; + background-image: image(white); + box-shadow: none; + color: $fg_color; + } + + @if $t==insensitive { + box-shadow: none; + color: $insensitive_fg_color; + border-color: $insensitive_borders_color; + background-image: image($insensitive_bg_color); + } + + @if $t==backdrop { + background-image: image(white); + border-color: $_border_color; + box-shadow: 0 1px transparentize(black, 0.95); + color: $fg_color; + } + + @if $t==backdrop-insensitive { + box-shadow: none; + color: $backdrop_fg_color; + border-color: $insensitive_borders_color; + background-image: image($insensitive_bg_color); + } +} -- cgit v1.2.1