Skip to content

forcedotcom/sf-skills / skills/design-systems-slds-apply

design-systems-slds-apply

Unverified

Apply SLDS-compliant UI using the correct blueprints, styling hooks, utility classes, and icons. Use when building any UI that needs SLDS, choosing between Lightning Base Components and SLDS Blueprints, applying styling hooks for theming, using utility classes for layout and spacing, or selecting icons. Triggers include "build a modal", "create a form", "data table", "SLDS styling", "style with hooks", "add an icon".

FileKindSize
SKILL.mdskill md14.6 KB
assets/README.mdmarkdown2.3 KB
assets/blueprints/components/accordion.yamlconfig15.0 KB
assets/blueprints/components/activity-timeline.yamlconfig3.8 KB
assets/blueprints/components/alert.yamlconfig4.4 KB
assets/blueprints/components/app-launcher.yamlconfig3.8 KB
assets/blueprints/components/avatar-group.yamlconfig3.2 KB
assets/blueprints/components/avatar.yamlconfig3.5 KB
assets/blueprints/components/badges.yamlconfig3.3 KB
assets/blueprints/components/brand-band.yamlconfig12.9 KB
assets/blueprints/components/breadcrumbs.yamlconfig4.0 KB
assets/blueprints/components/builder-header.yamlconfig10.1 KB
assets/blueprints/components/button-groups.yamlconfig3.1 KB
assets/blueprints/components/button-icons.yamlconfig12.9 KB
assets/blueprints/components/buttons.yamlconfig9.4 KB
assets/blueprints/components/cards.yamlconfig4.6 KB
assets/blueprints/components/carousel.yamlconfig6.0 KB
assets/blueprints/components/chat.yamlconfig9.7 KB
assets/blueprints/components/checkbox-button-group.yamlconfig8.3 KB
assets/blueprints/components/checkbox-button.yamlconfig13.8 KB
assets/blueprints/components/checkbox-toggle.yamlconfig7.7 KB
assets/blueprints/components/checkbox.yamlconfig4.4 KB
assets/blueprints/components/color-picker.yamlconfig8.5 KB
assets/blueprints/components/combobox.yamlconfig5.5 KB
assets/blueprints/components/counter.yamlconfig6.6 KB
assets/blueprints/components/data-tables.yamlconfig6.0 KB
assets/blueprints/components/datepickers.yamlconfig6.1 KB
assets/blueprints/components/datetime-picker.yamlconfig7.4 KB
assets/blueprints/components/docked-composer.yamlconfig13.3 KB
assets/blueprints/components/docked-form-footer.yamlconfig6.1 KB
assets/blueprints/components/docked-utility-bar.yamlconfig10.9 KB
assets/blueprints/components/drop-zone.yamlconfig4.5 KB
assets/blueprints/components/dueling-picklist.yamlconfig8.8 KB
assets/blueprints/components/dynamic-icons.yamlconfig5.0 KB
assets/blueprints/components/dynamic-menu.yamlconfig7.7 KB
assets/blueprints/components/expandable-section.yamlconfig4.6 KB
assets/blueprints/components/expression.yamlconfig7.3 KB
assets/blueprints/components/feeds.yamlconfig5.7 KB
assets/blueprints/components/file-selector.yamlconfig6.8 KB
assets/blueprints/components/files.yamlconfig4.8 KB
assets/blueprints/components/form-element.yamlconfig6.1 KB
assets/blueprints/components/global-header.yamlconfig4.7 KB
assets/blueprints/components/global-navigation.yamlconfig4.3 KB
assets/blueprints/components/icons.yamlconfig5.1 KB
assets/blueprints/components/illustration.yamlconfig8.5 KB
assets/blueprints/components/input.yamlconfig5.4 KB
assets/blueprints/components/list-builder.yamlconfig6.2 KB
assets/blueprints/components/lookups.yamlconfig5.8 KB
assets/blueprints/components/map.yamlconfig5.0 KB
assets/blueprints/components/menus.yamlconfig5.5 KB
assets/blueprints/components/modals.yamlconfig6.1 KB
assets/blueprints/components/notifications.yamlconfig3.1 KB
assets/blueprints/components/page-headers.yamlconfig6.0 KB
assets/blueprints/components/panels.yamlconfig6.8 KB
assets/blueprints/components/path.yamlconfig6.4 KB
assets/blueprints/components/picklist.yamlconfig5.2 KB
assets/blueprints/components/pills.yamlconfig5.9 KB
assets/blueprints/components/popovers.yamlconfig4.6 KB
assets/blueprints/components/progress-bar.yamlconfig4.4 KB
assets/blueprints/components/progress-indicator.yamlconfig5.6 KB
assets/blueprints/components/progress-ring.yamlconfig4.0 KB
assets/blueprints/components/prompt.yamlconfig5.5 KB
assets/blueprints/components/publishers.yamlconfig7.0 KB
assets/blueprints/components/radio-button-group.yamlconfig7.3 KB
assets/blueprints/components/radio-group.yamlconfig5.0 KB
assets/blueprints/components/rich-text-editor.yamlconfig6.0 KB
assets/blueprints/components/scoped-notifications.yamlconfig7.6 KB
assets/blueprints/components/scoped-tabs.yamlconfig3.7 KB
assets/blueprints/components/select.yamlconfig4.3 KB
assets/blueprints/components/setup-assistant.yamlconfig8.8 KB
assets/blueprints/components/slider.yamlconfig4.2 KB
assets/blueprints/components/spinners.yamlconfig5.4 KB
assets/blueprints/components/split-view.yamlconfig4.4 KB
assets/blueprints/components/summary-detail.yamlconfig4.1 KB
assets/blueprints/components/tabs.yamlconfig6.1 KB
assets/blueprints/components/textarea.yamlconfig4.6 KB
assets/blueprints/components/tiles.yamlconfig4.0 KB
assets/blueprints/components/timepicker.yamlconfig5.1 KB
assets/blueprints/components/toast.yamlconfig6.5 KB
assets/blueprints/components/tooltips.yamlconfig4.1 KB
assets/blueprints/components/tree-grid.yamlconfig4.9 KB
assets/blueprints/components/trees.yamlconfig4.8 KB
assets/blueprints/components/trial-bar.yamlconfig4.2 KB
assets/blueprints/components/vertical-navigation.yamlconfig5.2 KB
assets/blueprints/components/vertical-tabs.yamlconfig6.9 KB
assets/blueprints/components/visual-picker.yamlconfig6.8 KB
assets/blueprints/components/welcome-mat.yamlconfig5.5 KB
assets/hooks-index.jsonconfig141.1 KB
assets/icon-metadata.jsonconfig919.3 KB
assets/utilities-index.jsonconfig508.6 KB
references/README.mdmarkdown5.8 KB
references/blueprints-index.mdmarkdown9.0 KB
references/checklists.mdmarkdown3.8 KB
references/component-selection.mdmarkdown3.7 KB
references/examples.mdmarkdown8.1 KB
references/icons-decision-guide.mdmarkdown3.8 KB
references/icons-guidance.mdmarkdown6.2 KB
references/overviews/borders.mdmarkdown11.0 KB
references/overviews/color.mdmarkdown12.0 KB
references/overviews/display-density.mdmarkdown18.7 KB
references/overviews/icons.mdmarkdown9.3 KB
references/overviews/illustrations.mdmarkdown10.3 KB
references/overviews/shadows.mdmarkdown7.0 KB
references/overviews/spacing.mdmarkdown9.8 KB
references/overviews/typography.mdmarkdown14.8 KB
references/overviews/utilities.mdmarkdown23.9 KB
references/slds-development-guide.mdmarkdown8.8 KB
references/styling-decision-guide.mdmarkdown9.3 KB
references/styling-hooks/borders.mdmarkdown9.0 KB
references/styling-hooks/color/expressive-palette-hooks.mdmarkdown6.7 KB
references/styling-hooks/color/index.mdmarkdown6.5 KB
references/styling-hooks/color/semantic/accent-hooks.mdmarkdown9.9 KB
references/styling-hooks/color/semantic/feedback-hooks.mdmarkdown33.4 KB
references/styling-hooks/color/semantic/surface-hooks.mdmarkdown17.1 KB
references/styling-hooks/color/system-hooks.mdmarkdown5.8 KB
references/styling-hooks/index.mdmarkdown10.8 KB
references/styling-hooks/shadows.mdmarkdown8.3 KB
references/styling-hooks/spacing.mdmarkdown12.3 KB
references/styling-hooks/typography.mdmarkdown17.8 KB
references/utilities-quick-ref.mdmarkdown3.7 KB
references/utilities/alignment.mdmarkdown3.7 KB
references/utilities/borders.mdmarkdown4.0 KB
references/utilities/box.mdmarkdown4.3 KB
references/utilities/color.mdmarkdown7.7 KB
references/utilities/dark-mode.mdmarkdown3.5 KB
references/utilities/description-list.mdmarkdown5.5 KB
references/utilities/floats.mdmarkdown3.8 KB
references/utilities/grid.mdmarkdown9.7 KB
references/utilities/horizontal-list.mdmarkdown3.7 KB
references/utilities/hyphenation.mdmarkdown2.3 KB
references/utilities/index.mdmarkdown6.6 KB
references/utilities/interactions.mdmarkdown3.1 KB
references/utilities/layout.mdmarkdown3.6 KB
references/utilities/line-clamp.mdmarkdown4.3 KB
references/utilities/margin.mdmarkdown5.2 KB
references/utilities/media-object.mdmarkdown5.3 KB
references/utilities/name-value-list.mdmarkdown4.8 KB
references/utilities/padding.mdmarkdown5.3 KB
references/utilities/position.mdmarkdown5.9 KB
references/utilities/print.mdmarkdown3.0 KB
references/utilities/scrollable.mdmarkdown4.1 KB
references/utilities/sizing.mdmarkdown5.7 KB
references/utilities/themes.mdmarkdown4.0 KB
references/utilities/truncate.mdmarkdown3.7 KB
references/utilities/typography.mdmarkdown4.6 KB
references/utilities/vertical-list.mdmarkdown5.1 KB
references/utilities/visibility.mdmarkdown6.1 KB
scripts/search-blueprints.cjsscript3.6 KB
scripts/search-hooks.cjsscript4.4 KB
scripts/search-icons.cjsscript6.1 KB
scripts/search-utilities.cjsscript5.3 KB

