_drawing.scss
ASCII text
1// Drawing mixins 2 3// generic drawing of more complex things 4 5// provide font size in pt, with px fallback 6@mixin px-to-pt($size: $root-font-size) { 7font-size: ($size * 0.75 / 1px) * 1pt; 8} 9 10// provide icon size in em, with px fallback 11@mixin px-to-em($size: 16px) { 12icon-size: ($size / $root-font-size) * 1em; 13} 14 15// Typography 16@mixin font($typo) { 17@if $typo==display-4 { 18// font-family: $large-font-family; 19font-size: 112px; 20font-weight: 300; 21line-height: 1; 22} 23@if $typo==display-3 { 24// font-family: $large-font-family; 25font-size: 56px; 26font-weight: 400; 27line-height: 1; 28} 29@if $typo==display-2 { 30// font-family: $large-font-family; 31font-size: 45px; 32font-weight: 400; 33line-height: 48px; 34} 35@if $typo==display-1 { 36// font-family: $large-font-family; 37font-size: 34px; 38font-weight: 400; 39line-height: 40px; 40} 41@if $typo==headline { 42// font-size: 24px; 43@include px-to-pt(24px); 44font-weight: 400; 45line-height: 32px; 46} 47@if $typo==title { 48// font-size: 20px; 49@include px-to-pt(20px); 50font-weight: 500; 51line-height: 1; 52} 53@if $typo==subheading { 54// font-size: 16px; 55@include px-to-pt(16px); 56font-weight: 400; 57line-height: 24px; 58} 59@if $typo==body-2 { 60// font-size: 14px; 61@include px-to-pt($root-font-size); 62font-weight: 500; 63line-height: 24px; 64} 65@if $typo==body-1 { 66// font-size: 14px; 67@include px-to-pt($root-font-size); 68font-weight: 400; 69line-height: 24px; 70} 71@if $typo==caption { 72// font-size: 12px; 73@include px-to-pt(12px); 74font-weight: 400; 75line-height: 1; 76} 77@if $typo==button { 78// font-size: 14px; 79@include px-to-pt($root-font-size); 80font-weight: 500; 81line-height: 1; 82} 83} 84 85// shadows 86$z-depth-0: 0 0 transparent; 87$z-depth-1: 0 1px 1.5px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.24); 88$z-depth-2: 0 3px 3px rgba(0, 0, 0, 0.16 * 1.5), 0 3px 3px rgba(0, 0, 0, 0.23 * 1.5); 89$z-depth-3: 0 10px 10px rgba(0, 0, 0, 0.19 * 1.5), 0 6px 3px rgba(0, 0, 0, 0.23 * 1.5); 90$z-depth-4: 0 14px 14px rgba(0, 0, 0, 0.25 * 2), 0 10px 5px rgba(0, 0, 0, 0.22 * 2); 91$z-depth-5: 0 19px 19px rgba(0, 0, 0, 0.30 * 2), 0 15px 6px rgba(0, 0, 0, 0.22 * 2); 92 93// entries 94 95@mixin entry($t, $fc:$selected_bg_color) { 96// 97// Entries drawing function 98// 99// $t: entry type 100// $fc: focus color 101// 102// possible $t values: 103// normal, focus, insensitive 104// 105@if $t==normal { 106background-color: if($fc!=$selected_bg_color, rgba($bg_color, 0.01), rgba($base_color, 0.01)); 107border-color: transparent; 108box-shadow: inset 0 -1px if($fc!=$selected_bg_color, $fc, $track_color); 109 110} 111@if $t==focus { 112border-color: transparent; 113box-shadow: inset 0 -2px if($fc!=$selected_bg_color, $fc, $selected_bg_color); 114} 115@if $t==hover { } 116@if $t==insensitive { 117color: $insensitive_fg_color; 118border-color: transparent; 119box-shadow: inset 0 -1px if($fc!=$selected_bg_color, $fc, $insensitive_track_color); 120} 121} 122 123// buttons 124 125@mixin button($t, $c:$base_color, $tc:$fg_color) { 126// 127// Button drawing function 128// 129// $t: button type, 130// $c: base button color for colored* types 131// $tc: optional text color for colored* types 132// 133// possible $t values: 134// normal, focus, hover, active, insensitive, 135// flat-normal, flat-focus, flat-hover, flat-active, flat-insensitive 136// 137@if $t==normal { 138// 139// normal button 140// 141color: if($tc!=$fg_color, $tc, $secondary_fg_color); 142background-color: $c; 143border-color: transparent; 144box-shadow: $z-depth-1; 145text-shadow: none; 146icon-shadow: none; 147} 148@if $t==focus { 149// 150// focused button 151// 152color: $tc; 153text-shadow: none; 154icon-shadow: none; 155box-shadow: 0 0 transparent; 156// box-shadow: inset 0px 0px 0px 2px $track_color; 157} 158 159@else if $t==hover { 160// 161// hovered button 162// 163color: if($tc!=$fg_color, $tc, $fg_color); 164background-color: $c; 165border-color: transparent; 166box-shadow: $z-depth-2; 167text-shadow: none; 168icon-shadow: none; 169 170} 171@else if $t==active { 172// 173// pushed button 174// 175color: if($tc!=$fg_color, $tc, $fg_color); 176background-color: mix($tc, $c, percentage($lower_opacity)); 177border-color: transparent; 178box-shadow: $z-depth-2; 179text-shadow: none; 180icon-shadow: none; 181} 182@else if $t==insensitive { 183// 184// insensitive button 185// 186color: if($tc!=$fg_color, $tc, $insensitive_secondary_fg_color); 187background-color: if($c!=$base_color, $c, $insensitive_track_color); 188border-color: transparent; 189box-shadow: 0 0 transparent; 190text-shadow: none; 191icon-shadow: none; 192} 193@if $t==flat-normal { 194// 195// normal flat button 196// 197color: if($tc!=$fg_color, $tc, $secondary_fg_color); 198background-color: transparent; 199border-color: transparent; 200box-shadow: 0 0 transparent; 201text-shadow: none; 202icon-shadow: none; 203} 204@if $t==flat-focus { 205// 206// focused flat button 207// 208color: $tc; 209text-shadow: none; 210icon-shadow: none; 211box-shadow: 0 0 transparent; 212// box-shadow: inset 0px 0px 0px 2px $track_color; 213} 214 215@else if $t==flat-hover { 216// 217// hovered flat button 218// 219color: if($tc!=$fg_color, $tc, $fg_color); 220background-color: if($c!=$base_color, $c, $semi_track_color); 221border-color: transparent; 222box-shadow: 0 0 transparent; 223text-shadow: none; 224icon-shadow: none; 225 226} 227@else if $t==flat-active { 228// 229// pushed flat button 230// 231color: if($tc!=$fg_color, $tc, $fg_color); 232background-color: if($c!=$base_color, $c, $track_color); 233border-color: transparent; 234box-shadow: 0 0 transparent; 235text-shadow: none; 236icon-shadow: none; 237} 238@else if $t==flat-insensitive { 239// 240// insensitive flat button 241// 242color: if($tc!=$fg_color, $tc, $insensitive_secondary_fg_color); 243background-color: transparent; 244border-color: transparent; 245box-shadow: 0 0 transparent; 246text-shadow: none; 247icon-shadow: none; 248} 249} 250 251