diff options
Diffstat (limited to 'desktop-themes/TraditionalOk/gtk-4.0/_drawing.scss')
-rw-r--r-- | desktop-themes/TraditionalOk/gtk-4.0/_drawing.scss | 520 |
1 files changed, 520 insertions, 0 deletions
diff --git a/desktop-themes/TraditionalOk/gtk-4.0/_drawing.scss b/desktop-themes/TraditionalOk/gtk-4.0/_drawing.scss new file mode 100644 index 00000000..cf474960 --- /dev/null +++ b/desktop-themes/TraditionalOk/gtk-4.0/_drawing.scss @@ -0,0 +1,520 @@ +// Drawing mixins + +// generic drawing of more complex things + +// +// Helper mixin for drawing visible focus rings +// +// If $target is specified, the focus ring is applied to the specified child element. +// If $outer is true, the focus ring extends outward. Otherwise, it extends inward. +// If $within is true, use focus-within instead of focus:focus-visible +// +@mixin focus-ring($target: null, $width: 2px, $offset: -$width, $outer: false, $focus-state: 'focus:focus-visible', $fc: $focus_border_color) { + & #{$target} { + outline: 0 solid transparent; + outline-offset: if($outer, $offset + 4px, $offset + $width + 4px); + } + + &:#{$focus-state} #{$target} { + outline-color: $fc; + outline-width: $width; + outline-offset: $offset; + } +} + +@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 + +@mixin entry($t, $fc:$focus_border_color) { +// +// Entries drawing function +// +// $t: entry type +// $fc: focus color +// +// possible $t values: +// normal, focus, insensitive, backdrop, backdrop-insensitive, osd, osd-focus, osd-backdrop, block_cursor; +// + + @if $t==normal { + color: $text_color; + border-color: $borders_color; + background-color: $base_color; + // for the transition to work the number of shadows in different states needs to match, hence the transparent shadow here. + } + @if $t==insensitive { + color: $insensitive_fg_color; + border-color: $borders_color; + background-color: $insensitive_bg_color; + } + @if $t==backdrop { + color: $backdrop_text_color; + border-color: $backdrop_borders_color; + background-color: $backdrop_base_color; + } + @if $t==backdrop-insensitive { + color: $backdrop_insensitive_color; + border-color: $backdrop_borders_color; + background-color: $insensitive_bg_color; + } + @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; + -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; + } + @if $t==osd-insensitive { + color: $osd_insensitive_fg_color; + border-color: $osd_borders_color; + background-color: $osd_insensitive_bg_color; + background-clip: padding-box; + } + @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; + } + @if $t==block_cursor { + color: $base_color; + background-color: $text_color; + } +} + +// buttons + +@function _border_color($c, $darker: false) { + @if $darker == true { @return darken($c, 20%); } + @else { @return darken($c, 10%); } // Yaru change: less darken 15% -> 10% +} + +$_default_button_c: lighten($bg_color,2%); +@mixin button($t, $c:$_default_button_c, $tc:$fg_color) { +// +// Button drawing function +// +// $t: button type, +// $c: base button color for colored* types +// $tc: optional text color for colored* types +// +// possible $t values: +// normal, hover, active, checked-hover, checked-active, insensitive, insensitive-active, +// backdrop, backdrop-active, backdrop-insensitive, backdrop-insensitive-active, +// osd, osd-hover, osd-active, osd-insensitive, osd-backdrop, undecorated +// + $_button_shadow: 0 1px transparentize(black, 0.95); // Yaru changes: use solid shadow + + @if $t==normal { + // + // normal button + // + color: $tc; + outline-color: if($c != $_default_button_c, $alt_focus_border_color, $focus_border_color); + border-color: if($c!=$_default_button_c, _border_color($c, false), $borders_color); //tint if not default button color - Yaru change: less darken border-color + background-image: linear-gradient(to bottom, $button_gradient_a,$button_gradient_b 50%, $button_gradient_c 50%, $button_gradient_d ); + @include _shadows($_button_shadow); + } + + @else if $t==hover { + // + // hovered button + // + color: $tc; + border-color: if($c != $_default_button_c, _border_color($c), $borders_color); + background-image: linear-gradient(to bottom, + $button_hover_gradient_a 5%, + $button_hover_gradient_b 95%, + $button_hover_gradient_c); + @include _shadows(0 1px transparentize(black, if($variant=='light', 0.85, 0.9))); + } + + @else if $t==active { + // + // pushed button + // + color: $tc; + border-color: if($c != $_default_button_c, _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); + box-shadow: none; + } + + @else if $t==checked-hover { + // + // pushed togglebutton hover + // + color: $tc; + border-color: if($c != $_default_button_c, _border_color($c), $borders_color); + background-image: if($variant == 'light', image(darken($c, 18%)), image(darken($c, 12%))); + box-shadow: none; + } + + @else if $t==checked-active { + // + // pushed togglebutton pushed further :) + // + color: $tc; + border-color: if($c != $_default_button_c, _border_color($c), $borders_color); + background-image: if($variant == 'light', image(darken($c, 22%)), image(darken($c, 14%))); + box-shadow: none; + } + + @else if $t==insensitive { + // + // insensitive button + // + $_bg: if($c != $_default_button_c, mix($c, $base_color, 85%), $insensitive_bg_color); + + color: if($tc != $fg_color, mix($tc, $_bg, 50%), $insensitive_fg_color); + border-color: if($c != $_default_button_c, _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 ); + } + + @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 != $_default_button_c, _border_color($c), $insensitive_borders_color); + + color: if($c != $_default_button_c, mix($tc, $_bg, 60%), $insensitive_fg_color); + border-color: $_bc; + background-image: image($_bg); + box-shadow: none; + } + + @else if $t==backdrop { + // + // backdrop button + // + $_bg: if($c != $_default_button_c, $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 != $_default_button_c, $_bc, $backdrop_borders_color); + background-image: image($_bg); + box-shadow: none; + } + + @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 != $_default_button_c, $_bc, $backdrop_borders_color); + background-image: image($_bg); + box-shadow: none; + } + + @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 != $_default_button_c, mix($tc, $_bg, 35%), $backdrop_insensitive_color); + border-color: if($c != $_default_button_c, $_bc, $backdrop_borders_color); + background-image: image($_bg); + box-shadow: none; + } + + @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 != $_default_button_c, mix($tc, $_bg, 35%), $backdrop_insensitive_color); + border-color: if($c != $_default_button_c, $_bc, $backdrop_borders_color); + background-image: image($_bg); + box-shadow: none; + } + + @else if $t==osd { + // + // normal osd button + // + $_bg: if($c != $_default_button_c, transparentize($c, 0.5), $osd_bg_color); + + color: $osd_fg_color; + outline-color: if($c != $_default_button_c, $alt_focus_border_color, $focus_border_color); + border-color: $osd_borders_color; + background-color: transparent; + background-image: image($_bg); + background-clip: padding-box; + } + + @else if $t==osd-hover { + // + // active osd button + // + $_bg: if($c != $_default_button_c, transparentize($c, 0.3), darken($osd_bg_color, 10%)); + + color: white; + border-color: $osd_borders_color; + background-color: transparent; + background-image: image($_bg); + background-clip: padding-box; + } + + @else if $t==osd-active { + // + // active osd button + // + $_bg: if($c != $_default_button_c, $c, darken($osd_bg_color, 20%)); + + color: white; + border-color: $osd_borders_color; + background-color: transparent; + background-image: image($_bg); + background-clip: padding-box; + box-shadow: none; + } + + @else if $t==osd-insensitive { + // + // insensitive osd button + // + color: $osd_insensitive_fg_color; + border-color: $osd_borders_color; + background-color: transparent; + background-image: image($osd_insensitive_bg_color); + background-clip: padding-box; + } + + @else if $t==osd-backdrop { + // + // backdrop osd button + // + $_bg: if($c != $_default_button_c, transparentize($c, 0.5), $osd_bg_color); + + color: $osd_fg_color; + border-color: $osd_borders_color; + background-color: transparent; + background-image: image($_bg); + background-clip: padding-box; + } + + @else if $t==undecorated { + // + // reset + // + border-color: transparent; + background-color: transparent; + background-image: none; + box-shadow: none; + } + @else if $t==undecorated-hover { + border-color: transparent; + background-image: none; + box-shadow: none; + @if $variant == 'light' { + background-color: darken($c,14%); + } @else { + background-color: darken($c,1%); + } + } + @else if $t==undecorated-active { + border-color: transparent; + background-image: none; + box-shadow: none; + @if $variant == 'light' { + background-color: darken($c,20%); + } + @else { + background-color: darken($c,5%); + } + } +} + +@mixin headerbar_fill($c:$headerbar_bg_color, $ov: none) { +// +// headerbar fill +// +// $c: base color +// $ov: a background layer for background shorthand (hence no commas!) +// + background-image: linear-gradient(to bottom, + #99bae3, + #8cb0dc 50%, + #86abd9 50%, + #7aa1d1); + &:backdrop{ + background-image: linear-gradient(to bottom, + #eae9e8, + #e2e1e0 50%, + #dedcda 50%, + #d4d2d0); + } +} + +@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: 3%; + $_big_gradient_length: 50%; + + $_small_gradient_size: 100% $_small_gradient_length; + $_big_gradient_size: 100% $_big_gradient_length; + + @if $p==right or $p==left { + $_small_gradient_size: $_small_gradient_length 100%; + $_big_gradient_size: $_big_gradient_length 100%; + } + + $_small_gradient_color: $c; + $_big_gradient_color: transparentize($c, 0.93); + + @if $c==$fg_color { + $_small_gradient_color: darken($borders_color, 10%); + $_big_gradient_color: transparentize($fg_color, 0.93); + + @if $t==backdrop { $_small_gradient_color: $backdrop_borders_color; } + } + + $_small_gradient: radial-gradient(farthest-side at $p, + $_small_gradient_color 85%, + transparentize($_small_gradient_color, 1)); + + $_big_gradient: radial-gradient(farthest-side at $p, + $_big_gradient_color, + 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: $p; + + 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:$checkradio_bg_color, $tc:$checkradio_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, menu + + $_border_color: if($c==$checkradio_bg_color, $c, $alt_borders_color); // Yaru change: use background color as border 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; + } + + @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); + } + + // Yaru changes: remove border and scaling into menus + @if $t==menu { + //transform: scale(0.8); + //border-width: 1.2px; + border-color: transparent; + box-shadow: none; + background-image: image(transparent); + color: $tc; + } + + @if $t==menu-active { + //transform: scale(0.8); + //border-width: 1.2px; + border-color: transparent; + color: $tc; + box-shadow: none; + background-image: image(transparent); + } +} |