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