Color variables
220 customizable CSS variable tokens for 20 different primary color palettes.
Overview (anchor)
The color palettes are all optional, the default colors can be customized to suit project parameters as required. The variable tokens are used for the color utilities and color modifiers so are required if any of the options are also included.
Colors (anchor)
The examples use the background color utilities which include the text colors shown below.
Using the module (anchor)
To use the module load the StyleMods scss directory as follows (changing the path to suit the source files location as required) then include the Sass mixin(s) as demonstrated below.
All colors (anchor)
All the color tokens can be included as top level variables using either a :where(html) or :root pseudo-class wrapper style as preferred:
@use "stylemods/scss" as *;
:where(html) {
@include all-primary-colors-variables;
}They can also be included already contained within a :where(html) pseudo-class wrapper style that if preferred can customized to use :root or another selector as described further below.
@use "stylemods/scss" as *;
@include all-primary-colors-variables-css;Individual colors (anchor)
All the color token palettes can included individually using your preferred wrapper style:
@use "stylemods/scss" as *;
:where(html) {
@include blue-variables;
@include red-variables;
@include green-variables;
@include orange-variables;
@include cyan-variables;
@include yellow-variables;
@include purple-variables;
@include pink-variables;
@include steelblue-variables;
@include firebrick-variables;
@include seagreen-variables;
@include darkcoral-variables;
@include cadetsteel-variables;
@include lemon-variables;
@include rebeccapurple-variables;
@include rosypink-variables;
@include tan-variables;
@include olive-variables;
@include rosewood-variables;
@include gray-variables;
}Each palette can also be included already contained within individual :where(html) pseudo-class wrapper styles, which if preferred can also be customized to your preferred method as described under token styles on the customizing page.
@use "stylemods/scss" as *;
@include blue-variables-css;
@include red-variables-css;
@include green-variables-css;
@include orange-variables-css;
@include cyan-variables-css;
@include yellow-variables-css;
@include purple-variables-css;
@include pink-variables-css;
@include steelblue-variables-css;
@include firebrick-variables-css;
@include seagreen-variables-css;
@include darkcoral-variables-css;
@include cadetsteel-variables-css;
@include lemon-variables-css;
@include rebeccapurple-variables-css;
@include rosypink-variables-css;
@include tan-variables-css;
@include olive-variables-css;
@include rosewood-variables-css;
@include gray-variables-css;Using the framework (anchor)
Using the recommended custom setup enable the styles in an overrides document:
@use "stylemods/scss/configuration" as *;
$enable-blue-variables: true;
$enable-red-variables: true;
$enable-green-variables: true;
$enable-orange-variables: true;
$enable-cyan-variables: true;
$enable-yellow-variables: true;
$enable-purple-variables: true;
$enable-pink-variables: true;
$enable-steelblue-variables: true;
$enable-firebrick-variables: true;
$enable-seagreen-variables: true;
$enable-darkcoral-variables: true;
$enable-cadetsteel-variables: true;
$enable-lemon-variables: true;
$enable-rebeccapurple-variables: true;
$enable-rosypink-variables: true;
$enable-olive-variables: true;
$enable-tan-variables: true;
$enable-rosewood-variables: true;
$enable-gray-variables: true;Include the overrides and the framework styles with your custom document for compiling the framework:
@use "overrides";
@use "stylemods/scss/stylemods";See using the framework for more information including how the styles can also be compiled within cascade layers.
Source code (anchor)
Update v1.3.4 The new 'color/mixins' folder includes the mixins for compiling the variables, utilities and modifiers.
Both the modules and framework options use the same methods for customizing the colors, each palette includes two documents for compiling the styles, for practical purposes only the blue colors source code is demonstrated below but all primary colors use the same configuration.
The color values for the variable tokens and the optional color utilities and color modifiers are included in the properties document for each color, the mixins for compiling the variables and styles are included separately:
blue.scss
// ----------------------------------------------------------
// Blue
// ----------------------------------------------------------
$blue: #005ce6 !default;
$blue-1: color-mix(in srgb, var(--blue) 28%, #fff) !default;
$blue-2: color-mix(in srgb, var(--blue) 41%, #fff) !default;
$blue-3: color-mix(in srgb, var(--blue) 58%, #fff) !default;
$blue-4: color-mix(in srgb, var(--blue) 72%, #fff) !default;
$blue-5: color-mix(in srgb, var(--blue) 87%, #fff) !default;
$blue-6: var(--blue) !default;
$blue-7: color-mix(in srgb, var(--blue) 85%, #000) !default;
$blue-8: color-mix(in srgb, var(--blue) 72%, #000) !default;
$blue-9: color-mix(in srgb, var(--blue) 60%, #000) !default;
$blue-10: color-mix(in srgb, var(--blue) 50%, #000) !default;
$blue-11: color-mix(in srgb, var(--blue) 44%, #000) !default;
$blue-tokens: ':where(html)' !default;
$blue-bg-text: #fff !default;
$blue-bg: var(--blue) !default;
$blue-bg-dark: var(--blue-7) !default;
$blue-bg-light: var(--blue-5) !default;
$blue-gradient: linear-gradient(180deg, $blue-bg-light, $blue-bg, $blue-bg-dark) !default;
$blue-color-values:
"blue" $blue #fff,
"blue-1" $blue-1 #000,
"blue-2" $blue-2 #000,
"blue-3" $blue-3 #000,
"blue-4" $blue-4 #000,
"blue-5" $blue-5 #fff,
"blue-6" $blue-6 #fff,
"blue-7" $blue-7 #fff,
"blue-8" $blue-8 #fff,
"blue-9" $blue-9 #fff,
"blue-10" $blue-10 #fff,
"blue-11" $blue-11 #fff,
!default;mixins/blue.scss
// ----------------------------------------------------------
// Blue mixins
// ----------------------------------------------------------
@use "modifiers" as *;
@use "../blue" as *;
// ----------------------------------------------------------
// Variables
// ----------------------------------------------------------
@mixin blue-variables {
@each $name, $color in $blue-color-values {
--#{$name}: #{$color};
}
}
@mixin blue-variables-css {
#{$blue-tokens} {
@include blue-variables;
}
}
// ----------------------------------------------------------
// Utilities
// ----------------------------------------------------------
@mixin backgrounds-blue-css {
@each $name, $color, $text in $blue-color-values {
.bg-#{$name} {
color: $text;
background-color: var(--#{$name});
}
}
}
@mixin borders-blue-css {
@each $name, $color in $blue-color-values {
.bd-#{$name} {
border-color: var(--#{$name});
}
}
}
@mixin gradient-blue-css {
.gradient-blue {
color: $blue-bg-text;
background-image: $blue-gradient;
}
}
@mixin text-blue-css {
@each $name, $color in $blue-color-values {
.text-#{$name} {
color: var(--#{$name});
}
}
}
// ----------------------------------------------------------
// Icons modifiers
// ----------------------------------------------------------
@mixin icons-blue-css {
@each $name, $color in $blue-color-values {
.ico-#{$name} {
--ico: var(--#{$name});
}
}
}
// ----------------------------------------------------------
// Component modifiers
// ----------------------------------------------------------
@mixin accordion-blue-css {
.accordion-blue {
@include accordion-color-values($blue-bg-text, $blue-bg, $blue-bg-dark, $blue-bg-light);
}
}
@mixin alert-blue-css {
.alert-blue {
@include alert-color-values($blue-bg-text, $blue-bg, $blue-bg-light);
}
}
@mixin badge-blue-css {
.badge-blue {
@include badge-color-values($blue-bg-text, $blue-bg, $blue-bg-light);
}
}
@mixin button-blue-css {
.btn-blue {
@include button-color-values($blue-bg-text, $blue-bg, $blue-bg-dark, $blue-bg-light, $blue-bg-light);
}
}
@mixin card-blue-css {
.card-blue {
@include card-color-values($blue-bg-text, $blue-bg, $blue-bg-dark, $blue-bg-light, $blue-bg-light);
}
}
@mixin dialog-blue-css {
.dialog-blue {
@include dialog-color-values($blue-bg-text, $blue-bg, $blue-bg-light);
}
}
@mixin dropdown-blue-css {
.dropdown-blue {
@include dropdown-color-values($blue-bg-text, $blue-bg, $blue-bg-dark, $blue-bg-light, $blue-bg-light);
}
}
@mixin list-group-blue-css {
.list-group-blue {
@include list-group-color-values($blue-bg-text, $blue-bg, $blue-bg-dark, $blue-bg-light);
}
}
@mixin popover-blue-css {
.popover-blue {
@include popover-color-values($blue-bg-text, $blue-bg, $blue-bg-light);
}
}
// ----------------------------------------------------------
// Combined mixins
// ----------------------------------------------------------
@mixin blue-utilities-css {
@include backgrounds-blue-css;
@include borders-blue-css;
@include gradient-blue-css;
@include text-blue-css;
}
@mixin blue-modifiers-css {
@include icons-blue-css;
@include accordion-blue-css;
@include alert-blue-css;
@include badge-blue-css;
@include button-blue-css;
@include card-blue-css;
@include dialog-blue-css;
@include dropdown-blue-css;
@include list-group-blue-css;
@include popover-blue-css;
}
@mixin blue-module-css {
@include blue-variables-css;
@include blue-utilities-css;
@include blue-modifiers-css;
}To view the source code for all the colors please see the color directory of the StyleMods repository.