Branding & Themes
Customize colors and branding to match your company. Supports light mode, dark mode, and multi-brand setups.
Skill Details
Install this skill
Works with
Create and apply custom themes that extend SLDS 2 for branded Salesforce experiences. Build theme systems that support multiple brands and component-level overrides — all without breaking the design system. Light mode is the default; dark mode is an optional enhancement when explicitly requested.
Core Principles
--brand-primary, not --brand-blue):host level, not deep in component CSSTheme Architecture
┌─────────────────────────────────────────────┐ │ Brand Theme Layer (your custom tokens) │ --brand-*, --app-* ├─────────────────────────────────────────────┤ │ SLDS 2 Global Hooks (Salesforce) │ --slds-g-* ├─────────────────────────────────────────────┤ │ Component CSS (consumes both layers) │ var(--brand-primary, var(--slds-g-...)) └─────────────────────────────────────────────┘
Custom brand tokens sit above SLDS hooks. Components consume brand tokens first, falling back to SLDS hooks, then to literal values.
Brand Token System
Defining Brand Tokens
Define brand tokens at the :host level of your root/wrapper component:
: host {
/* Brand palette */
--brand-primary: #1a73e8;
--brand-primary-hover: #1557b0;
--brand-primary-contrast: #ffffff;
--brand-secondary: #34a853;
--brand-secondary-contrast: #ffffff;
/* Semantic tokens */
--brand-surface: var(--slds-g-color-surface-1, #ffffff);
--brand-surface-elevated: var(--slds-g-color-surface-1, #ffffff);
--brand-text: var(--slds-g-color-on-surface-1, #181818);
--brand-text-muted: var(--slds-g-color-on-surface-2, #444444);
--brand-border: var(--slds-g-color-border-1, #e5e5e5);
/* Spacing overrides (if brand has tighter/looser density) */
--brand-spacing-unit: var(--slds-g-spacing-4, 1rem);
--brand-radius: var(--slds-g-radius-border-2, 0.25rem);
}
Consuming Brand Tokens
.branded-card {
background: var(--brand-surface, var(--slds-g-color-surface-1, #ffffff));
border: var(--slds-g-sizing-border-1) solid var(--brand-border, var(--slds-g-color-border-1));
border-radius: var(--brand-radius, var(--slds-g-radius-border-2, 0.25rem));
}
.branded-button {
background: var(--brand-primary, var(--slds-g-color-accent-1, #0176d3));
color: var(--brand-primary-contrast, var(--slds-g-color-on-accent-1, #ffffff));
border-radius: var(--brand-radius, var(--slds-g-radius-border-2, 0.25rem));
}
.branded-button: hover {
background: var(--brand-primary-hover, var(--slds-g-color-accent-2, #014486));
}
Fallback Chain
Always use a three-level fallback:
var(--brand-token, var(--slds-g-token, literal-fallback))
This ensures the component works in:
Customer Branding in 5 Minutes
For SEs who need to quickly apply a prospect's brand colors to a demo.
Quick Brand Swap
class="code-comment">// brandConfig.js — single file to change for each demo
const DEMO_BRAND = {
name: class="code-string">'Customer Name',
primary: class="code-string">'#1a73e8', class="code-comment">// Pull from customerclass="code-string">'s website
primaryHover: '#1557b0class="code-string">', class="code-comment">// Darken primary by ~15%
primaryContrast: '#ffffffclass="code-string">',
secondary: '#34a853class="code-string">',
logo: '/resource/customerLogoclass="code-string">',
radius: '0.5rem' class="code-comment">// Rounded = modern, 0 = corporate
};
export default DEMO_BRAND;
Apply Brand from Config
import BRAND from class="code-string">'./brandConfig';
export default class BrandedApp extends LightningElement {
connectedCallback() {
const host = this.template.host;
host.style.setProperty(class="code-string">'--brand-primary', BRAND.primary);
host.style.setProperty(class="code-string">'--brand-primary-hover', BRAND.primaryHover);
host.style.setProperty(class="code-string">'--brand-primary-contrast', BRAND.primaryContrast);
host.style.setProperty(class="code-string">'--brand-secondary', BRAND.secondary);
host.style.setProperty(class="code-string">'--brand-radius', BRAND.radius);
}
get logoUrl() {
return BRAND.logo;
}
get customerName() {
return BRAND.name;
}
}
Extract Colors from Customer's Website
Quick steps to grab brand colors:
brandConfig.js with new valuesCommon Industry Brand Patterns
| Industry | Typical Style | Radius | Weight |
|---|---|---|---|
| Financial Services | Conservative, navy/dark blue | 0 or small | 500 (medium) |
| Healthcare | Clean, teal/green, lots of white | 0.25rem | 400 (regular) |
| Tech / SaaS | Modern, vibrant, gradients ok | 0.5rem+ | 600 (semi-bold) |
| Retail | Bold, colorful, high contrast | 0.25rem | 700 (bold) |
| Manufacturing | Industrial, muted, practical | 0 | 500 (medium) |
| Government | Minimal, accessible, conservative | 0 | 400 (regular) |
| Pair | Minimum Ratio | Standard | |
| Text on surface | 4.5:1 | WCAG AA normal text | |
| Large text on surface | 3:1 | WCAG AA large text | |
| Button text on button bg | 4.5:1 | WCAG AA | |
| Icon on surface | 3:1 | WCAG AA non-text | |
| Category | Points | Pass Criteria | |
| Token Architecture | 20 | Brand tokens above SLDS; three-level fallback chain | |
| Dark Mode (if requested) | 20 | When requested: dark variants defined, system preference detection, manual toggle. When not requested: light mode works correctly, no hardcoded colors that would break under dark theme. | |
| Contrast & Accessibility | 20 | All color pairs meet WCAG AA contrast ratios | |
| Multi-Context | 15 | Works in internal Lightning, Experience Cloud, and mobile | |
| Configurability | 15 | Brand selectable via App Builder; color picker for accents | |
| Naming & Semantics | 10 | Tokens named by purpose, not color; consistent naming | |
| Skill | Relationship | ||
| sf-lwc-design | Themes extend SLDS 2 hooks; never override them | ||
| sf-lwc-experience | DXP token integration for Experience Cloud sites | ||
| sf-lwc-styling | Utility classes consume brand tokens for branded patterns | ||
| sf-lwc-review | Audit checks theme contrast ratios and fallback chains | ||
| sf-se-demo-scripts | Quick brand swap enables personalized demos in minutes |
Navigate Look & Feel