references/overviews/color.md

View on GitHub
---
id: slds.guidance.overview.color
title: Color Overview
description: Foundational principles and constraints for all color decisions in SLDS
summary: "Comprehensive color guidance covering the 85-5-10 density rule, color role taxonomy, hook selection hierarchy, and numerical color system. The primary reference for all color implementation decisions."

artifact_type: overview
domain: overviews
topic: color

content_format: narrative
complexity: foundational
audience: [implementer, designer]

tasks: [learn, choose, implement]

refs:
  - slds.guidance.hooks.color.accent
  - slds.guidance.hooks.color.surface
  - slds.guidance.hooks.color.feedback
  - slds.guidance.hooks.color.system
  - slds.guidance.hooks.color.expressive-palette

tags: [color, semantic-color, accessibility, visual-hierarchy, theming]
keywords: [color roles, 85-5-10 rule, hook selection, semantic hooks, color taxonomy, surfaces, accents, feedback colors]
---

# Color Guidance for SLDS Implementation

**Purpose:** This document provides the foundational principles and constraints for all color-related decisions in Salesforce Lightning Design System. Always reference the companion metadata files for specific token names, contrast pairings, and approved combinations.

---

## Core Principles

When working with colors in UI interfaces, adhere to these three foundational principles:

1. **Signal hierarchy and meaning.** Color must highlight actions, alerts, and key information without overpowering the experience. Do not use color decoratively.

