Theme Customization

Glint is built with SCSS and follows Bootstrap's variable structure. This makes customizing theme colors, gradients, and other global styles simple and scalable. All overrides and custom variables are stored in the assets > scss > custom > custom-variables.scss file.

1. Color Variables

The theme uses a custom color palette aligned with Bootstrap’s default variables. You can modify any of these colors to instantly update the theme.


$blue: #2e6fa9 !default;
$indigo: #6610f2 !default;
$purple: #6f42c1 !default;
$pink: #d63384 !default;
$red: #c9463d !default;
$orange: #e1a32b !default;
$yellow: #ffd75d !default;
$green: #4cae4f !default;
$teal: #2a6f6b !default;
$cyan: #0dcaf0 !default;

// Bootstrap override mapping
$primary: $yellow !default;
$secondary: $gray-600 !default;
$success: $green !default;
$info: $cyan !default;
$warning: $yellow !default;
$danger: $red !default;
$light: $gray-100 !default;
$dark: $black !default;

For example, if you want your primary color to be blue instead of yellow, simply update:


// Before
$primary: $yellow !default;

// After
$primary: $blue !default;

2. Gradient Variables

Glint uses gradients in various widgets and UI sections. You can customize these from the theme-vars SCSS file.


// Default gradient
$default-gradient: linear-gradient(90deg, #e8e9eb 0%, #fdf6dc 100%);

To update, just replace the hex codes with your own gradient values.

After making changes, recompile your SCSS to apply the new theme. This will update colors across all components, widgets, and layouts consistently.

3. Light/Dark Theme

Glint supports light and dark themes using Bootstrap’s built-in data-bs-theme attribute along with a custom JavaScript function for flexibility. This means you can easily switch between light and dark modes, and your choice will persist across page reloads.


    const applyDarkMode = (enabled: boolean, emit = true) => {
      const html = document.documentElement;
      const newTheme = enabled ? 'dark' : 'light';
      html.setAttribute('data-bs-theme', newTheme);
    
      // Keep old .dark-mode class for compatibility if your CSS used it
      if (enabled) html.classList.add('dark-mode');
      else html.classList.remove('dark-mode');
    
      setIsDarkMode(enabled);
    
      try {
        localStorage.setItem('theme', newTheme);
      } catch {}
    
      if (emit) {
        // notify other parts of app (e.g., Header) that theme changed
        window.dispatchEvent(new CustomEvent('theme-changed', { detail: newTheme }));
      }
    };
    

Here’s what the function does:

  • Uses data-bs-theme attribute (light or dark) to tell Bootstrap which theme to render.
  • Adds or removes a legacy .dark-mode class for any custom CSS that still depends on it.
  • Updates localStorage so the user’s choice persists across page reloads or new sessions.
  • Emits a custom theme-changed event so other components (like Header or Customizer) can react instantly to theme changes.

This approach makes it very easy to extend. For example, you can listen for the theme-changed event anywhere in your app to adjust third-party widgets, charts, or custom styles.

4. LTR / RTL

Glint fully supports both Left-to-Right (LTR) and Right-to-Left (RTL) layouts. By default, Bootstrap provides RTL utilities, but for a full dashboard theme, we generate two complete CSS builds:

  • styles-ltr.css — compiled from the default SCSS (LTR direction).
  • styles-rtl.css — generated by passing the LTR CSS through RTLCSS, which automatically flips spacing, float, and directional properties.

To update or regenerate RTL styles:

  1. Compile styles-ltr.css from your SCSS sources.
  2. Paste the CSS into RTLCSS playground.
  3. Copy the generated RTL CSS into styles-rtl.css.
  4. Now you have two parallel CSS files — one for each direction.

Switching between them at runtime is handled by a helper function in the Customizer:


  const applyDirection = (lang: string, dir: 'ltr' | 'rtl') => {
    setLoadingDirection(true);
  
    const html = document.documentElement;
    html.setAttribute('dir', dir);
    html.setAttribute('lang', lang);
  
    const link = document.getElementById('bootstrap-css') as HTMLLinkElement | null;
    if (link) {
      link.href = `/css/styles-${dir}.css`;
    }
  
    setTimeout(() => setLoadingDirection(false), 600);
  };
  

Here’s what this does:

  • Sets dir attribute (ltr or rtl) on <html>, which affects text flow and browser-native behaviors.
  • Sets lang attribute for accessibility and SEO (e.g., "en", "ar").
  • Dynamically swaps the loaded CSS file between styles-ltr.css and styles-rtl.css.
  • Shows a quick loading state (setLoadingDirection) so the transition feels smooth instead of jarring.

With this setup, users can seamlessly toggle between LTR and RTL without reloading the entire app. All widgets, layouts, and components automatically respect the chosen direction.