92 lines
2.2 KiB
SCSS
92 lines
2.2 KiB
SCSS
|
@use "sass:map";
|
||
|
|
||
|
// BASE PALETTE
|
||
|
|
||
|
$palette: ("blue":#4e63c9, "violet":#ce4dcd, "purple":#7951c0, "red":#e33d22, "orange":#eb790a, "green":#75b82d, "skyblue":#42a0f3, "dark": #2D2D2D, "light":#eeeeec, "turquoise": #46bd9e, "yellow": #f6d32d, "brown":#986a44, "grey":#77767b);
|
||
|
|
||
|
$semantics: ("primary":"purple", "secondary":"blue", "warning":"orange", "danger":"red", "info":"skyblue", "success":"green");
|
||
|
|
||
|
$whiteness_value: 0.8;
|
||
|
|
||
|
// FUNCTIONS TO GET MORE EASILY COLORS
|
||
|
|
||
|
@function get-color($name) {
|
||
|
@if map-has-key($semantics, $name) {
|
||
|
@return map.get($palette, map.get($semantics, $name));
|
||
|
} @else {
|
||
|
@return map.get($palette, $name);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@function list-colors() {
|
||
|
$newmap: map.merge($palette, $semantics);
|
||
|
@return $newmap;
|
||
|
}
|
||
|
|
||
|
@function luminance($color) {
|
||
|
$c_red: red($color);
|
||
|
$c_grn: green($color);
|
||
|
$c_blu: blue($color);
|
||
|
|
||
|
$luminance: $c_red*0.299 + $c_grn*0.587 + $c_blu*0.114;
|
||
|
|
||
|
@return $luminance
|
||
|
}
|
||
|
|
||
|
$color-primary: get-color("primary");
|
||
|
$color-secondary: get-color("secondary");
|
||
|
$color-warning: get-color("warning");
|
||
|
$color-danger: get-color("danger");
|
||
|
$color-info: get-color("info");
|
||
|
$color-success: get-color("success");
|
||
|
|
||
|
$color-link: get-color("blue");
|
||
|
$color-selection: get-color("blue");
|
||
|
$color-mark: get-color("yellow");
|
||
|
|
||
|
@mixin text-color($text-color) {
|
||
|
color: $text-color;
|
||
|
}
|
||
|
|
||
|
@mixin background-color($background-color, $light-color, $dark-color) {
|
||
|
background-color: $background-color!important;
|
||
|
@if (luminance($background-color ) < 255 * $whiteness_value) {
|
||
|
color: $light-color;
|
||
|
} @else {
|
||
|
color: $dark-color;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.text {
|
||
|
@each $name, $color in list-colors() {
|
||
|
&-#{$name} { @include text-color(get-color($name)); }
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.bg {
|
||
|
@each $name, $color in list-colors() {
|
||
|
&-#{$name} { @include background-color(get-color($name), #FFF, #000); }
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Direct uses of colors
|
||
|
|
||
|
a, a:hover, a:active {
|
||
|
color: $color-link;
|
||
|
}
|
||
|
|
||
|
::selection {
|
||
|
@include background-color($color-selection, #FFF, #000);
|
||
|
}
|
||
|
::-moz-selection {
|
||
|
@include background-color($color-selection, #FFF, #000);
|
||
|
}
|
||
|
|
||
|
mark {
|
||
|
background-color: lighten($color-mark, 30%)
|
||
|
}
|
||
|
|
||
|
blockquote, pre {
|
||
|
border-color: $color-primary;
|
||
|
}
|