2. **Accessibility is mandatory.** All implementations must meet WCAG 2.1 AA minimum standards for text and interactive elements. Use only the approved pairings documented in the metadata layer.

3. **Maintain system consistency.** Always use semantic styling hooks. These tokens automatically adapt to brand themes, density modes, and light/dark modes. Never use hard-coded color values.

---

## Color Role Taxonomy

Every element must be classified into one of these five color roles before selecting a token:

- **Surfaces:** The base canvas for content. Each new layer (panel, modal, popover) is a distinct surface with its own depth level. Use surface tokens for backgrounds.

- **Containers:** Elements that hold interactive or readable content (cards, buttons, tabsets). Always pair container background colors with their corresponding "on-container" tokens for text and icons.

- **Accents:** Colors that draw attention to primary interactions or selected states. Use sparingly and only for meaningful emphasis. Overuse destroys visual hierarchy.

- **Feedback colors:** Status indicators (error, warning, success, info, disabled). Reserve exclusively for CRUD operations and system feedback. Never use for general styling.

- **Borders/dividers:** Structural elements that create separation. Must maintain sufficient contrast with adjacent surfaces and containers.

---

## Color Density Rule (85-5-10)

**CONSTRAINT:** All UI implementations should maintain the following color distribution. This distribution is strongly recommended for maintaining SLDS visual consistency.

