Colors
Overview
Quick Start
Color System Architecture
1. Base Color Foundation (_variables.base.scss)
_variables.base.scss)// Brand colours can be extended
$ct-colors-brands: () !default;
// Default colour palette can be overridden
$ct-colors: () !default;
// Default semantic colour mapping
$ct-colors-default: (
'light': (
'heading': ct-color-shade(ct-color-constant-light('brand1'), 60),
'body': ct-color-tint(ct-color-shade(ct-color-constant-light('brand1'), 80), 20),
'background-light': ct-color-tint(ct-color-constant-light('brand2'), 90),
'background': ct-color-constant-light('brand2'),
'interaction-background': ct-color-constant-light('brand1'),
'interaction-text': ct-color-tint(ct-color-constant-light('brand2'), 80),
// ... more semantic colours
),
'dark': (
'heading': ct-color-tint(ct-color-constant-dark('brand1'), 95),
'body': ct-color-tint(ct-color-constant-dark('brand1'), 85),
'background': ct-color-constant-dark('brand2'),
'interaction-background': ct-color-constant-dark('brand1'),
'interaction-text': ct-color-constant-dark('brand2'),
// ... more semantic colours
)
);2. Component-Specific Variables (_variables.components.scss)
_variables.components.scss)How New Color Palettes Are Mapped
Step 1: Define Brand Colours (Optional)
Step 2: Override Default Colours (Optional)
Step 3: Component Variables Automatically Update
How Light and Dark Theme Colours Are Applied
The ct-component-theme Mixin
ct-component-theme MixinComponent Implementation Pattern
CSS Custom Properties Generation
Colour Function Resolution
Variable Naming Convention
Practical Example: Creating a Custom Tag Variant
Benefits of This System
Key Files
Next Steps
Last updated
Was this helpful?