2013-02-06 03:16:51 +08:00
|
|
|
// --------------------------------------------------
|
|
|
|
// Variables used throughout the theme
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
2014-02-10 14:04:21 +08:00
|
|
|
// Layout dimensions
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
2014-07-10 07:56:35 +08:00
|
|
|
$small-width: 800px !default;
|
2014-02-10 14:04:21 +08:00
|
|
|
$medium-width: 995px !default;
|
|
|
|
$large-width: 1110px !default;
|
|
|
|
|
2018-04-19 23:36:09 +08:00
|
|
|
$input-padding: 4px 10px;
|
2019-02-07 00:37:18 +08:00
|
|
|
$topic-body-width: 690px;
|
|
|
|
$topic-body-width-padding: 11px;
|
|
|
|
$topic-avatar-width: 45px;
|
2020-09-11 01:29:14 +08:00
|
|
|
$reply-area-max-width: 1475px !default;
|
2018-04-19 23:36:09 +08:00
|
|
|
|
2014-05-07 11:53:04 +08:00
|
|
|
// Brand color variables
|
2014-02-10 14:04:21 +08:00
|
|
|
// --------------------------------------------------
|
|
|
|
|
2018-10-25 10:11:19 +08:00
|
|
|
$google: #ffffff !default;
|
2020-07-29 06:21:53 +08:00
|
|
|
$google-hover: darken($google, 5%) !default;
|
2019-03-16 05:20:52 +08:00
|
|
|
$instagram: #e1306c !default;
|
2020-07-29 06:21:53 +08:00
|
|
|
$instagram-hover: darken($instagram, 15%) !default;
|
2021-02-11 04:53:18 +08:00
|
|
|
$facebook: #1877f2 !default;
|
2020-07-29 06:21:53 +08:00
|
|
|
$facebook-hover: darken($facebook, 15%) !default;
|
2018-06-08 17:49:31 +08:00
|
|
|
$cas: #70ba61 !default;
|
2019-03-16 05:20:52 +08:00
|
|
|
$twitter: #1da1f2 !default;
|
2020-07-29 06:21:53 +08:00
|
|
|
$twitter-hover: darken($twitter, 10%) !default;
|
2019-03-16 05:20:52 +08:00
|
|
|
$github: #100e0f !default;
|
2020-07-29 06:21:53 +08:00
|
|
|
$github-hover: lighten($github, 20%) !default;
|
2019-08-30 17:54:19 +08:00
|
|
|
$discord: #7289da !default;
|
2020-07-29 06:21:53 +08:00
|
|
|
$discord-hover: darken($discord, 10%) !default;
|
2014-02-10 14:04:21 +08:00
|
|
|
|
2018-05-24 04:55:57 +08:00
|
|
|
// Badge color variables
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
|
|
|
$gold: rgb(231, 195, 0) !default;
|
|
|
|
$silver: #c0c0c0 !default;
|
|
|
|
$bronze: #cd7f32 !default;
|
|
|
|
|
2014-03-27 09:16:41 +08:00
|
|
|
// Fonts
|
2013-02-06 03:16:51 +08:00
|
|
|
// --------------------------------------------------
|
|
|
|
|
2020-07-08 01:08:19 +08:00
|
|
|
$base-font-size-smallest: 0.815em !default; // eq. to 13px
|
2020-05-27 06:48:35 +08:00
|
|
|
$base-font-size-smaller: 0.875em !default; // eq. to 14px
|
|
|
|
$base-font-size: 0.938em !default; // eq. to 15px
|
|
|
|
$base-font-size-larger: 1.063em !default; // eq. to 17px
|
|
|
|
$base-font-size-largest: 1.118em !default; // eq. to 19px
|
2020-08-31 18:14:09 +08:00
|
|
|
$base-font-family: var(--font-family) !default;
|
2020-10-06 01:40:41 +08:00
|
|
|
$heading-font-family: var(--heading-font-family) !default;
|
2013-02-06 03:16:51 +08:00
|
|
|
|
2018-03-30 12:40:55 +08:00
|
|
|
// Font-size defintions, multiplier ^ (step / interval)
|
2021-04-17 03:58:16 +08:00
|
|
|
$font-up-6: 2.296em !default;
|
|
|
|
$font-up-5: 2em !default;
|
|
|
|
$font-up-4: 1.7511em !default;
|
|
|
|
$font-up-3: 1.5157em !default;
|
|
|
|
$font-up-2: 1.3195em !default;
|
|
|
|
$font-up-1: 1.1487em !default; // 2^(1/5)
|
2018-01-13 06:27:38 +08:00
|
|
|
$font-0: 1em;
|
2021-04-17 03:58:16 +08:00
|
|
|
$font-down-1: 0.8706em !default; // 2^(-1/5)
|
|
|
|
$font-down-2: 0.7579em !default; // Smallest size we use based on the 1em base
|
|
|
|
$font-down-3: 0.6599em !default;
|
|
|
|
$font-down-4: 0.5745em !default;
|
|
|
|
$font-down-5: 0.5em !default;
|
|
|
|
$font-down-6: 0.4355em !default;
|
2018-01-13 06:27:38 +08:00
|
|
|
|
2019-05-07 22:44:43 +08:00
|
|
|
// inputs/textareas in iOS need to be at least 16px to avoid triggering zoom on focus
|
|
|
|
// with base at 15px, the below gives 16.05px
|
2021-04-17 03:58:16 +08:00
|
|
|
$font-size-ios-input: 1.07em !default;
|
2019-05-07 22:44:43 +08:00
|
|
|
|
2018-01-13 06:27:38 +08:00
|
|
|
// Common line-heights
|
2021-04-17 03:58:16 +08:00
|
|
|
$line-height-small: 1 !default;
|
|
|
|
$line-height-medium: 1.2 !default; // Headings or large text
|
|
|
|
$line-height-large: 1.4 !default; // Normal or small text
|
2018-01-13 06:27:38 +08:00
|
|
|
|
2015-08-21 04:10:54 +08:00
|
|
|
@import "common/foundation/math";
|
2014-05-19 13:17:59 +08:00
|
|
|
|
2018-01-17 08:05:12 +08:00
|
|
|
// Z-index
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
|
|
|
$z-layers: (
|
2018-06-08 17:49:31 +08:00
|
|
|
"max": 9999,
|
2018-01-17 08:05:12 +08:00
|
|
|
"modal": (
|
2018-06-08 17:49:31 +08:00
|
|
|
"tooltip": 1600,
|
|
|
|
"popover": 1500,
|
|
|
|
"dropdown": 1400,
|
|
|
|
"content": 1300,
|
|
|
|
"overlay": 1200,
|
2018-01-17 08:05:12 +08:00
|
|
|
),
|
2018-06-14 08:56:14 +08:00
|
|
|
"fullscreen": 1150,
|
2018-06-08 17:49:31 +08:00
|
|
|
"mobile-composer": 1100,
|
2019-04-16 03:25:40 +08:00
|
|
|
"ipad-header-nav": 1020,
|
2018-06-08 17:49:31 +08:00
|
|
|
"header": 1000,
|
2019-04-16 00:03:42 +08:00
|
|
|
"footer-nav": 900,
|
2018-06-08 17:49:31 +08:00
|
|
|
"tooltip": 600,
|
2018-01-17 08:05:12 +08:00
|
|
|
"composer": (
|
2018-06-08 17:49:31 +08:00
|
|
|
"dropdown": 700,
|
|
|
|
"tooltip": 600,
|
|
|
|
"popover": 500,
|
|
|
|
"content": 400,
|
2018-01-17 08:05:12 +08:00
|
|
|
),
|
2018-06-08 17:49:31 +08:00
|
|
|
"dropdown": 300,
|
|
|
|
"usercard": 200,
|
|
|
|
"timeline": 100,
|
|
|
|
"base": 1,
|
|
|
|
);
|
2018-01-17 08:05:12 +08:00
|
|
|
|
|
|
|
@function map-has-nested-keys($map, $keys...) {
|
|
|
|
@each $key in $keys {
|
|
|
|
@if not map-has-key($map, $key) {
|
|
|
|
@return false;
|
|
|
|
}
|
|
|
|
$map: map-get($map, $key);
|
|
|
|
}
|
|
|
|
@return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@function map-deep-get($map, $keys...) {
|
|
|
|
@each $key in $keys {
|
|
|
|
$map: map-get($map, $key);
|
|
|
|
}
|
|
|
|
@return $map;
|
|
|
|
}
|
|
|
|
|
|
|
|
@function z($layers...) {
|
|
|
|
@if not map-has-nested-keys($z-layers, $layers...) {
|
|
|
|
@warn "No layer defined for `#{inspect($layers...)}` in $z-layers map. Check variables.scss, property omitted.";
|
|
|
|
}
|
|
|
|
@return map-deep-get($z-layers, $layers...);
|
|
|
|
}
|
|
|
|
|
2018-02-21 01:18:20 +08:00
|
|
|
// Box-shadow
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
|
|
|
$box-shadow: (
|
2018-06-08 17:49:31 +08:00
|
|
|
"modal": 0 8px 60px rgba(0, 0, 0, 0.6),
|
|
|
|
"composer": 0 -1px 40px rgba(0, 0, 0, 0.12),
|
2019-03-29 03:13:53 +08:00
|
|
|
"menu-panel": 0 12px 12px rgba(0, 0, 0, 0.15),
|
2018-06-08 17:49:31 +08:00
|
|
|
"card": 0 4px 14px rgba(0, 0, 0, 0.15),
|
|
|
|
"dropdown": 0 2px 3px 0 rgba(0, 0, 0, 0.2),
|
|
|
|
"header": 0 2px 4px -1px rgba(0, 0, 0, 0.25),
|
2019-04-13 00:29:54 +08:00
|
|
|
"footer-nav": 0 0 2px 0 rgba(0, 0, 0, 0.25),
|
2018-06-08 17:49:31 +08:00
|
|
|
"kbd": (
|
|
|
|
0 2px 0 rgba(0, 0, 0, 0.2),
|
|
|
|
0 0 0 1px dark-light-choose(#fff, #000) inset,
|
|
|
|
),
|
2021-02-04 00:45:54 +08:00
|
|
|
"focus": 0 0 3px 0 $tertiary,
|
2018-02-21 01:18:20 +08:00
|
|
|
"focus-danger": 0 0 6px 0 $danger,
|
|
|
|
);
|
|
|
|
|
|
|
|
@function shadow($key) {
|
|
|
|
@return map-get($box-shadow, $key);
|
|
|
|
}
|
|
|
|
|
2018-01-13 06:27:38 +08:00
|
|
|
// Color utilities
|
|
|
|
// --------------------------------------------------
|
2015-08-21 03:54:07 +08:00
|
|
|
|
2017-08-26 02:09:00 +08:00
|
|
|
// w3c definition of color brightness https://www.w3.org/TR/AERT#color-contrast
|
|
|
|
@function dc-color-brightness($color) {
|
2018-06-08 17:49:31 +08:00
|
|
|
@return (
|
|
|
|
(red($color) * 0.299) + (green($color) * 0.587) + (blue($color) * 0.114)
|
|
|
|
);
|
2014-08-06 21:31:13 +08:00
|
|
|
}
|
|
|
|
|
2015-08-21 03:54:07 +08:00
|
|
|
// Uses an approximation of sRGB blending, GAMMA=2 instead of GAMMA=2.2
|
2015-08-21 04:31:00 +08:00
|
|
|
@function srgb-scale($foreground, $background, $percent) {
|
2015-08-21 03:54:07 +08:00
|
|
|
$ratio: ($percent / 100%);
|
|
|
|
$iratio: 1 - $ratio;
|
2015-08-21 04:31:00 +08:00
|
|
|
$f_r2: red($foreground) * red($foreground);
|
|
|
|
$f_g2: green($foreground) * green($foreground);
|
|
|
|
$f_b2: blue($foreground) * blue($foreground);
|
|
|
|
$b_r2: red($background) * red($background);
|
|
|
|
$b_g2: green($background) * green($background);
|
|
|
|
$b_b2: blue($background) * blue($background);
|
|
|
|
$r_r2: $f_r2 * $ratio + $b_r2 * $iratio;
|
|
|
|
$r_g2: $f_g2 * $ratio + $b_g2 * $iratio;
|
|
|
|
$r_b2: $f_b2 * $ratio + $b_b2 * $iratio;
|
|
|
|
$r_r: sqrt($r_r2);
|
|
|
|
$r_g: sqrt($r_g2);
|
|
|
|
$r_b: sqrt($r_b2);
|
|
|
|
@return rgb($r_r, $r_g, $r_b);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Replaces dark-light-diff($primary, $secondary, 50%, -50%)
|
2015-08-21 07:47:34 +08:00
|
|
|
@function blend-primary-secondary($percent) {
|
2015-08-21 04:31:00 +08:00
|
|
|
@return srgb-scale($primary, $secondary, $percent);
|
|
|
|
}
|
|
|
|
|
2020-12-16 22:38:51 +08:00
|
|
|
@function blend-header-primary-background($percent) {
|
|
|
|
@return srgb-scale($header_primary, $header_background, $percent);
|
|
|
|
}
|
|
|
|
|
2018-06-08 17:49:31 +08:00
|
|
|
@function dark-light-diff(
|
|
|
|
$adjusted-color,
|
|
|
|
$comparison-color,
|
|
|
|
$lightness,
|
|
|
|
$darkness
|
|
|
|
) {
|
|
|
|
@if dc-color-brightness($adjusted-color) <
|
|
|
|
dc-color-brightness($comparison-color)
|
|
|
|
{
|
2015-04-24 01:33:29 +08:00
|
|
|
@return scale-color($adjusted-color, $lightness: $lightness);
|
2014-08-06 21:31:13 +08:00
|
|
|
} @else {
|
2015-04-24 01:33:29 +08:00
|
|
|
@return scale-color($adjusted-color, $lightness: $darkness);
|
2014-08-06 21:31:13 +08:00
|
|
|
}
|
|
|
|
}
|
2015-08-19 03:23:06 +08:00
|
|
|
@function dark-light-choose($light-theme-result, $dark-theme-result) {
|
2019-11-26 22:06:30 +08:00
|
|
|
@if is-light-color-scheme() {
|
2015-08-19 03:23:06 +08:00
|
|
|
@return $light-theme-result;
|
|
|
|
} @else {
|
|
|
|
@return $dark-theme-result;
|
|
|
|
}
|
|
|
|
}
|
2017-06-12 10:20:14 +08:00
|
|
|
|
2019-11-26 22:06:30 +08:00
|
|
|
@function is-light-color-scheme() {
|
|
|
|
@if dc-color-brightness($primary) < dc-color-brightness($secondary) {
|
|
|
|
@return true;
|
|
|
|
} @else {
|
|
|
|
@return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@function is-dark-color-scheme() {
|
|
|
|
@return not is-light-color-scheme();
|
|
|
|
}
|
|
|
|
|
2019-08-12 18:02:38 +08:00
|
|
|
@import "color_transformations";
|