### UI Foundation: 85% (Required)
Foundational colors create the neutral canvas for all content. Use whites, light grays, dark grays, and dark blue for contrast with text and interactive elements.

**Allowed Palettes:** Whites, light grays, dark grays, dark blue  
**Usage:** Page backgrounds, surface layers, neutral containers, structural elements

### Accents: 5% (Required)
Accent colors are reserved for strategic emphasis on interactive elements. Use the foundational accent (electric blue) and feedback palettes (pink, yellow, teal, blue) to guide users toward task completion.

**Allowed Palettes:** Foundational accent (electric blue), feedback (pink, yellow, teal, blue), functional accent colors  
**Usage:** Primary actions, selected states, status indicators, critical CTAs

### Expressive Colors: 10% (Maximum)
Expressive palettes provide extended color options for data visualization and customized app experiences. Use with restraint.

**Allowed Palettes:** Green, Cloud Blue, Indigo, Purple, Violet, Red, Hot Orange, Orange  
**Usage:** Data charts, custom branding, visualization highlights, app-specific accents

**Strict Usage Rules:**
- **Cool tones first.** Prioritize Cloud Blue, Purple, Indigo, Violet for general page designs. These integrate better with the foundational palette.
- **Indigo warning.** Indigo resembles electric blue. Using it carelessly will break button hierarchy and confuse users about interactive affordances.
- **Warm = attention only.** Orange, Red, and Green signal importance or issues. Reserve them exclusively for drawing user attention to critical information.
- **Prevent feedback confusion.** Expressive colors can be misinterpreted as system feedback (pink=error, yellow=warning, teal=success, blue=info). Apply expressive colors minimally to avoid this conflict.

---

## The Numerical Color System

**System Architecture:** SLDS uses a 0-100 point scale where accessibility compliance is mathematically guaranteed:

- **100 points** = white
- **0 points** = black
- **Color lane** = full 0-100 spectrum of a single hue
- **Color step** = 5-10 point increments within a lane (e.g., Cloud Blue-15, Cloud Blue-25, Cloud Blue-35)

### How It Works

Colors share horizontal point values across different hues. This means the same mathematical rules apply:
- Vertically within each monochromatic palette (single lane)
- Horizontally across all color lanes (different hues)

This consistency enables pattern replication across the entire system.

### Automatic Accessibility: Magic Numbers

**CRITICAL:** Use these point separations to achieve WCAG compliance without manual checking:

| Separation | Contrast Ratio | Use Case | WCAG Level |
|------------|----------------|----------|------------|
| **50 points** | 4.5:1+ | Text on backgrounds, body copy | AA (required) |
| **40 points** | 3:1+ | UI elements, borders, non-text | AA (required) |

**Works across hues:** A 50-point separation maintains 4.5:1 contrast even when using different color lanes.

**Example Application:**
- Page background: Gray-95
- Button background: Any-50 (45 point difference = compliant)
- Button hover: Any-40 (55 point difference = compliant)
- Button text: Any-0 or Any-100 depending on background

The 10-point step from 50→40 creates consistent hover states across all color lanes.

**Attribution:** The "magic numbers" concept originates from the U.S. Web Design System (USWDS) and has been adopted into SLDS to ensure systematic color progression and accessibility.

---

## Implementation Workflow

Follow this mandatory sequence when implementing any color solution:

### Step 1: Classify the Element
Identify the element's semantic role:
- Is it a **surface** (background layer)?
- Is it a **container** (holds content)?
- Is it an **accent** (emphasis/interaction)?
- Is it **feedback** (status/state)?
- Is it a **border/divider** (structure)?

### Step 2: Reference the Metadata
Never invent color values. The companion metadata files contain:
- Approved styling hook names
- Pre-validated contrast pairings
- State transition sequences (default → hover → active → disabled)
- Theme adaptations (light/dark/branded)

### Step 3: Handle Exceptions
If no semantic hook matches the requirement:
1. Document why standard patterns don't apply
2. Verify contrast manually using the numerical system
3. Ensure brand consistency is maintained
4. Flag for design system team review

### Step 4: Validate Implementation
Before finalizing, verify the implementation using the Pre-Implementation Checklist below to ensure all color requirements are met.

