Add, update, validate and verify theme files using built-in package.json commands and utilities.
Purpose: Add, update, validate and verify theme files using built-in package.json commands and utilities.
Target Users: Frontend developers managing Daedalus theme CSS variables and styling system.
Related Components:
source/renderer/app/themes/— Theme definitions and utilitiessource/renderer/app/themes/daedalus/— Theme output files (cardano.ts, light-blue.ts, etc.)source/renderer/app/themes/utils/— Theme creation and validation scriptsgulpfile.js— Build tasks for themes
Daedalus uses a CSS custom properties (CSS variables) theme system built with TypeScript. All themes are generated from a centralized createTheme object and validated against existing theme files to ensure consistency across the application.
| Path | Purpose |
|---|---|
source/renderer/app/themes/daedalus/index.ts | Theme output definitions (CARDANO_THEME_OUTPUT, LIGHT_BLUE_THEME_OUTPUT, etc.) |
source/renderer/app/themes/daedalus/cardano.ts | Dark theme (primary Cardano theme) |
source/renderer/app/themes/daedalus/light-blue.ts | Light theme variant |
source/renderer/app/themes/daedalus/dark-cardano.ts | Dark variant of Cardano theme |
source/renderer/app/themes/utils/constants.ts | createTheme object and theme creation parameters |
source/renderer/app/themes/utils/checkCreateTheme.ts | Validation logic for theme consistency |
All commands use Gulp build system and TypeScript compilation before execution.
themes:check:createTheme)Purpose: Validate that the createTheme object contains all CSS custom properties defined in existing theme files.
Command:
yarn themes:check:createTheme
What It Does:
gulp build:themessource/renderer/app/themes/scripts/check.tscreateTheme object against all existing theme outputsOutput Example:
createTheme.js is missing the following definitions that exist in the cardano.ts theme:
{
"--theme-wallet-address-copy-tooltip-background-color": "#2cbb69",
"--theme-wallet-address-copy-tooltip-text-color": "#fafafa"
}
When to Use:
Note: This command does NOT modify files; it only reports differences.
themes:update)Purpose: Update theme files based on changes in the createTheme object, then auto-format with Prettier.
Command:
yarn themes:update
What It Does:
gulp build:themessource/renderer/app/themes/utils/updateThemesCLI.ts (interactive CLI)--loglevel warn)source/renderer/app/themes/daedalus/*.tsInteractive CLI Usage:
Output Example:
Updating cardano.ts...
✓ Added 3 new CSS variables
✓ Updated 2 existing variables
✓ Formatted with Prettier
When to Use:
createTheme objectResult: Updated TypeScript theme files with auto-formatting applied.
themes:copy)Purpose: Interactive CLI tool to quickly duplicate CSS properties between all theme files.
Command:
yarn themes:copy
What It Does:
source/renderer/app/themes/utils/copyTheme.ts (interactive CLI)Interactive CLI Steps:
--theme-button-primary-color)Usage Example:
? Which CSS variable do you want to copy?
> --theme-button-primary-background
? Copy from which theme?
> cardano.ts
? Copy to which themes? (select multiple with Space)
> [x] light-blue.ts
> [ ] dark-cardano.ts
> [x] light-cardano.ts
✓ Applied to 2 themes
✓ Running Prettier...
When to Use:
Result: All selected theme files updated with copied property; auto-formatted.
gulp build:themes)Purpose: Internal build step that compiles theme TypeScript files for use by check/update/copy commands.
Command:
gulp build:themes
What It Does:
dist/ directorydist/When It Runs: Automatically executed before themes:check:createTheme, themes:update, and themes:copy.
Note: You typically don't need to run this directly; it's a dependency of other theme commands.
Scenario: You need to add a new CSS variable --theme-mithril-card-background for the Mithril feature.
Steps:
Add to createTheme object:
// source/renderer/app/themes/utils/constants.ts
export const CREATE_CARDANO_THEME_PARAMS = {
// ... existing vars
'mithril-card-background': {
light: '#ffffff',
dark: '#0f1822',
},
};
Validate:
yarn themes:check:createTheme
createThemeUpdate theme files:
yarn themes:update
Verify:
yarn prettier:check
yarn compile
Scenario: You created a new theme variant and need to copy all color values from the Cardano theme.
Steps:
Create new theme file: source/renderer/app/themes/daedalus/my-theme.ts
Export output constant in source/renderer/app/themes/daedalus/index.ts:
export const MY_THEME_OUTPUT = { /* ... */ };
export const EXISTING_THEME_OUTPUTS = [
// ... existing
['my-theme.ts', MY_THEME_OUTPUT],
];
Copy properties iteratively:
yarn themes:copy
Or update in batch (if createTheme supports new theme):
yarn themes:update
Scenario: You've made changes to theme files and want to ensure everything is consistent.
Steps:
# 1. Check createTheme validity
yarn themes:check:createTheme
# 2. Run full code quality checks
yarn compile # TypeScript check
yarn prettier:check # Formatting check
yarn lint # ESLint check
Each theme file exports a TypeScript object mapping CSS variable names to color values:
// source/renderer/app/themes/daedalus/cardano.ts
export const CARDANO_THEME_OUTPUT = {
'--theme-about-window-background-color': 'rgba(15, 24, 34, 0.96)',
'--theme-button-primary-background': '#2cbb69',
'--theme-button-primary-text-color': '#ffffff',
// ... 200+ more CSS variables
};
The createTheme object uses parameter format:
// source/renderer/app/themes/utils/constants.ts
export const CREATE_CARDANO_THEME_PARAMS = {
'property-name': {
light: '#color-for-light-theme',
dark: '#color-for-dark-theme',
},
// ...
};
Before committing theme changes:
# 1. Validate theme creation object
yarn themes:check:createTheme
# 2. Verify TypeScript compilation
yarn compile
# 3. Check code formatting
yarn prettier:check
# 4. Run full checks
yarn lint
Theme changes are validated in CI via:
yarn check:all — Runs all quality checks including theme validationcreateTheme and existing themescreateTheme with both light and dark valuesyarn themes:check:createTheme to validateyarn themes:update to sync to all theme filesyarn prettier:check && yarn compilecolor: var(--theme-feature-color);source/renderer/app/themes/daedalus/source/renderer/app/themes/daedalus/index.tsEXISTING_THEME_OUTPUTS arrayyarn themes:copy or yarn themes:update to populatecreateTheme parameters in constants.tsyarn themes:update and select all themes.ts filesthemes:check:createTheme after any theme-related changesthemes:copy for one-off variable propagationthemes:update for bulk changes affecting multiple filesprettier:check after theme updates (auto-run by update command).ts files if template exists (use tools instead)themes:check:createTheme)#2cbb69rgba(255, 255, 255, 0.8)--theme-[feature]-[element]-[property]
--theme-wallet-address-copy-tooltip-background-colorProblem: yarn themes:check:createTheme reports missing definitions
Solution:
CREATE_*_THEME_PARAMS in constants.tslight and dark values are providedyarn themes:check:createTheme again to verifyProblem: Theme files aren't formatted after update
Solution:
themes:update commandyarn prettier --loglevel warn --write source/renderer/app/themes/daedalus/*.tsProblem: yarn compile fails after theme changes
Solution:
daedalus/index.tscreateTheme object matches theme file structureyarn themes:update to auto-sync filesProblem: themes:copy or themes:update hangs
Solution:
gulp build:themes completed successfullydist/ directory exists after buildyarn clear:cache && yarn themes:updateThe Daedalus project includes comprehensive video tutorials on theme management:
createTheme utilitythemes:update scriptthemes:check:createTheme for validationSee Theme README for video links.
| Task | Command | Interactive? | Modifies Files? |
|---|---|---|---|
| Validate themes | yarn themes:check:createTheme | No | No |
| Update all themes | yarn themes:update | Yes | Yes |
| Copy one variable | yarn themes:copy | Yes | Yes |
| Build themes | gulp build:themes | No | Generated only |
| Check formatting | yarn prettier:check | No | No |
| Auto-format themes | yarn prettier --write source/renderer/app/themes/daedalus/*.ts | No | Yes |
When working with theme files:
createTheme → validate → update files → verifythemes:copy CLI for single operationsthemes:update CLI for multiple variablesthemes:check:createTheme && yarn compile && yarn prettier:checkconstants.ts then sync with themes:updateAlways ensure theme files remain in sync with validation tools and auto-formatted.