_drawing.scss
ASCII text
1// generic drawing of more complex things 2 3// provide font size in pt, with px fallback 4@function pt($size: $font-size) { 5@return ($size * 0.75 / 1px) * 1pt; 6} 7 8// provide icon size in em, with px fallback 9@function em($size: 16px) { 10@return ($size / $font-size) * 1em; 11} 12 13// Typography 14// based on: 15// https://material.io/design/typography/the-type-system.html 16 17@mixin type($style) { 18@if $style == headline1 { 19// font-family: $font-family-large; 20font-size: 96px; 21font-weight: 300; 22// line-height: 1; 23} 24 25@if $style == headline2 { 26// font-family: $font-family-large; 27font-size: 60px; 28font-weight: 300; 29// line-height: 1; 30} 31 32@if $style == headline3 { 33// font-family: $font-family-large; 34font-size: 48px; 35font-weight: 400; 36// line-height: 50px; 37} 38 39@if $style == headline4 { 40// font-family: $font-family-large; 41font-size: 34px; 42font-weight: 400; 43// line-height: 40px; 44} 45 46@if $style == headline5 { 47font-size: pt(24px); 48font-weight: 400; 49// line-height: 32px; 50} 51 52@if $style == headline6 { 53font-size: pt(20px); 54font-weight: 500; 55// line-height: 32px; 56} 57 58@if $style == subtitle1 { 59font-size: pt($font-size-subheading); 60font-weight: 400; 61// line-height: 28px; 62} 63 64@if $style == subtitle2 { 65font-size: pt($font-size); 66font-weight: 500; 67// line-height: 22px; 68} 69 70@if $style == body1 { 71font-size: pt($font-size-subheading); 72font-weight: 400; 73// line-height: 24px; 74} 75 76@if $style == body2 { 77font-size: pt($font-size); 78font-weight: 400; 79// line-height: 20px; 80} 81 82@if $style == caption { 83font-size: pt(12px); 84font-weight: 400; 85// line-height: 20px; 86} 87 88@if $style == button { 89font-size: pt($font-size); 90font-weight: 500; 91// line-height: 36px; 92} 93 94@if $style == overline { 95font-size: pt(12px); 96font-weight: 400; 97// line-height: 32px; 98} 99} 100 101 102@mixin entry($t, $fc: $primary) { 103// 104// entry 105// 106// $t: entry type 107// $fc: focus color 108// 109 110@if $t == normal { 111transition-duration: $duration; 112background-color: if($fc == $primary, entry-fill($on-surface), entry-fill($on-dark)); 113border-color: transparent; 114box-shadow: inset 0 -1px if($fc == $primary, stroke($on-surface), $fc); 115} 116 117@if $t == focus { 118border-color: transparent; 119box-shadow: inset 0 -2px $fc; 120} 121 122@if $t == hover { 123box-shadow: inset 0 -1px if($fc == $primary, $on-surface, $fc); 124} 125 126@if $t == insensitive { 127color: disabled($on-surface); 128border-color: transparent; 129box-shadow: inset 0 -1px if($fc == $primary, disabled-stroke($on-surface), $fc); 130} 131} 132 133 134@mixin button($t, $c: $surface-z8, $tc: $on-surface) { 135// 136// button 137// 138// $t: button type 139// $c: base color 140// $tc: text color 141// 142 143@if $t == normal { 144color: $tc; 145background-color: $c; 146border-color: transparent; 147box-shadow: $shadow-z2; 148text-shadow: none; 149icon-shadow: none; 150transition-duration: $duration; 151} 152 153@if $t == focus { 154color: $tc; 155text-shadow: none; 156icon-shadow: none; 157box-shadow: $shadow-z4; 158} 159 160@if $t == hover { 161color: $tc; 162background-color: $c; 163border-color: transparent; 164box-shadow: $shadow-z4; 165text-shadow: none; 166icon-shadow: none; 167} 168 169@if $t == active { 170color: $tc; 171background-color: mix($tc, $c, percentage(0.24)); 172border-color: transparent; 173box-shadow: $shadow-z8; 174text-shadow: none; 175icon-shadow: none; 176transition-duration: $duration-ripple; 177} 178 179@if $t == insensitive { 180color: if($tc == $on-surface, disabled($on-surface), $tc); 181background-color: if($c == $surface-z8, fill($on-surface), $c); 182border-color: transparent; 183box-shadow: $shadow-z0; 184text-shadow: none; 185icon-shadow: none; 186} 187 188@if $t == flat-normal { 189color: if($tc != $on-dark, $primary, hint($on-dark)); 190background-color: transparent; 191border-color: transparent; 192box-shadow: $shadow-z0; 193text-shadow: none; 194icon-shadow: none; 195transition-duration: $duration; 196} 197 198@if $t == flat-focus { 199color: if($tc != $on-dark, $primary, hint($on-dark)); 200background-color: overlay("focus", if($tc != $on-dark, $primary, $on-dark)); 201text-shadow: none; 202icon-shadow: none; 203box-shadow: $shadow-z0; 204} 205 206@if $t == flat-hover { 207color: if($tc != $on-dark, $primary, hint($on-dark)); 208background-color: overlay("hover", if($tc != $on-dark, $primary, $on-dark)); 209border-color: transparent; 210box-shadow: $shadow-z0; 211text-shadow: none; 212icon-shadow: none; 213} 214 215@if $t == flat-active { 216color: if($tc != $on-dark, $primary, hint($on-dark)); 217background-color: overlay("pressed", if($tc != $on-dark, $primary, $on-dark)); 218border-color: transparent; 219box-shadow: $shadow-z0; 220text-shadow: none; 221icon-shadow: none; 222transition-duration: $duration-ripple; 223} 224 225@if $t == flat-insensitive { 226color: if($tc != $on-dark, disabled-hint($on-surface), disabled-hint($on-dark)); 227background-color: transparent; 228border-color: transparent; 229box-shadow: $shadow-z0; 230text-shadow: none; 231icon-shadow: none; 232} 233} 234