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