_drawing-3.20.scss
ASCII text
1// generic drawing of more complex things 2 3// 4// Ripple keyframes 5// 6 7@keyframes ripple { 8to { 9background-size: 1000% 1000%; 10} 11} 12 13@keyframes ripple-on-slider { 14to { 15background-size: auto, 1000% 1000%; 16} 17} 18 19@keyframes ripple-on-headerbar { 20from { 21background-image: radial-gradient(circle, $primary 0%, transparent 0%); 22} 23 24to { 25background-image: radial-gradient(circle, $primary 100%, transparent 0%); 26} 27} 28 29 30@mixin entry($t, $fc: $primary) { 31// 32// entry 33// 34// $t: entry type 35// $fc: focus color 36// 37 38@if $t == normal { 39transition: $transition, border-image $ripple-fade-in-duration $ease-out; 40border-image: 41radial-gradient( 42circle closest-corner at center calc(100% - 1px), 43$fc 0%, 44transparent 0% 45) 2 / 0 0 0; 46box-shadow: inset 0 0 0 9999px transparent, inset 0 -1px if($fc == $primary, stroke($on-surface), $fc); 47background-color: entry-fill($on-surface); 48color: $on-surface; 49caret-color: $fc; 50} 51 52@if $t == hover { 53box-shadow: inset 0 0 0 9999px overlay("hover", $on-surface), inset 0 -1px if($fc == $primary, stroke($on-surface), $fc); 54} 55 56@if $t == focus { 57box-shadow: inset 0 0 0 9999px overlay("focus", $on-surface), inset 0 -1px if($fc == $primary, stroke($on-surface), $fc); 58} 59 60@if $t == checked { 61border-image: 62radial-gradient( 63circle closest-corner at center calc(100% - 1px), 64$fc 100%, 65transparent 0% 66) 2 / 0 0 2px; 67} 68 69@if $t == disabled { 70box-shadow: inset 0 0 0 9999px transparent, inset 0 -1px disabled-stroke($on-surface); 71background-color: entry-fill($on-surface); 72color: disabled($on-surface); 73} 74 75@if $t == raised-normal { 76transition: $transition; 77border-image: none; 78box-shadow: $shadow-z1; 79background-color: if($fc == $primary, $surface, $fc); 80color: if($fc == $primary, $on-surface, on($fc)); 81caret-color: if($fc == $primary, $fc, on($fc)); 82} 83 84@if $t == raised-hover { 85box-shadow: $shadow-z3; 86} 87 88@if $t == raised-focus { 89border-image: none; 90box-shadow: $shadow-z3; 91} 92 93@if $t == raised-disabled { 94box-shadow: $shadow-z1; 95background-color: $base; 96color: disabled($on-surface); 97} 98} 99 100 101$ripple-transition-property: all, border-image, background-size, background-image; 102$ripple-transition-duration: $duration, $ripple-fade-in-duration, $ripple-fade-out-duration, $ripple-fade-out-opacity-duration; 103$ripple-active-transition-duration: $duration, $ripple-fade-in-duration, 0ms, 0ms; 104 105%ripple { 106transition-property: $ripple-transition-property; 107transition-duration: $ripple-transition-duration; 108transition-timing-function: $ease-out; 109outline: none; 110background-image: radial-gradient(circle, transparent 10%, transparent 0%); 111background-repeat: no-repeat; 112background-position: center; 113background-size: 1000% 1000%; 114 115&:active { 116transition-duration: $ripple-active-transition-duration; 117animation: ripple $ripple-fade-in-duration $ease-out forwards; 118background-size: 0% 0%; 119} 120} 121 122@mixin ink-color($color, $on: transparent, $button-style: "none", $hover-alt: false, $opacity-modifier: 0) { 123$hover: "hover"; 124 125@if $hover-alt or $button-style == "raised" { 126$hover: "hover-alt"; 127} 128 129@if $button-style == "flat" { 130box-shadow: none; 131} @else if $button-style == "outlined" { 132box-shadow: inset 0 0 0 1px stroke($on-surface); 133} @else if $button-style == "raised" { 134box-shadow: $shadow-z2; 135} 136 137@if $button-style != "none" or $on != transparent { 138background-color: $on; 139} 140 141&:drop(active), 142&:hover { 143@if $button-style == "flat" { 144box-shadow: none; 145} @else if $button-style == "outlined" { 146box-shadow: inset 0 0 0 1px stroke($on-surface); 147} @else if $button-style == "raised" { 148box-shadow: $shadow-z4; 149} 150 151background-color: overlay($hover, $color, $opacity-modifier: $opacity-modifier, $on: $on); 152} 153 154&:focus { 155@if $button-style == "flat" { 156box-shadow: none; 157} @else if $button-style == "outlined" { 158box-shadow: inset 0 0 0 1px stroke($on-surface); 159} @else if $button-style == "raised" { 160box-shadow: $shadow-z4; 161} 162 163background-color: overlay("focus", $color, $opacity-modifier: $opacity-modifier, $on: $on); 164} 165 166&:active { 167@if $button-style == "flat" { 168box-shadow: none; 169} @else if $button-style == "outlined" { 170box-shadow: inset 0 0 0 1px stroke($on-surface); 171} @else if $button-style == "raised" { 172box-shadow: $shadow-z8; 173} 174 175background-image: radial-gradient(circle, overlay("pressed", $color, $opacity-modifier: $opacity-modifier) 10%, transparent 0%); 176} 177} 178 179@mixin list-item { 180&:drop(active):not(:active), 181&:hover:not(:active) { 182transition-property: $ripple-transition-property, background-color; 183transition-duration: $ripple-transition-duration, 0ms; 184} 185} 186 187 188@mixin overshoot($side) { 189$valid-sides: top, bottom, left, right; 190 191@if not index($valid-sides, $side) { 192@error "#{$side} is not a valid side. Expected one of #{$valid-sides}."; 193} 194 195$_position: center $side; 196 197@if $side == left or $side == right { 198$_position: $side center; 199} 200 201background-image: 202-gtk-gradient( 203radial, 204$_position, 0, 205$_position, .75, 206to(rgba($primary, .24)), 207to(transparent) 208); 209 210background-repeat: no-repeat; 211background-position: $_position; 212 213background-color: transparent; // reset some properties to be sure to not inherit them somehow 214border: none; // 215box-shadow: none; // 216} 217 218 219@mixin undershoot($side) { 220$valid-sides: top, bottom, left, right; 221 222@if not index($valid-sides, $side) { 223@error "#{$side} is not a valid side. Expected one of #{$valid-sides}."; 224} 225 226$_undershoot_color_dark: stroke($on-surface); 227$_undershoot_color_light: transparent; 228 229$_gradient_dir: left; 230$_dash_bg_size: 12px 1px; 231$_gradient_repeat: repeat-x; 232$_bg_pos: left $side; 233 234@if $side == left or $side == right { 235$_gradient_dir: top; 236$_dash_bg_size: 1px 12px; 237$_gradient_repeat: repeat-y; 238$_bg_pos: $side top; 239} 240 241background-color: transparent; // shouldn't be needed, but better to be sure 242 243background-image: linear-gradient(to $_gradient_dir, // this is the dashed line 244$_undershoot_color_light 50%, 245$_undershoot_color_dark 50%); 246 247padding-#{$side}: 1px; 248background-size: $_dash_bg_size; 249background-repeat: $_gradient_repeat; 250background-origin: content-box; 251background-position: $_bg_pos; 252} 253