Bryntum Color system
Bryntum CSS includes a basic color system used throughout the UI. It is based on CSS variables and can be easily customized to fit your design. It consists of three major parts:
- A set of colors
- Two main color scales
- Two "utility" color scales used for border colors and text colors
Color set
Bryntum CSS defines a set of colors as CSS variables. These are used throughout the UI for various purposes, but can also be used directly in your own CSS for consistent coloring. The colors are:
--b-color-red--b-color-pink--b-color-magenta--b-color-purple--b-color-violet--b-color-deep-purple--b-color-indigo--b-color-blue--b-color-light-blue--b-color-cyan--b-color-teal--b-color-green--b-color-light-green--b-color-lime--b-color-yellow--b-color-amber--b-color-orange--b-color-deep-orange--b-color-brown--b-color-lighter-gray--b-color-light-gray--b-color-gray--b-color-blackYou can easily override a color you want to change in your own CSS:
:root {
--b-color-blue : #123456;
}
Main color scales
Starting from v7, Bryntum CSS includes two main color scales that are used throughout the refreshed UI:
- A neutral color scale for backgrounds, borders, text and similar -
--b-neutral-xx - A primary color scale for highlights, accents and similar -
--b-primary-xx
Both scales range from --b-*-0 to --b-*-100, in steps of 5 with more steps (in 1) towards the higher extreme. In a
light theme, 0 will be the darkest color and 100 the lightest, while in a dark theme it is the opposite.
Neutral color scale
These squares show the neutral color scale in the theme currently used in this documentation (you can flip between light and dark themes using the button in the top right corner):
--b-neutral-0--b-neutral-1--b-neutral-2--b-neutral-5--b-neutral-10--b-neutral-15--b-neutral-20--b-neutral-25--b-neutral-30--b-neutral-35--b-neutral-40--b-neutral-45--b-neutral-50--b-neutral-55--b-neutral-60--b-neutral-65--b-neutral-70--b-neutral-75--b-neutral-80--b-neutral-85--b-neutral-90--b-neutral-91--b-neutral-92--b-neutral-93--b-neutral-94--b-neutral-95--b-neutral-96--b-neutral-97--b-neutral-98--b-neutral-99--b-neutral-100The neutral color scale is "hard coded" for performance reasons, it is defined something like this (depending on theme):
:root {
--b-neutral-100 : hsl(0 0 100%);
--b-neutral-99 : hsl(0 0 99%);
--b-neutral-98 : hsl(0 0 98%);
...
}
The scale can be overridden by changing the values of the variables (see the source for any dark theme).
Primary color scale
And this is the primary color scale (using the primary color used here in the documentation):
--b-primary-0--b-primary-1--b-primary-2--b-primary-5--b-primary-10--b-primary-15--b-primary-20--b-primary-25--b-primary-30--b-primary-35--b-primary-40--b-primary-45--b-primary-50--b-primary-55--b-primary-60--b-primary-65--b-primary-70--b-primary-75--b-primary-80--b-primary-85--b-primary-90--b-primary-91--b-primary-92--b-primary-93--b-primary-94--b-primary-95--b-primary-96--b-primary-97--b-primary-98--b-primary-99--b-primary-100This scale uses the color-mix() CSS function to dynamically create the scale steps based on the primary color used
(can be any color you want). To specify which primary color to use, set the --b-primary variable where you want it to
apply from (it will cascade):
/* Make all buttons use Bryntum orange as their primary color */
.b-button {
--b-primary : var(--b-color-orange);
}
These boxes show the same scale as above, but with the primary color changed to --b-color-orange:
--b-primary-0--b-primary-1--b-primary-2--b-primary-5--b-primary-10--b-primary-15--b-primary-20--b-primary-25--b-primary-30--b-primary-35--b-primary-40--b-primary-45--b-primary-50--b-primary-55--b-primary-60--b-primary-65--b-primary-70--b-primary-75--b-primary-80--b-primary-85--b-primary-90--b-primary-91--b-primary-92--b-primary-93--b-primary-94--b-primary-95--b-primary-96--b-primary-97--b-primary-98--b-primary-99--b-primary-100Explainer for a color-mix quirk
Because of how color-mix() works, the scale has to be defined where it is used. Consider this example:
<body>
<style>
:root {
--color : red;
--mixed-color : color-mix(in srgb, var(--color), #fff 50%);
}
</style>
<div style="background: var(--mixed-color)"></div>
<div style="--color: blue; background: var(--mixed-color)"></div>
</body>
In the example, although counter-intuitive, both divs will have the same (pale red) background color, because
--mixed-color is defined in :root where --color is red. To make the second div blue, we need to define
--mixed-color there:
<body>
<style>
:root {
--color : red;
--mixed-color : color-mix(in srgb, var(--color), #fff 50%);
}
</style>
<div style="background: var(--mixed-color)"></div>
<div style="--color: blue; --mixed-color: color-mix(in srgb, var(--color), #fff 50%); background: var(--mixed-color)"></div>
</body>
A bit unfortunate, but that is how CSS variables and color-mix() works. To work around this, we define the color mixes
in a .b-colorize class, that you can use to wrap any element where you want to use a different primary color:
<div class="b-colorize" style="--b-primary: red">
<div style="background: var(--b-primary-50)"></div>
<div style="background: var(--b-primary-80)"></div>
</div>
These boxes use a lime primary color, but are not wrapped in a .b-colorize:
These are wrapped:
Utility color scales
To keep text colors and border colors consistent, Bryntum CSS includes two utility color scales:
- A text color scale -
--b-text-xx - A border color scale -
--b-border-xx
Both scales use a limited set of steps, taken from the neutral color scale.
Text color scale
These lines show the text color scale, which ranges from --b-text-1 (most prominent text) to --b-text-5 (least
prominent text):
--b-text-1--b-text-2--b-text-3--b-text-4--b-text-5Border color scale
These boxes show the border color scale, which ranges from --b-border-1 (most prominent borders) to --b-border-10
(least prominent borders):
--b-border-1--b-border-2--b-border-3--b-border-4--b-border-5--b-border-6--b-border-7--b-border-8--b-border-9--b-border-10