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