_drawing.scss
ASCII text
1// Drawing mixins 2 3// generic drawing of more complex things 4 5 6// shadows 7 8// based shadow values: 9// https://material-design.storage.googleapis.com/images/layout-principles-dimensionality-shadows-08_large_mdpi.png 10 11// box-shadow 1px blur doesn't draw correctly, see 12// https://bugzilla.gnome.org/show_bug.cgi?id=738484 13// $z-depth-1: 0 1px 1.5px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.24); 14$z-depth-1: 0 1px 1px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); 15$z-depth-2: 0 3px 3px rgba(0, 0, 0, 0.16), 0 3px 3px rgba(0, 0, 0, 0.23); 16$z-depth-3: 0 10px 10px rgba(0, 0, 0, 0.19), 0 6px 3px rgba(0, 0, 0, 0.23); 17$z-depth-4: 0 14px 14px rgba(0, 0, 0, 0.25), 0 10px 5px rgba(0, 0, 0, 0.22); 18$z-depth-5: 0 19px 19px rgba(0, 0, 0, 0.30), 0 15px 6px rgba(0, 0, 0, 0.22); 19 20 21// ripple effect animations 22 23@keyframes ripple_effect { 24from { 25background-image: radial-gradient(circle farthest-corner at center, 26gtkalpha(currentColor, $lower_opacity / 2) 0%, 27transparent 0%), 28image(gtkalpha(currentColor, 0)); 29} 30 31to { 32background-image: radial-gradient(circle farthest-corner at center, 33gtkalpha(currentColor, $lower_opacity / 2) 100%, 34transparent 0%), 35image(gtkalpha(currentColor, $lower_opacity / 2)); 36} 37} 38 39@keyframes flat_ripple_effect { 40from { 41background-image: radial-gradient(circle farthest-corner at center, 42gtkalpha(currentColor, $lower_opacity / 2) 0%, 43transparent 0%), 44image(gtkalpha(currentColor, $lower_opacity / 2)); 45} 46 47to { 48background-image: radial-gradient(circle farthest-corner at center, 49gtkalpha(currentColor, $lower_opacity / 2) 100%, 50transparent 0%), 51image(gtkalpha(currentColor, $lower_opacity / 2)); 52} 53} 54 55@keyframes row_ripple_effect { 56from { 57background-image: radial-gradient(circle farthest-corner at center, 58gtkalpha(currentColor, $lower_opacity / 2) 0%, 59transparent 0%), 60image(gtkalpha(currentColor, 0)); 61} 62 63to { 64background-image: radial-gradient(circle farthest-corner at center, 65gtkalpha(currentColor, $lower_opacity / 2) 100%, 66transparent 0%), 67image(gtkalpha(currentColor, 0)); 68} 69} 70 71@keyframes tab_ripple_effect { 72from { 73background-image: radial-gradient(circle farthest-corner at center, 74scale-alpha($primary_color, $middle_opacity) 0%, 75transparent 0%); 76} 77 7850% { 79background-image: radial-gradient(circle farthest-corner at center, 80scale-alpha($primary_color, $middle_opacity) 100%, 81transparent 0%); 82} 83 84to { 85background-image: radial-gradient(circle farthest-corner at center, 86transparent 100%, 87transparent 0%); 88} 89} 90 91@keyframes header_ripple_effect { 92from { 93background-image: radial-gradient(circle farthest-corner at center, 94$primary_color 0%, 95transparent 0%); 96} 97 98to { 99background-image: radial-gradient(circle farthest-corner at center, 100$primary_color 100%, 101transparent 0%); 102} 103} 104 105 106@mixin entry($t, $fc:$primary_color) { 107// 108// Entries drawing function 109// 110// $t: entry type 111// $fc: focus color 112// 113// possible $t values: 114// normal, focus, disabled, flat-normal, flat-focus, flat-disabled; 115// 116 117@if $t == normal { 118transition: $longer_transition, $shadow_transition; 119border-image: none; 120box-shadow: $z-depth-1; 121background-color: if($fc != $primary_color, $fc, $base_color); 122color: if($fc != $primary_color, $inversed_fg_color, $fg_color); 123} 124 125@if $t == focus { 126border-image: none; 127box-shadow: $z-depth-2; 128} 129 130@if $t == disabled { 131box-shadow: $z-depth-1; 132background-color: $alt_base_color; 133color: $disabled_fg_color; 134} 135 136@if $t == flat-normal { 137transition: $longer_transition; 138border-image: radial-gradient(circle closest-corner at center calc(100% - 1px), 139$fc 0%, 140transparent 0%) 1410 0 0 / 0 0 0px; 142box-shadow: inset 0 -1px if($fc != $primary_color, $fc, $track_color); 143background-color: transparent; 144color: $fg_color; 145} 146 147@if $t == flat-focus { 148border-image: radial-gradient(circle closest-corner at center calc(100% - 1px), 149$fc 100%, 150transparent 0%) 1510 0 2 / 0 0 2px; 152box-shadow: inset 0 -1px if($fc != $primary_color, $fc, $track_color); 153} 154 155@if $t == flat-disabled { 156box-shadow: inset 0 -1px $track_color; 157background-color: transparent; 158color: $disabled_fg_color; 159} 160} 161 162 163@mixin button($t, $c:$lighter_bg_color, $tc:$fg_color) { 164// 165// Button drawing function 166// 167// $t: button type, 168// $c: base button color for colored* types 169// $tc: optional text color for colored* types 170// 171// possible $t values: 172// normal, hover, active, disabled, checked, checked-disabled, 173// flat-normal, flat-hover, flat-active, flat-disabled, flat-checked, flat-checked-disabled; 174// 175 176@if $t == normal { 177transition: $longer_transition, $shadow_transition; 178box-shadow: $z-depth-1; 179background-color: $c; 180background-image: radial-gradient(circle farthest-corner at center, 181gtkalpha(currentColor, 0) 100%, 182transparent 0%), 183image(gtkalpha(currentColor, 0)); 184color: $secondary_fg_color; 185} 186 187@if $t == hover { 188box-shadow: $z-depth-2; 189background-image: radial-gradient(circle farthest-corner at center, 190gtkalpha(currentColor, 0) 100%, 191transparent 0%), 192image(gtkalpha(currentColor, 0)); 193color: $fg_color; 194} 195 196@if $t == active { 197transition: $longer_transition, $shadow_transition, background-image 0; 198animation: ripple_effect $longer_duration $deceleration_curve forwards; 199box-shadow: $z-depth-2; 200color: $fg_color; 201} 202 203@if $t == disabled { 204box-shadow: none; 205background-color: $track_color; 206color: if($tc != $fg_color, $disabled_fg_color, $disabled_secondary_fg_color); 207} 208 209@if $t == checked { 210background-color: $primary_color; 211color: $inversed_fg_color; 212} 213 214@if $t == checked-disabled { 215background-color: $track_color; 216color: scale-alpha($primary_color, $disabled_opacity); 217} 218 219@if $t == flat-normal { 220transition: $longer_transition; 221box-shadow: none; 222background-color: transparent; 223background-image: radial-gradient(circle farthest-corner at center, 224gtkalpha(currentColor, 0) 100%, 225transparent 0%), 226image(gtkalpha(currentColor, 0)); 227color: gtkalpha(currentColor, $enabled_opacity); 228} 229 230@if $t == flat-hover { 231box-shadow: none; 232background-image: radial-gradient(circle farthest-corner at center, 233gtkalpha(currentColor, 0) 100%, 234transparent 0%), 235image(gtkalpha(currentColor, $lower_opacity / 2)); 236color: currentColor; 237} 238 239@if $t == flat-active { 240transition: $longer_transition, background-image 0; 241animation: flat_ripple_effect $longer_duration $deceleration_curve forwards; 242box-shadow: none; 243color: currentColor; 244} 245 246@if $t == flat-disabled { 247box-shadow: none; 248background-color: transparent; 249color: if($tc != $fg_color, gtkalpha(currentColor, $disabled_opacity), gtkalpha(currentColor, $enabled_opacity * $disabled_opacity)); 250} 251 252@if $t == flat-checked { 253background-color: $track_color; 254color: currentColor; 255} 256 257@if $t == flat-checked-disabled { 258background-color: $track_color; 259color: gtkalpha(currentColor, $disabled_opacity); 260} 261} 262 263 264@mixin overshoot($p, $t:normal, $c:$alt_primary_color) { 265// 266// overshoot 267// 268// $p: position 269// $t: type 270// $c: base color 271// 272// possible $p values: 273// top, bottom, right, left 274// 275// possible $t values: 276// normal, backdrop 277// 278 279$_position: center $p; 280 281@if ($p == left) or ($p == right) { 282$_position: $p center; 283} 284 285background-image: -gtk-gradient(radial, 286$_position, 0, 287$_position, 0.75, 288to(scale-alpha($c, $lower_opacity)), 289to(transparent)); 290 291background-repeat: no-repeat; 292background-position: $_position; 293 294background-color: transparent; // reset some properties to be sure to not inherit them somehow 295border: none; // 296box-shadow: none; // 297} 298 299 300@mixin undershoot($p) { 301// 302// undershoot 303// 304// $p: position 305// 306// possible $p values: 307// top, bottom, right, left 308// 309 310$_undershoot_color_dark: scale-alpha($fg_color, $lower_opacity); 311$_undershoot_color_light: scale-alpha($base_color, $lower_opacity); 312 313$_gradient_dir: left; 314$_dash_bg_size: 12px 1px; 315$_gradient_repeat: repeat-x; 316$_bg_pos: left $p; 317 318background-color: transparent; // shouldn't be needed, but better to be sure; 319 320@if ($p == left) or ($p == right) { 321$_gradient_dir: top; 322$_dash_bg_size: 1px 12px; 323$_gradient_repeat: repeat-y; 324$_bg_pos: $p top; 325} 326 327background-image: linear-gradient(to $_gradient_dir, // this is the dashed line 328$_undershoot_color_light 50%, 329$_undershoot_color_dark 50%); 330 331padding-#{$p}: 1px; 332background-size: $_dash_bg_size; 333background-repeat: $_gradient_repeat; 334background-origin: content-box; 335background-position: $_bg_pos; 336} 337