// // Drawing mixins // // Generic drawing of more complex things // // // Scaling function // $ref_size: 13.3px; // = 10pt = 1em @function rem($px, $fs: $ref_size) { @return ($px / $fs ) * 1rem; } // // Default shadows // $z-depth-1: 0 1px 1px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.16); $z-depth-2: 0 2px 2px rgba(0, 0, 0, 0.12), 0 3px 4px rgba(0, 0, 0, 0.20); $z-depth-3: 0 5px 5px rgba(0, 0, 0, 0.16), 0 4px 4px rgba(0, 0, 0, 0.20); $z-depth-4: 0 6px 8px -4px rgba(0, 0, 0, 0.16), 0 10px 6px rgba(0, 0, 0, 0.20); $z-depth-5: 0 8px 10px -4px rgba(0, 0, 0, 0.20), 0 12px 8px rgba(0, 0, 0, 0.24); // z-depth-1 actual shadows + dummy z-depth-2 area $z-depth-1-backdrop: 0 2px 2px transparent, 0 3px 4px transparent, 0 3px 3px -1px rgba(0, 0, 0, 0.08); // z-depth-2 actual shadows + dummy z-depth-4 area $z-depth-2-backdrop: 0 10px 6px transparent, 0 6px 8px -4px transparent, 0 2px 2px rgba(0, 0, 0, 0.12), 0 3px 4px rgba(0, 0, 0, 0.20); // // Header-bar shadows // $header-shadow-light: 0 1px 1px rgba(0, 0, 0, 0.16), 0 1px 2px rgba(0, 0, 0, 0.26), 0 2px 3px rgba(0, 0, 0, 0.32); $header-shadow-dark: 0 1px 1px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.14), 0 2px 3px rgba(0, 0, 0, 0.20); $sub-header-shadow-light-ltr: 0 1px 1px rgba(0, 0, 0, 0.16), 0 1px 2px rgba(0, 0, 0, 0.26), 0 2px 3px rgba(0, 0, 0, 0.32), -5px 0 0 -1px $inverted_dark_color, -2px 0 0 -1px $borders_color; $sub-header-shadow-dark-ltr: 0 1px 1px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.14), 0 2px 3px rgba(0, 0, 0, 0.20), -5px 0 0 -1px $inverted_dark_color, -2px 0 0 -1px $borders_color; $sub-header-shadow-light-rtl: 0 1px 1px rgba(0, 0, 0, 0.16), 0 1px 2px rgba(0, 0, 0, 0.26), 0 2px 3px rgba(0, 0, 0, 0.32), 5px 0 0 -1px $inverted_dark_color, 2px 0 0 -1px $borders_color; $sub-header-shadow-dark-rtl: 0 1px 1px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.14), 0 2px 3px rgba(0, 0, 0, 0.20), 5px 0 0 -1px $inverted_dark_color, 2px 0 0 -1px $borders_color; $selected-header-shadow-light-ltr: 0 1px 1px rgba(0, 0, 0, 0.16), 0 1px 2px rgba(0, 0, 0, 0.26), 0 2px 3px rgba(0, 0, 0, 0.32), -5px 0 0 -1px $selected_bg_color, -2px 0 0 -1px $solid_dark_borders_color; $selected-header-shadow-dark-ltr: 0 1px 1px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.14), 0 2px 3px rgba(0, 0, 0, 0.20), -5px 0 0 -1px $selected_bg_color, -2px 0 0 -1px $solid_dark_borders_color; $selected_header-shadow-light-rtl: 0 1px 1px rgba(0, 0, 0, 0.16), 0 1px 2px rgba(0, 0, 0, 0.26), 0 2px 3px rgba(0, 0, 0, 0.32), 5px 0 0 -1px $selected_bg_color, 2px 0 0 -1px $solid_dark_borders_color; $selected-header-shadow-dark-rtl: 0 1px 1px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.14), 0 2px 3px rgba(0, 0, 0, 0.20), 5px 0 0 -1px $selected_bg_color, 2px 0 0 -1px $solid_dark_borders_color; // // Side-bar shadows // $sidebar-light-ltr: inset -2px 2px 2px -2px rgba(0, 0, 0, 0.05), inset -3px 3px 3px -2px rgba(0, 0, 0, 0.05); $sidebar-light-rtl: inset 2px 2px 2px -2px rgba(0, 0, 0, 0.05), inset 3px 3px 3px -2px rgba(0, 0, 0, 0.05); $sidebar-dark-ltr: inset -2px 2px 1px -2px rgba(0, 0, 0, 0.02), inset -3px 3px 3px -2px rgba(0, 0, 0, 0.06); $sidebar-dark-rtl: inset 2px 2px 1px -2px rgba(0, 0, 0, 0.02), inset 3px 3px 3px -2px rgba(0, 0, 0, 0.06); // // Inline-toolbar shadows // $inline-shadow-light: inset 0 1px 2px -1px rgba(0, 0, 0, 0.02), inset 0 2px 3px -2px rgba(0, 0, 0, 0.07); $inline-shadow-dark: inset 0 1px 2px -1px rgba(0, 0, 0, 0.03), inset 0 3px 4px -3px rgba(0, 0, 0, 0.06); // // Info-bar shadows // // $infobar-shadow-light: inset 0 1px 2px rgba(0, 0, 0, 0.08); // $infobar-shadow-dark: inset 0 1px 2px rgba(0, 0, 0, 0.04); // // Reorderable-tab shadows // $tab-shadow-light: -1px 0 2px rgba(0, 0, 0, 0.02), -1px 0 4px rgba(0, 0, 0, 0.02), 1px 0 2px rgba(0, 0, 0, 0.02), 1px 0 4px rgba(0, 0, 0, 0.02); $tab-shadow-dark: -1px 0 2px rgba(0, 0, 0, 0.02), -1px 0 4px rgba(0, 0, 0, 0.03), 1px 0 2px rgba(0, 0, 0, 0.02), 1px 0 4px rgba(0, 0, 0, 0.03); // // Menubar shadows // $menubar-shadow: inset 0 2px 2px -3px rgba(0, 0, 0, 0.26), inset 0 5px 3px -5px rgba(0, 0, 0, 0.39), inset 0 -1px $borders_color; // // Toolbar shadows // $toolbar-shadow-light: inset 0 1px 1px rgba(0, 0, 0, 0.18), inset 0 4px 2px -4px rgba(0, 0, 0, 0.20), inset 0 8px 3px -5px rgba(0, 0, 0, 0.24); $toolbar-shadow-dark: inset 0 1px 1px rgba(0, 0, 0, 0.22), inset 0 4px 3px -4px rgba(0, 0, 0, 0.22), inset 0 8px 3px -5px rgba(0, 0, 0, 0.24); /****************** * Ripple effects * ******************/ // // Ripple effects // @keyframes ripple_effect { // // Ripple effect drawing function // from { background-image: -gtk-gradient(radial, center center, 0, center center, 0.001, to(gtkalpha(currentColor, 0.1)), to(transparent)), linear-gradient(to bottom, gtkalpha(currentColor, 0)); } to { background-image: -gtk-gradient(radial, center center, 0, center center, 0.4, to(gtkalpha(currentColor, 0.1)), to(transparent)), linear-gradient(to bottom, gtkalpha(currentColor, 0.1)); } } @keyframes flat_ripple_effect { from { background-image: -gtk-gradient(radial, center center, 0, center center, 0.001, to(gtkalpha(currentColor, 0.1)), to(transparent)), linear-gradient(to bottom, gtkalpha(currentColor, 0.1)); } to { background-image: -gtk-gradient(radial, center center, 0, center center, 0.4, to(gtkalpha(currentColor, 0.1)), to(transparent)), linear-gradient(to bottom, gtkalpha(currentColor, 0.1)); } } @keyframes list_ripple_effect { from { background-image: -gtk-gradient(radial, center center, 0, center center, 0.001, to(gtkalpha(currentColor, 0)), to(transparent)), linear-gradient(to bottom, gtkalpha(currentColor, 0.05)); } to { background-image: -gtk-gradient(radial, center center, 0, center center, 0.4, to(gtkalpha(currentColor, 0.1)), to(transparent)), linear-gradient(to bottom, gtkalpha(currentColor, 0.1)); } } // // Entries // @mixin entry($t, $fc:$selected_bg_color) { // // Entries drawing function // // $t: entry type // $fc: focus color // // possible $t values: // normal, focus, insensitive, flat-normal, flat-focus, flat-insensitive; // @if $t==normal { border-radius: 0; -gtk-outline-radius: 0; border-color: $solid_light_borders_color; border-image: -gtk-gradient(radial, center bottom, 0, center bottom, 0.5, to($track_color), to(transparent)) 0 0 1 / 0 0 1px; background-color: transparent; color: $secondary_fg_color; } @if $t==focus { border-color: $solid_light_borders_color; border-image: -gtk-gradient(radial, center bottom, 0, center bottom, 0.5, to($fc), to(transparent)) 0 0 2 / 0 0 2px; color: $fg_color; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0 cubic-bezier(0.4, 0, 0.2, 1) 0.2s, color 0; } @if $t==insensitive { border-color: $solid_light_borders_color; border-image: -gtk-gradient(radial, center bottom, 0, center bottom, 0.5, to($track_color), to(transparent)) 0 0 1 / 0 0 1px; background-color: transparent; color: $insensitive_fg_color; } @if $t==flat-normal { border-radius: 0; -gtk-outline-radius: 0; border-color: $solid_light_borders_color; border-image: -gtk-gradient(radial, center bottom, 0, center bottom, 0.5, to($track_color), to(transparent)) 0 0 1 / 0 0 1px; background-color: transparent; color: $secondary_fg_color; } @if $t==flat-focus { border-color: $solid_light_borders_color; border-image: -gtk-gradient(radial, center bottom, 0, center bottom, 0.5, to($fc), to(transparent)) 0 0 2 / 0 0 2px; color: $fg_color; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0 cubic-bezier(0.4, 0, 0.2, 1) 0.2s, color 0; } @if $t==flat-insensitive { border-color: $solid_light_borders_color; border-image: -gtk-gradient(radial, center bottom, 0, center bottom, 0.5, to($track_color), to(transparent)) 0 0 1 / 0 0 1px; color: $insensitive_fg_color; } } // // Buttons // @mixin button($t, $c:$light_color, $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, insensitive, checked, checked-insensitive, // flat-normal, flat-hover, flat-active, flat-insensitive, flat-checked, // flat-checked-insensitive, undecorated // @if $t==normal { // // normal button // box-shadow: $z-depth-1, inset 0 1px $highlight_color; background-color: $c; background-image: -gtk-gradient(radial, center center, 0, center center, 0.5, to(gtkalpha(currentColor, 0)), to(transparent)), linear-gradient(to bottom, gtkalpha(currentColor, 0)); color: $secondary_fg_color; } @else if $t==hover { // // hovered button // box-shadow: $z-depth-2, inset 0 1px $highlight_color; background-image: -gtk-gradient(radial, center center, 0, center center, 0.5, to(gtkalpha(currentColor, 0)), to(transparent)), linear-gradient(to bottom, gtkalpha(currentColor, 0)); color: $fg_color; } @else if $t==active { // // pushed button // box-shadow: $z-depth-2, inset 0 1px $highlight_color; color: $fg_color; transition-duration: 0; animation: ripple_effect 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards; } @else if $t==insensitive { // // insensitive button // box-shadow: none; background-color: $track_color; color: if($tc!=$fg_color, $insensitive_fg_color, $insensitive_secondary_fg_color); > label { color: inherit; } } @else if $t==checked { // // checked button // box-shadow: $z-depth-1, inset 0 1px $highlight_color; background-color: $selected_bg_color; color: $selected_fg_color; } @else if $t==checked-insensitive { // // checked insensitive button // box-shadow: none; background-color: $track_color; color: gtkopacity($selected_bg_color, 0.4); > label { color: inherit; } } @else if $t==flat-normal { // // normal flat button // box-shadow: none; background-color: transparent; background-image: -gtk-gradient(radial, center center, 0, center center, 0.5, to(gtkalpha(currentColor, 0)), to(transparent)), linear-gradient(to bottom, gtkalpha(currentColor, 0)); } @else if $t==flat-hover { // // hovered flat button // box-shadow: none; background-image: -gtk-gradient(radial, center center, 0, center center, 0.5, to(gtkalpha(currentColor, 0)), to(transparent)), linear-gradient(to bottom, gtkalpha(currentColor, 0.1)); } @else if $t==flat-active { // // pushed flat button // box-shadow: none; animation: flat_ripple_effect 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards; } @else if $t==flat-insensitive { // // insensitive flat button // box-shadow: none; background-color: transparent; } @else if $t==flat-checked { // // checked flat button // background-color: $track_color; color: $fg_color; } @else if $t==flat-checked-insensitive { // // checked flat insensitive button // > label { color: inherit; } } @else if $t==undecorated { // // reset // border-color: transparent; background-color: transparent; background-image: none; box-shadow: none; text-shadow: none; -gtk-icon-shadow: none; } } // // Overshoot // @mixin overshoot($p, $t:normal, $c:$secondary_selected_bg_color) { // // Overshoot drawing function // // $p: position // $t: type // $c: base color // // possible $p values: // top, bottom, right, left // // possible $t values: // normal, backdrop // $_position: center $p; @if ($p == left) or ($p == right) { $_position: $p center; } background-image: -gtk-gradient(radial, $_position, 0, $_position, 0.75, to(gtkopacity($c, 0.2)), to(transparent)); background-repeat: no-repeat; background-position: $_position; // reset some properties to be sure to not inherit them somehow background-color: transparent; border: none; box-shadow: none; } // // Undershoot // @mixin undershoot($p, $fading_color: $base_color) { // // Undershoot drawing function // // $p: position // $fading_color: actual colour for fader // // possible $p values: // top, bottom, right, left // // shouldn't be needed, but better to be sure background-color: transparent; $_gradient_dir: $p; $_fader_size: 16px 32px; $_gradient_repeat: repeat-x; $_bg_pos: center $p; @if ($p == left) or ($p == right) { $_fader_size: 32px 16px; $_gradient_repeat: repeat-y; $_bg_pos: $p center; } // this is the dashed line background-image: linear-gradient(to $_gradient_dir, gtkopacity($fading_color, 0.01), gtkopacity($fading_color, 0.04), gtkopacity($fading_color, 0.20), gtkopacity($fading_color, 0.44), gtkopacity($fading_color, 0.94)); padding-#{$p}: 0; background-size: $_fader_size; background-repeat: $_gradient_repeat; background-origin: content-box; background-position: $_bg_pos; }