_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@mixin shadow($level) { 87@if $level==1 { 88box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); 89} 90@if $level==2 { 91box-shadow: 0 3px 6px rgba(0,0,0,0.16*1.5), 0 3px 6px rgba(0,0,0,0.23*1.5); 92} 93@if $level==3 { 94box-shadow: 0 10px 20px rgba(0,0,0,0.19*1.5), 0 6px 6px rgba(0,0,0,0.23*1.5); 95} 96@if $level==4 { 97box-shadow: 0 14px 28px rgba(0,0,0,0.25*1.5), 0 10px 10px rgba(0,0,0,0.22*1.5); 98} 99@if $level==5 { 100box-shadow: 0 19px 38px rgba(0,0,0,0.30*1.5), 0 15px 12px rgba(0,0,0,0.22*1.5); 101} 102} 103 104// entries 105 106@mixin entry($t, $fc:$selected_bg_color) { 107// 108// Entries drawing function 109// 110// $t: entry type 111// $fc: focus color 112// 113// possible $t values: 114// normal, focus, insensitive 115// 116@if $t==normal { 117background-color: rgba(0, 0, 0, 0.01); 118border-color: transparent; 119box-shadow: inset 0 -1px if($fc!=$selected_bg_color, $fc, $track_color); 120 121} 122@if $t==focus { 123border-color: transparent; 124box-shadow: inset 0 -2px if($fc!=$selected_bg_color, $fc, $selected_bg_color); 125} 126@if $t==hover { } 127@if $t==insensitive { 128color: $insensitive_fg_color; 129border-color: transparent; 130box-shadow: inset 0 -1px if($fc!=$selected_bg_color, $fc, $insensitive_track_color); 131} 132} 133 134// buttons 135 136@mixin button($t, $c:$base_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, undecorated 146// 147@if $t==normal { 148// 149// normal button 150// 151color: if($tc!=$fg_color, $tc, $secondary_fg_color); 152background-color: $c; 153border-color: transparent; 154@include shadow(1); 155text-shadow: none; 156icon-shadow: none; 157} 158@if $t==focus { 159// 160// focused button 161// 162color: $tc; 163text-shadow: none; 164icon-shadow: none; 165box-shadow: 0 0 transparent; 166// box-shadow: inset 0px 0px 0px 2px $track_color; 167} 168 169@else if $t==hover { 170// 171// hovered button 172// 173color: if($tc!=$fg_color, $tc, $fg_color); 174background-color: $c; 175border-color: transparent; 176@include shadow(2); 177text-shadow: none; 178icon-shadow: none; 179 180} 181@else if $t==active { 182// 183// pushed button 184// 185color: if($tc!=$fg_color, $tc, $fg_color); 186background-color: mix($tc, $c, percentage($lower_opacity)); 187border-color: transparent; 188@include shadow(2); 189text-shadow: none; 190icon-shadow: none; 191} 192@else if $t==insensitive { 193// 194// insensitive button 195// 196color: if($tc!=$fg_color, $tc, $insensitive_secondary_fg_color); 197background-color: if($c!=$base_color, $c, $insensitive_track_color); 198border-color: transparent; 199box-shadow: 0 0 transparent; 200text-shadow: none; 201icon-shadow: none; 202} 203@if $t==flat-normal { 204// 205// normal flat button 206// 207color: if($tc!=$fg_color, $tc, $secondary_fg_color); 208background-color: transparent; 209border-color: transparent; 210box-shadow: 0 0 transparent; 211text-shadow: none; 212icon-shadow: none; 213} 214@if $t==flat-focus { 215// 216// focused flat button 217// 218color: $tc; 219text-shadow: none; 220icon-shadow: none; 221box-shadow: 0 0 transparent; 222// box-shadow: inset 0px 0px 0px 2px $track_color; 223} 224 225@else if $t==flat-hover { 226// 227// hovered flat button 228// 229color: if($tc!=$fg_color, $tc, $fg_color); 230background-color: if($c!=$base_color, $c, $semi_track_color); 231border-color: transparent; 232box-shadow: 0 0 transparent; 233text-shadow: none; 234icon-shadow: none; 235 236} 237@else if $t==flat-active { 238// 239// pushed flat button 240// 241color: if($tc!=$fg_color, $tc, $fg_color); 242background-color: if($c!=$base_color, $c, $track_color); 243border-color: transparent; 244box-shadow: 0 0 transparent; 245text-shadow: none; 246icon-shadow: none; 247} 248@else if $t==flat-insensitive { 249// 250// insensitive flat button 251// 252color: if($tc!=$fg_color, $tc, $insensitive_secondary_fg_color); 253background-color: transparent; 254border-color: transparent; 255box-shadow: 0 0 transparent; 256text-shadow: none; 257icon-shadow: none; 258} 259@else if $t==undecorated { 260// 261// reset 262// 263color: inherit; 264background-color: transparent; 265border-color: transparent; 266box-shadow: 0 0 transparent; 267text-shadow: none; 268icon-shadow: none; 269} 270} 271 272