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