discourse/app/assets/stylesheets/common/foundation/variables.scss

84 lines
2.5 KiB
SCSS
Raw Normal View History

2013-02-06 03:16:51 +08:00
// --------------------------------------------------
// Variables used throughout the theme
// --------------------------------------------------
// Layout dimensions
// --------------------------------------------------
$small-width: 800px !default;
$medium-width: 995px !default;
$large-width: 1110px !default;
2014-05-07 11:53:04 +08:00
// Brand color variables
// --------------------------------------------------
$google: #5b76f7 !default;
$facebook: #3b5998 !default;
$cas: #70BA61 !default;
$twitter: #00bced !default;
$yahoo: #810293 !default;
$github: #6d6d6d !default;
2014-03-27 09:16:41 +08:00
// Fonts
2013-02-06 03:16:51 +08:00
// --------------------------------------------------
2014-12-16 22:24:15 +08:00
$base-font-size: 14px !default;
$base-line-height: 19px !default;
2014-04-07 08:06:55 +08:00
$base-font-family: Helvetica, Arial, sans-serif !default;
2013-02-06 03:16:51 +08:00
/* These files don't actually exist. They're injected by DiscourseSassImporter. */
@import "theme_variables";
@import "plugins_variables";
@import "common/foundation/math";
// Color Utilities
// w3c definition of color brightness
2014-08-06 21:31:13 +08:00
@function brightness($color) {
@return ((red($color) * .299) + (green($color) * .587) + (blue($color) * .114));
2014-08-06 21:31:13 +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) {
$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%)
@function choose-grey($percent) {
@return srgb-scale($primary, $secondary, $percent);
}
@function choose-gray($percent) {
@return choose-grey($percent);
}
2014-08-06 21:31:13 +08:00
@function dark-light-diff($adjusted-color, $comparison-color, $lightness, $darkness) {
@if brightness($adjusted-color) < brightness($comparison-color) {
@return scale-color($adjusted-color, $lightness: $lightness);
2014-08-06 21:31:13 +08:00
} @else {
@return scale-color($adjusted-color, $lightness: $darkness);
2014-08-06 21:31:13 +08:00
}
}
@function dark-light-choose($light-theme-result, $dark-theme-result) {
@if brightness($primary) < brightness($secondary) {
@return $light-theme-result;
} @else {
@return $dark-theme-result;
}
}