Smart Library Docs

Design System

CSS variable theming, dark/light mode, Vercel-inspired color palette, border radii, and typography.

Design System

File: frontend/src/app/globals.css

The SLMS design system is implemented through CSS custom properties (variables) with Tailwind CSS integration, providing a cohesive Vercel-inspired aesthetic with full dark mode support.

Theme Architecture

globals.css
├── Tailwind Imports (@import)
├── @theme inline (CSS Variable → Tailwind mapping)
├── :root (Light theme values)
├── .dark (Dark theme values)
└── @layer base (Global element styles)

Color Palette

Light Theme (:root)

TokenValueUsage
--background#fafafaPage background
--foreground#171717Primary text
--card#ffffffCard surfaces
--primary#171717Primary buttons, accents
--primary-foreground#ffffffText on primary elements
--secondary#ffffffSecondary surfaces
--muted#f2f2f2Muted backgrounds
--muted-foreground#8f8f8fSecondary text
--destructive#ee0000Error states, delete actions
--border#ebebebBorders and dividers
--ring#0070f3Focus rings (Vercel Blue)

Dark Theme (.dark)

TokenValueUsage
--background#000000Pure black background
--foreground#edededOff-white text
--card#0a0a0aSlightly elevated surfaces
--primary#ffffffWhite primary buttons
--primary-foreground#000000Black text on primary
--muted#111111Dark muted backgrounds
--muted-foreground#a1a1a1Muted text
--border#333333Dark gray borders

Border Radii

Mapped from design tokens to Tailwind via @theme inline:

TokenValueTailwind Class
--radius-sm6pxrounded-sm
--radius-md12pxrounded-md
--radius-lg16pxrounded-lg
--radius-full9999pxrounded-full

Typography

FontVariableUsage
Geist Sans--font-geist-sansBody text, UI labels, headings
Geist Mono--font-geist-monoCode blocks, IDs, barcodes

Fonts are loaded via Next.js next/font/google for zero-layout-shift performance.


Tailwind Integration

The @theme inline block bridges CSS variables to Tailwind utility classes:

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --font-sans: var(--font-geist-sans);
  --font-mono: var(--font-geist-mono);
  /* ... all tokens mapped ... */
}

This allows using semantic class names like bg-background, text-foreground, border-border, text-muted-foreground, etc.


Global Base Styles

@layer base {
  * {
    @apply border-border outline-ring;
  }
  body {
    @apply bg-background text-foreground;
  }
  html {
    @apply font-sans;
  }
}
  • All elements get consistent border and focus ring colors
  • Body uses the theme background and foreground
  • HTML uses the Geist Sans font family

Theme Switching

Theme switching is powered by next-themes:

  1. CSS class method: The library adds/removes the .dark class on <html>
  2. System preference detection: enableSystem listens for prefers-color-scheme
  3. Persistence: Theme choice is stored in localStorage
  4. No flash: suppressHydrationWarning on <html> prevents hydration mismatch
  5. Toggle button: ThemeToggle component provides manual switching

Design Principles

  1. Vercel-Inspired: Clean, minimal aesthetic with high contrast and generous whitespace
  2. Semantic Tokens: Colors are referenced by purpose (foreground, muted, destructive) not by hue
  3. Dark-First: The dark theme uses pure black (#000000) for deep OLED contrast
  4. Consistent Borders: A single border-border token ensures uniform divider styling across all components

On this page