Theme System Documentation

Architecture Overview

The styling is split into base structure (layout) and themes (visual styling):

Base Files (Structure Only)

Theme Files (Visual Styling)

Available Themes

1. Default Theme (Purple Gradient)

Classic purple gradient design with vibrant colors:

2. Google Material Theme

Inspired by Google Material Design:

3. SAP Fiori Theme

Based on SAP Fiori Design System:

4. IBM Carbon Theme

Based on IBM Carbon Design System:

5. IBM Carbon Dark Theme

Based on IBM Carbon Design System (Dark Mode):

6. Glow UI Theme (Light)

Inspired by Glow UI:

7. Glow UI Dark Theme

Inspired by Glow UI (Dark Mode):

8. Microsoft Fluent 2 Theme

Based on Microsoft Fluent 2:

How to Switch Themes

Via the <vn-grid> Web Component

Grid themes are now managed by the <vn-grid> element. Set the theme attribute declaratively or switch at runtime:

<vn-grid id="peopleGrid" theme="material">
    ...
</vn-grid>
// Switch at runtime
document.getElementById('peopleGrid').setTheme('carbon-dark');

The app-level theme CSS is still loaded via a <link> tag in index.html:

<link id="appThemeLink" rel="stylesheet" href="themes/app-default.css">

Dynamic Theme Switching (JavaScript)

switchTheme(themeName) in modules/theme.js swaps the app theme <link href> to themes/app-<name>.css and calls setTheme(name) + refresh() on every <vn-grid> on the page, so one name drives both layers.

Creating New Themes

Step 1: Copy Template

Copy the app-theme template as a starting point:

cp themes/TEMPLATE-app-theme.css themes/app-mytheme.css

The grid needs a theme under the same name: either one of the eight built-ins, or a custom one started from src/vanilla-grid/themes/TEMPLATE-vn-grid-theme.css and registered with VanillaGridElement.registerTheme('mytheme', '<path>').

Step 2: Customize Colors

Edit your new theme files, focusing on:

Step 3: Test Theme

Add an <option value="mytheme"> to the #themeSelector dropdown in index.html and pick it — switchTheme() loads both layers.

Design System Guidelines

SAP Fiori

IBM Carbon

IBM Carbon Dark

Material Design

Theme Validation Checklist

When creating a new theme, ensure you style:

Grid Components

Grid styling is owned by the component's theme file, not this app — see the required token set in src/vanilla-grid/themes/TEMPLATE-vn-grid-theme.css.

App Components

Best Practices

  1. Keep base files unchanged - Only edit theme files
  2. Use consistent spacing - Match design system grid (4px, 8px, etc.)
  3. Test accessibility - Ensure contrast ratios meet WCAG AA standards
  4. Mobile responsive - Test on small screens
  5. Browser compatibility - Test gradients, shadows, fonts
  6. Performance - Avoid heavy box-shadows on many elements

Troubleshooting

Theme not applying

Partial styling

Conflicting styles