1. The Configuration
Themes are defined insqueditor.config.js. Each theme entry controls how a specific set of pages is styled and packaged.
squeditor.config.js
Property Reference
2. The Theme SCSS File
Each theme SCSS file uses thesq-theme mixin. This mixin automatically generates scoped CSS variables (--sq-*) for both light and dark modes, applied to your theme’s bodyClass.
src/assets/scss/themes/_saas.scss
Advanced Token Customization
Squeditor provides two maps for fine-grained token control:$overrides: Use this for tokens that should change globally for this theme (e.g., a “rounded” theme where everything hasbtn-radius: 50rem).$dark-overrides: Use this for tokens that specifically need adjustment in dark mode. For example, some fonts look thicker on dark backgrounds, so you might want to dropheading-font-weightfrom600(global) to400(dark only).
Why use Tokens vs. Manual CSS?
If you update @_base.scss (or the framework defaults) to use tokens:3. How It Works
** Token Override Mechanism ** Squeditor uses a “last-in-wins” approach. During the build process, the framework dynamically rewrites the last@import in your main.scss to target the active theme:
src/init.php based on:
- URL Query:
?theme=id(highest priority) - Page Mapping: Matches the current PHP file against the
pagesarray in your config. - Default: Falls back to the first theme in your config if no match is found.
Demo Mode & Theme Switcher
If$site['demo_mode'] = true is set in your configuration, the Theme Switcher UI will appear. This allows users to manually cycle through your defined palettes and typography presets in the browser, overriding the default theme via query parameters and localStorage.
Playground: Common Scenarios
** Scenario A: Single Niche, Multiple Visual Styles ** Use this when building one template (e.g., a Portfolio) that you want to offer in multiple “flavors” (Clean, Bold, Pastel). All versions share the same pages.dist/ structure:
dist/medical-demo/index.html(Styled with Medical theme)dist/saas-demo/index.html(Styled with SaaS theme)