---

## Metadata Integration

**Source of Truth:** The metadata files are authoritative for all implementation details.

**What the metadata provides:**
- Exact token names and values
- Pre-validated contrast pairings (text-on-background, icon-on-surface)
- State progression maps (default → hover → active → focus → disabled)
- Cross-reference between semantic roles and color values
- Theme-specific overrides

**When to consult metadata:**
- Before selecting any color token
- When implementing state changes
- When validating a custom pattern
- When introducing new component styles

**Validation question:** Does this color choice reinforce semantic meaning, meet accessibility standards, and maintain brand consistency?

---

## Hook Selection Hierarchy

When selecting color hooks, follow this decision order:

### 1. Semantic Hooks (First Choice — 85% of Cases)
**Pattern:** `--slds-g-color-{purpose}-{n}` (e.g., `error-1`, `accent-container-1`, `surface-1`)

Use semantic hooks for standard UI patterns. These hooks:
- Are purpose-built for specific UI use cases (errors, accents, surfaces, feedback)
- Automatically adapt to light/dark mode with curated values
- Have pre-validated accessibility pairings
- Reference system and palette hooks underneath

**Use when:** You can describe your element using semantic terms (surface, accent, error, warning, success, disabled).

### 2. System Hooks (Edge Cases — 5-10% of Cases)
**Pattern:** `--slds-g-color-{category}-base-{grade}` (e.g., `error-base-50`, `brand-base-40`)

Use system hooks when semantic hooks don't cover your specific need. These hooks:
- Provide grade-level control within a color category
- Still adapt to light/dark mode with curated values per mode
- Reference palette hooks underneath

**Use when:** Data visualization, legacy migration, or custom requirements where semantic hooks are insufficient.

### 3. Palette Hooks (Raw Access — Rare Cases)
**Pattern:** `--slds-g-color-palette-{color}-{grade}` (e.g., `palette-pink-50`, `palette-cloud-blue-30`)

Use palette hooks only when system hooks don't meet your requirements. These hooks:
- Provide direct access to the color palette by color name and grade
- Have light/dark mode variants
- Are the foundation that semantic and system hooks reference

**Use when:** Custom color requirements that don't fit any semantic or system category.

### Internal Hooks (Not for External Use)

The following hook prefixes are **internal to Salesforce** and should not be used by external developers:

| Prefix | Name | Audience |
|--------|------|----------|
| `--slds-s-*` | Shared hooks | Internal Salesforce only |
| `--slds-c-*` | Component hooks | Internal Salesforce only |

### How They Connect (Aliasing Chain)

Semantic hooks reference system hooks, which reference palette hooks. When the theme changes (light → dark), the underlying references change, so semantic hooks automatically adapt.

**Example:** `--slds-g-color-error-1`
- Light mode: → `error-base-50` → `palette-pink-50` → #hex
- Dark mode: → `error-base-40` → `palette-pink-40` → #different-hex

This aliasing chain means you get theme adaptation "for free" when using semantic hooks.

---

## Pre-Implementation Checklist

Before generating or modifying any color-related code, verify:

| Requirement | Status |
|-------------|--------|
| **Element Classification** | |
| Element classified by semantic role (surface/container/accent/feedback/border) | [ ] |
| **Token Selection & Metadata** | |
| Color token identified from metadata (no hard-coded hex/RGB values) | [ ] |
| Metadata consulted for approved styling hook names | [ ] |
| Pre-validated contrast pairings referenced from metadata | [ ] |
| "On" counterpart specified (for containers) | [ ] |
| **Contrast & Accessibility** | |
| Contrast requirements met using numerical system (50pts text, 40pts UI) | [ ] |
| Works with the numerical color system for automatic accessibility | [ ] |
| **Color Distribution & Usage** | |
| 85-5-10 density rule maintained (85% foundation, 5% accent, 10% expressive) | [ ] |
| Accent/feedback colors used sparingly and meaningfully | [ ] |
| Color reinforces semantic meaning rather than decorative use | [ ] |
| **Theme Support & States** | |
| All theme modes supported (light/dark/compact/branded) | [ ] |
| State transitions defined (hover/active/focus/disabled) | [ ] |
| Theme-specific overrides reviewed from metadata where applicable | [ ] |

**Target outcome:** Calm, purposeful interfaces that are unmistakably Salesforce. Color should enhance usability without becoming decorative.

brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall