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