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