Skip to main content

Variables

cm-admin's SCSS variables for colours, typography, radii and spacing, defined in helpers/_variable.scss.

:::warning Important Always use variables in the codebase. If a color is missing from the variables, find an appropriate name and add it to _variable.scss before using it. Never use hex codes directly in SCSS files. :::

Import variables in your SCSS files:

@import "../helpers/index.scss";

Colour variables​

VariableValueUsage
$brand-color#6554e0Primary brand colour
$brand-hover-color#e6e4faBrand hover state
$sidebar-bg-color#252525Sidebar background
$sidebar-item-hover-color#ffffff1aSidebar item hover
$nested-section-color#f2f3f5Nested section backgrounds

Semantic colours​

VariableValueUsage
$informative-clr#2f80edInfo states
$error-clr#f83636Error states
$warning-clr#ffc845Warning states
$positive-clr#30c39eSuccess states
$disabled-clr#9ca7aeDisabled states

Colour scales​

Each colour has a regular / light / lightest variant:

$blue-regular-clr: #2f80ed;
$blue-light-clr: #cde1fb;
$blue-lightest-clr: #eef5fe;
$red-regular-clr: #f83636;
$red-light-clr: #fdcfcf;
$red-lightest-clr: #feefef;
$yellow-regular-clr: #ffc845;
$yellow-light-clr: #ffefc7;
$yellow-lightest-clr: #fff8e9;
$green-regular-clr: #30c39e;
$green-light-clr: #c1ede2;
$green-lightest-clr: #eefaf7;
$grey-regular-clr: #c7ced5;
$grey-light-clr: #d9dee3;
$grey-lighter-clr: #f3f4f6;
$grey-lightest-clr: #f8f9fa;

Plus purpose-specific greys:

$grey-dark-clr: #828282; // dark grey accents
$subtle-border-clr: #94979b; // subtle borders
$card-grey-lighter-clr: #f3f4f6; // card backgrounds
$dropdown-border-clr: #e0e0e0; // dropdown borders
$btn-group-border-clr: #dee2e6; // button group borders

Ink (text) colours​

$ink-regular-clr: #212529; // primary text
$ink-light-clr: #3b4352; // secondary text
$ink-lighter-clr: #6b7586; // muted text
$ink-lightest-clr: #9ca7ae; // placeholder text
$ink-secondary-clr: #6c757d; // Bootstrap-muted equivalent
$primary-text-clr: #212529;
$subdued-text-clr: #d9dee3;
$floating-label-color: rgb(33 37 41 / 65%);

Other colours​

$white: #fff;
$black: #000;

// Scrollbars
$scrollbar-track-clr: #f1f1f1;
$scrollbar-thumb-clr: #c1c1c1;
$scrollbar-thumb-hover-clr: #a8a8a8;

// Gradients and shadows
$gradient-one: linear-gradient(
270deg,
$grey-lighter-clr 81.75%,
rgb(243 244 246 / 0%) 100%
);
$cta-hover-gradient:
linear-gradient(0deg, rgb(0 0 0 / 24%), rgb(0 0 0 / 24%)), $brand-color;
$fixed-column-shadow-after: inset 12px 0 8px -8px rgb(5 5 5 / 6%);
note

The file also keeps Bootstrap 5 Sass values cm-admin still relies on ($primary, $gray-100…$gray-700, $red, $blue, $zindex-fixed, …) because Bootstrap 6's Sass variables are private to its module.

Typography variables​

$primary-font: "Open Sans", sans-serif;

// Named font sizes
$t1-text: 20px;
$t2-text: 18px;
$t3-text: 16px;
$t4-text: 14px;
$t5-text: 13px;
$t6-text: 12px;

// Numeric size map (px values)
$font-size: (
24: 24px,
20: 20px,
18: 18px,
16: 16px,
14: 14px,
12: 12px
);

// Named weights, read via the font-weight() function
$font-weight: (
"regular": 400,
"medium": 500,
"bold": 600,
"bolder": 900
);

Border radius variables​

$radius-0: 0;
$radius-1: 1px;
$radius-2: 2px;
$radius-3: 3px;
$radius-4: 4px;
$radius-5: 5px;
$radius-6: 6px;
$radius-8: 8px;
$circle: 50%;