Skip to content

Overview

The TendSocial frontend uses a semantic theming system that supports:

  • Dark Mode (Default)
  • Light Mode
  • Brand Match (Dynamic user-defined colors)

Architecture

The system is built on three pillars:

  1. CSS Variables: Defined in index.css (e.g., --color-bg-primary).
  2. Tailwind Configuration: Mapped in tailwind.config.js to semantic utility classes (e.g., bg-theme-base).
  3. React Context: ThemeContext manages the state and persists it to localStorage.

Semantic Tokens

We use semantic naming rather than descriptive naming to ensure the theme adapts correctly across modes.

Backgrounds

TokenClassDescription
--color-bg-primarybg-theme-baseMain page background
--color-bg-secondarybg-theme-surfaceCards, sidebars, headers
--color-bg-tertiarybg-theme-surface-highlightHover states, active items

Text

TokenClassDescription
--color-text-primarytext-theme-primaryMain headings, body text
--color-text-secondarytext-theme-secondarySubtitles, metadata
--color-text-tertiarytext-theme-tertiaryLow-contrast labels, placeholders

Borders

TokenClassDescription
--color-borderborder-theme-baseDefault hairline borders
--color-border-strongborder-theme-strongHigher contrast borders

Brand Match

When "Brand Match" is selected, the useBrandTheme hook dynamically overrides the CSS variables on the :root element with colors derived from the user's BrandProfile.

Usage Guidelines

DO:

  • Use semantic classes: <div className="bg-theme-surface text-theme-primary">
  • Use opacity modifiers if needed: <div className="bg-theme-base/50">

DON'T:

  • Use hardcoded grays: bg-gray-900 (Breaks light mode)
  • Use white/black directly: text-theme-primary (Unless on a permanently dark element like a button)

TendSocial Documentation