2020-07-15 00:35:03 +08:00
|
|
|
// generic drawing of more complex things
|
|
|
|
|
|
|
|
// provide font size in pt, with px fallback
|
|
|
|
@function pt($size: $root-font-size) {
|
|
|
|
@return ($size * 0.75 / 1px) + pt;
|
|
|
|
}
|
|
|
|
|
|
|
|
// provide icon size in em, with px fallback
|
|
|
|
@function em($size: 16px) {
|
|
|
|
@return ($size / $root-font-size) + em;
|
|
|
|
}
|
|
|
|
|
2024-03-31 02:47:02 +08:00
|
|
|
// Function to convert px values to em
|
|
|
|
@function to_em($input, $base: 16px) {
|
|
|
|
// multiplied and divided by 1000 to make up for round() shortcoming
|
|
|
|
$em_value: ($input / $base) * 1.091 * 1000;
|
|
|
|
@return round($em_value) / 1000 * 1em;
|
|
|
|
}
|
|
|
|
|
2021-04-08 22:59:05 +08:00
|
|
|
// provide font size in rem, with px fallback
|
|
|
|
@mixin fontsize($size: 24, $base: 16) {
|
|
|
|
font-size: round($size) + pt;
|
|
|
|
//font-size: ($size / $base) * 1rem;
|
|
|
|
}
|
|
|
|
|
2020-07-15 00:35:03 +08:00
|
|
|
// Typography
|
|
|
|
// based on:
|
|
|
|
// https://material.io/guidelines/style/typography.html#typography-styles
|
|
|
|
|
|
|
|
@mixin font($size) {
|
|
|
|
@if $size == display-4 {
|
|
|
|
// font-family: $large-font-family;
|
|
|
|
font-size: 112px;
|
|
|
|
font-weight: 300;
|
|
|
|
// line-height: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $size == display-3 {
|
|
|
|
// font-family: $large-font-family;
|
|
|
|
font-size: 56px;
|
|
|
|
font-weight: 400;
|
|
|
|
// line-height: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $size == display-2 {
|
|
|
|
// font-family: $large-font-family;
|
|
|
|
font-size: 45px;
|
|
|
|
font-weight: 400;
|
|
|
|
// line-height: 48px;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $size == display-1 {
|
|
|
|
// font-family: $large-font-family;
|
|
|
|
font-size: 34px;
|
|
|
|
font-weight: 400;
|
|
|
|
// line-height: 40px;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $size == headline {
|
|
|
|
font-size: pt(24px);
|
|
|
|
font-weight: 400;
|
|
|
|
// line-height: 32px;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $size == title {
|
|
|
|
font-size: pt(20px);
|
|
|
|
font-weight: 500;
|
|
|
|
// line-height: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $size == subheading {
|
|
|
|
font-size: pt($subheading-size);
|
|
|
|
font-weight: 400;
|
|
|
|
// line-height: 24px;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $size == body-2 {
|
|
|
|
font-size: pt($root-font-size);
|
|
|
|
font-weight: 500;
|
|
|
|
// line-height: 24px;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $size == body-1 {
|
|
|
|
font-size: pt($root-font-size);
|
|
|
|
font-weight: 400;
|
|
|
|
// line-height: 20px;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $size == caption {
|
|
|
|
font-size: pt(12px);
|
|
|
|
font-weight: 400;
|
|
|
|
// line-height: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $size == button {
|
|
|
|
font-size: pt($root-font-size);
|
|
|
|
font-weight: 500;
|
|
|
|
// line-height: 20px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-28 20:28:16 +08:00
|
|
|
@mixin entry($t, $fc: $primary_color, $tc: $fg_color, $bc: $entry_shell_bg) {
|
2020-07-15 00:35:03 +08:00
|
|
|
//
|
|
|
|
// entry
|
|
|
|
//
|
|
|
|
// $t: entry type
|
|
|
|
// $fc: focus color
|
|
|
|
//
|
|
|
|
|
|
|
|
@if $t == normal {
|
2020-07-17 12:59:41 +08:00
|
|
|
background-color: $bc;
|
2021-05-09 22:49:36 +08:00
|
|
|
border-radius: $circular_radius;
|
2024-03-29 01:49:55 +08:00
|
|
|
border: 2px solid transparent !important;
|
|
|
|
box-shadow: inset 0 0 0 1px rgba($borders_color, 0) !important;
|
|
|
|
outline: none;
|
2020-07-15 09:47:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == hover {
|
2024-03-29 01:49:55 +08:00
|
|
|
box-shadow: inset 0 0 0 1px rgba($borders_color, 0.1) !important;
|
|
|
|
border: 2px solid transparent !important;
|
2020-07-15 00:35:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == focus {
|
2024-03-29 01:49:55 +08:00
|
|
|
border: 2px solid lighten($fc, 15%) !important;
|
|
|
|
box-shadow: inset 0 0 0 1px rgba($borders_color, 0) !important;
|
2020-07-15 00:35:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == insensitive {
|
2020-12-26 21:44:54 +08:00
|
|
|
background-color: rgba($bc, 0.05);
|
2020-07-15 00:35:03 +08:00
|
|
|
color: $disabled_fg_color;
|
|
|
|
}
|
2020-12-26 21:44:54 +08:00
|
|
|
|
|
|
|
@if $t == flat-normal {
|
|
|
|
background-color: $bc;
|
2021-05-09 22:49:36 +08:00
|
|
|
border-radius: $circular_radius;
|
2024-03-29 01:49:55 +08:00
|
|
|
border: none !important;
|
|
|
|
box-shadow: none !important;
|
2020-12-28 20:28:16 +08:00
|
|
|
color: $tc;
|
2020-12-26 21:44:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == flat-hover {
|
|
|
|
background-color: $bc;
|
2024-03-29 01:49:55 +08:00
|
|
|
box-shadow: inset 0 0 0 1px rgba($borders_color, 0.05) !important;
|
2020-12-28 20:28:16 +08:00
|
|
|
color: $tc;
|
2020-12-26 21:44:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == flat-focus {
|
2024-03-29 01:49:55 +08:00
|
|
|
border: none !important;
|
2020-12-26 21:44:54 +08:00
|
|
|
background-color: rgba($bc, 0.2);
|
2020-12-28 20:28:16 +08:00
|
|
|
color: $tc;
|
2020-12-26 21:44:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == flat-insensitive {
|
2024-03-29 01:49:55 +08:00
|
|
|
border: none !important;
|
2020-12-26 21:44:54 +08:00
|
|
|
background-color: rgba($bc, 0.05);
|
2020-12-28 20:28:16 +08:00
|
|
|
color: rgba($tc, 0.45);
|
2020-12-26 21:44:54 +08:00
|
|
|
}
|
2020-07-15 00:35:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@mixin search_entry($t, $fc: $primary_color) {
|
|
|
|
//
|
|
|
|
// search_entry
|
|
|
|
//
|
|
|
|
// $t: search_entry type
|
|
|
|
// $fc: focus color
|
|
|
|
//
|
|
|
|
|
|
|
|
@if $t == normal {
|
|
|
|
background-color: rgba(white, 0.12);
|
|
|
|
border-radius: $bd_radius;
|
2024-03-29 01:49:55 +08:00
|
|
|
border-color: transparent !important;
|
|
|
|
box-shadow: none !important;
|
2020-07-15 00:35:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == focus {
|
2024-03-29 01:49:55 +08:00
|
|
|
border-color: transparent !important;
|
2020-07-15 00:35:03 +08:00
|
|
|
background-color: rgba(white, 0.18);
|
2024-03-29 01:49:55 +08:00
|
|
|
box-shadow: none !important;
|
2020-07-15 00:35:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == hover {
|
|
|
|
background-color: rgba(white, 0.2);
|
2024-03-29 01:49:55 +08:00
|
|
|
border-color: transparent !important;
|
|
|
|
box-shadow: none !important;
|
2020-07-15 00:35:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == insensitive {
|
|
|
|
color: $disabled_fg_color;
|
2024-03-29 01:49:55 +08:00
|
|
|
border-color: transparent !important;
|
|
|
|
box-shadow: none !important;
|
2020-07-15 00:35:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-30 18:23:54 +08:00
|
|
|
@mixin button($t, $c: $button_bg, $tc: $fg_color) {
|
2020-07-15 00:35:03 +08:00
|
|
|
//
|
|
|
|
// button
|
|
|
|
//
|
|
|
|
// $t: button type
|
|
|
|
// $c: base color
|
|
|
|
// $tc: text color
|
|
|
|
//
|
|
|
|
|
|
|
|
@if $t == normal {
|
2020-12-30 18:23:54 +08:00
|
|
|
color: $tc;
|
2020-07-15 00:35:03 +08:00
|
|
|
background-color: $c;
|
|
|
|
border: 1px solid $button_borders;
|
|
|
|
|
2020-12-30 18:23:54 +08:00
|
|
|
@if $variant=='light' { box-shadow: 0 1px 2px 0 rgba(black, 0.02); }
|
|
|
|
@if $variant=='dark' {
|
|
|
|
box-shadow: inset 0 1px $button_highlight;
|
|
|
|
}
|
|
|
|
|
2020-07-15 00:35:03 +08:00
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == focus {
|
|
|
|
color: $tc;
|
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
2023-03-11 17:34:24 +08:00
|
|
|
box-shadow: none !important;
|
2020-07-15 00:35:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == hover {
|
|
|
|
color: $tc;
|
2021-12-26 22:16:39 +08:00
|
|
|
border: 1px solid $button_borders;
|
2020-07-15 00:35:03 +08:00
|
|
|
background-color: if($variant=='light', darken($c, 3%), lighten($c, 3%));
|
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == active {
|
2020-12-30 18:23:54 +08:00
|
|
|
color: $tc;
|
2024-03-31 02:47:02 +08:00
|
|
|
background-color: if($variant=='light', darken($c, 5%), lighten($c, 5%));
|
2020-12-30 18:23:54 +08:00
|
|
|
border: 1px solid $button_borders;
|
2020-07-15 00:35:03 +08:00
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
|
|
|
}
|
|
|
|
|
2024-03-31 02:47:02 +08:00
|
|
|
@if $t == checked {
|
|
|
|
color: $tc;
|
|
|
|
background-color: $selected_bg_color;
|
|
|
|
border: 1px solid $selected_bg_color;
|
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
|
|
|
}
|
|
|
|
|
2020-07-15 00:35:03 +08:00
|
|
|
@if $t == insensitive {
|
|
|
|
color: if($tc == $fg_color, $disabled_fg_color, $tc);
|
|
|
|
background-color: if($c == $base_color, $divider_color, $c);
|
|
|
|
border-color: if($variant == 'light', $button_border, $dark_borders_color);
|
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == flat-normal {
|
2021-04-13 20:33:10 +08:00
|
|
|
color: $tc;
|
2020-07-15 00:35:03 +08:00
|
|
|
background-color: transparent;
|
|
|
|
border-color: transparent;
|
2020-12-30 19:51:58 +08:00
|
|
|
box-shadow: none;
|
2020-07-15 00:35:03 +08:00
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == flat-focus {
|
2021-04-13 20:33:10 +08:00
|
|
|
color: $tc;
|
2020-07-15 00:35:03 +08:00
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
2022-10-09 23:53:57 +08:00
|
|
|
|
|
|
|
&, &:hover, &:active {
|
|
|
|
box-shadow: none !important;
|
|
|
|
}
|
2020-07-15 00:35:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == flat-hover {
|
2021-04-13 20:33:10 +08:00
|
|
|
color: $tc;
|
2020-12-28 20:28:16 +08:00
|
|
|
background-color: $divider_color;
|
2020-07-15 00:35:03 +08:00
|
|
|
border-color: transparent;
|
2020-12-30 19:51:58 +08:00
|
|
|
box-shadow: none;
|
2020-07-15 00:35:03 +08:00
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
@if $t == flat-active {
|
2021-04-13 20:33:10 +08:00
|
|
|
color: $tc;
|
2020-12-28 20:28:16 +08:00
|
|
|
background-color: $track_color;
|
2020-07-15 00:35:03 +08:00
|
|
|
border-color: transparent;
|
2020-12-30 19:51:58 +08:00
|
|
|
box-shadow: none;
|
2020-07-15 00:35:03 +08:00
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
|
|
|
}
|
|
|
|
|
2024-03-31 02:47:02 +08:00
|
|
|
@if $t == flat-checked {
|
|
|
|
color: $tc;
|
|
|
|
background-color: $divider_color;
|
|
|
|
border-color: transparent;
|
|
|
|
box-shadow: none;
|
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
|
|
|
}
|
|
|
|
|
2020-07-15 00:35:03 +08:00
|
|
|
@if $t == flat-insensitive {
|
2021-04-13 20:33:10 +08:00
|
|
|
color: if($tc == $fg_color, $disabled_fg_color, $tc);
|
2020-07-15 00:35:03 +08:00
|
|
|
background-color: transparent;
|
|
|
|
border-color: transparent;
|
2020-12-30 19:51:58 +08:00
|
|
|
box-shadow: none;
|
2020-07-15 00:35:03 +08:00
|
|
|
text-shadow: none;
|
|
|
|
icon-shadow: none;
|
|
|
|
}
|
|
|
|
}
|