// ============================================================================= // THEME BASE - Core theming infrastructure // ============================================================================= // This file provides the foundation for the skinning/theming system. // Each theme defines color palettes for both light and dark modes. // ============================================================================= // Theme Registry Map - stores all registered themes $themes: () !default; // ============================================================================= // THEME REGISTRATION MIXIN // ============================================================================= // Use this mixin to register a new theme with its color palette // Each theme should define both 'light' and 'dark' variants @mixin register-theme($name, $theme-map) { $themes: map-merge($themes, ($name: $theme-map)) !global; } // ============================================================================= // THEME APPLICATION MIXIN // ============================================================================= // Generates CSS custom properties for a theme @mixin apply-theme-variables($theme-name, $variant: 'light') { $theme: map-get($themes, $theme-name); @if $theme { $colors: map-get($theme, $variant); @if $colors { // Primary palette --theme-primary: #{map-get($colors, 'primary')}; --theme-primary-hover: #{map-get($colors, 'primary-hover')}; --theme-primary-light: #{map-get($colors, 'primary-light')}; --theme-secondary: #{map-get($colors, 'secondary')}; // Status colors --theme-success: #{map-get($colors, 'success')}; --theme-success-light: #{map-get($colors, 'success-light')}; --theme-warning: #{map-get($colors, 'warning')}; --theme-warning-light: #{map-get($colors, 'warning-light')}; --theme-danger: #{map-get($colors, 'danger')}; --theme-danger-light: #{map-get($colors, 'danger-light')}; --theme-info: #{map-get($colors, 'info')}; --theme-info-light: #{map-get($colors, 'info-light')}; // Backgrounds --theme-bg-body: #{map-get($colors, 'bg-body')}; --theme-bg-card: #{map-get($colors, 'bg-card')}; --theme-bg-secondary: #{map-get($colors, 'bg-secondary')}; --theme-bg-muted: #{map-get($colors, 'bg-muted')}; --theme-bg-input: #{map-get($colors, 'bg-input')}; // Text colors --theme-text-primary: #{map-get($colors, 'text-primary')}; --theme-text-secondary: #{map-get($colors, 'text-secondary')}; --theme-text-muted: #{map-get($colors, 'text-muted')}; --theme-text-heading: #{map-get($colors, 'text-heading')}; // Borders --theme-border-color: #{map-get($colors, 'border-color')}; --theme-border-light: #{map-get($colors, 'border-light')}; // Links --theme-link-color: #{map-get($colors, 'link-color')}; --theme-link-hover: #{map-get($colors, 'link-hover')}; // Shadows --theme-shadow-sm: #{map-get($colors, 'shadow-sm')}; --theme-shadow-md: #{map-get($colors, 'shadow-md')}; --theme-shadow-lg: #{map-get($colors, 'shadow-lg')}; // Navigation --theme-nav-bg: #{map-get($colors, 'nav-bg')}; --theme-nav-text: #{map-get($colors, 'nav-text')}; --theme-nav-active: #{map-get($colors, 'nav-active')}; // Labels/Badges --theme-label-success-bg: #{map-get($colors, 'label-success-bg')}; --theme-label-success-color: #{map-get($colors, 'label-success-color')}; --theme-label-warning-bg: #{map-get($colors, 'label-warning-bg')}; --theme-label-warning-color: #{map-get($colors, 'label-warning-color')}; --theme-label-danger-bg: #{map-get($colors, 'label-danger-bg')}; --theme-label-danger-color: #{map-get($colors, 'label-danger-color')}; --theme-label-primary-bg: #{map-get($colors, 'label-primary-bg')}; --theme-label-primary-color: #{map-get($colors, 'label-primary-color')}; --theme-label-secondary-bg: #{map-get($colors, 'label-secondary-bg')}; --theme-label-secondary-color: #{map-get($colors, 'label-secondary-color')}; } } } // ============================================================================= // HELPER FUNCTIONS // ============================================================================= // Get a specific color from a theme @function theme-color($theme-name, $variant, $color-key) { $theme: map-get($themes, $theme-name); @if $theme { $colors: map-get($theme, $variant); @if $colors { @return map-get($colors, $color-key); } } @return null; } // Check if a theme exists @function theme-exists($theme-name) { @return map-has-key($themes, $theme-name); } // Get all registered theme names @function get-theme-names() { @return map-keys($themes); }