Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save eonist/15a3e559472f13ea3230bb9fed757a32 to your computer and use it in GitHub Desktop.

Select an option

Save eonist/15a3e559472f13ea3230bb9fed757a32 to your computer and use it in GitHub Desktop.
theme.md

whats the best way to manage themes for my tauri app. I have darkmode and lightmode, but user definable themes would be interesting addition. https://github.com/edgeleap/omni-app

Your app already has an excellent foundation for theming in src/styles/tokens/colors.css with CSS custom properties mapped through Tailwind. Here's how to extend it for user-definable themes.

Recommended Architecture

1. Create a Theme Store

Add a dedicated theme store using Zustand (which you already use) to manage theme state and persist user preferences:

// src/stores/themeStore.ts
interface Theme {
  id: string;
  name: string;
  colors: Record<string, string>;
}

interface ThemeStore {
  currentTheme: string;  // 'dark' | 'light' | custom theme id
  customThemes: Theme[];
  setTheme: (themeId: string) => void;
  addCustomTheme: (theme: Theme) => void;
}

2. Dynamic CSS Variable Injection

Instead of static CSS files, inject custom theme variables at runtime:

function applyTheme(theme: Theme) {
  const root = document.documentElement;
  Object.entries(theme.colors).forEach(([key, value]) => {
    root.style.setProperty(key, value);
  });
  root.setAttribute('data-theme', theme.id);
}

3. Persist with Tauri Store Plugin

Use @tauri-apps/plugin-store to persist custom themes locally:

import { Store } from '@tauri-apps/plugin-store';

const store = new Store('themes.json');
await store.set('customThemes', customThemes);
await store.save();

Theme Editor Approach

Build a theme editor in your preferences panel that:

  • Provides color pickers for each token category (backgrounds, text, accents, semantic colors)
  • Shows live preview as users adjust colors
  • Validates contrast ratios for accessibility
  • Exports/imports themes as JSON

Suggested Token Structure

Based on your tailwind.config.js, group editable tokens into user-friendly categories:

Category Tokens Purpose
Backgrounds --bg-primary, --bg-secondary, --bg-tertiary Main app surfaces
Text --text-primary, --text-secondary, --text-muted Typography
Accent --accent, --accent-hover Buttons, links, focus
Semantic --success, --warning, --error Status indicators
Borders --border, --border-light Dividers, inputs

Implementation Tips

  • Keep base themes as defaults - Your existing :root (dark) and [data-theme="light"] serve as fallback/starting points
  • Theme inheritance - Let users create themes based on light or dark mode, only overriding specific values
  • Presets library - Include popular presets (Dracula, Nord, Solarized) as starting templates
  • CSS-in-JS alternative - For more complex theming, consider moving tokens to a TypeScript object that generates both CSS variables and types

how would it work for the end user?

The end user experience for custom themes would work through a straightforward flow in your preferences window.

User Journey

Selecting Themes

Users open Preferences and see a theme selector dropdown with:

  • System (follows OS dark/light preference)
  • Dark (your current default)
  • Light (your existing light mode)
  • Custom themes (user-created or imported)
  • "Create New Theme" button

Switching themes applies instantly with no restart required, since CSS variables update the DOM immediately.

Creating Custom Themes

Option A: Start from Base

  1. User clicks "Create New Theme"
  2. Chooses to base it on Dark or Light mode
  3. A theme editor panel opens with color pickers grouped by category
  4. Live preview shows changes in real-time (either in a mini preview or the actual app)
  5. User names the theme and saves

Option B: Quick Accent Color For users who just want personalization without deep customization:

  1. Pick a single accent color
  2. The app auto-generates complementary colors for hover states, backgrounds, etc.
  3. This is simpler and covers 80% of customization needs

Theme Editor Interface

┌─────────────────────────────────────────┐
│  Theme: "My Custom Theme"         [Save]│
├─────────────────────────────────────────┤
│  Based on: [Dark ▾]                     │
├─────────────────────────────────────────┤
│  Backgrounds                            │
│  ├─ Primary     [■ #09090b] ←picker     │
│  ├─ Secondary   [■ #18181b]             │
│  └─ Tertiary    [■ #27272a]             │
│                                         │
│  Accent                                 │
│  ├─ Main        [■ #3b82f6]             │
│  └─ Hover       [■ #2563eb]             │
│                                         │
│  Text                                   │
│  ├─ Primary     [■ #fafafa]             │
│  └─ Secondary   [■ #a1a1aa]             │
├─────────────────────────────────────────┤
│  [Reset to Base]  [Export]  [Delete]    │
└─────────────────────────────────────────┘

Sharing Themes

Users can:

  • Export a theme as a .json file to share with others
  • Import themes via drag-and-drop or file picker
  • Potentially browse community themes from a curated list (future feature)

Example export format:

{
  "name": "Nord Dark",
  "base": "dark",
  "colors": {
    "--bg-primary": "#2e3440",
    "--accent": "#88c0d0",
    "--text-primary": "#eceff4"
  }
}

UX Considerations

Aspect Recommendation
Preview Show changes live as user adjusts colors
Validation Warn if text/background contrast is too low (accessibility)
Undo Allow reverting to last saved state
Defaults "Reset to Default" button always available
Persistence Themes survive app updates and sync across windows

Simplified Flow for Most Users

Many users just want quick personalization, so consider a two-tier approach:

  1. Simple mode - Pick accent color + light/dark base → auto-generates everything
  2. Advanced mode - Full control over all ~20 color tokens

This keeps the feature approachable while still powerful for users who want granular control.


I dont think the scope is to make a theme editor. should it be? what about just having a json format or smth that user can edit them selfs or use an AI to edit it etc? how does other apps do this etc? whats the norm for tauri apps etc. that work for linux Mac and windows

You're right—a built-in theme editor is overkill for most apps. The industry standard for developer/power-user tools is config files in a themes directory that users edit manually, share, or generate with external tools.

How Popular Apps Handle Themes

App Format Location Hot Reload
Alacritty TOML/YAML ~/.config/alacritty/themes/ Yes
Warp YAML ~/.local/share/warp-terminal/themes/ Yes
VS Code JSON Extensions or settings.json Yes
Hyper JS config ~/.hyper.js Yes

The pattern is consistent: drop a file in a folder, app picks it up.12

Recommended Approach for Omni

1. Theme File Format (YAML or JSON)

YAML is more human-readable; JSON is easier to validate. Example:

# ~/.config/omni-app/themes/nord.yaml
name: "Nord"
base: "dark"  # inherits from dark, only override what's different
colors:
  --bg-primary: "#2e3440"
  --bg-secondary: "#3b4252"
  --accent: "#88c0d0"
  --text-primary: "#eceff4"

2. Directory Structure

~/.config/omni-app/
├── config.json          # app settings, includes "theme": "nord"
└── themes/
    ├── nord.yaml
    ├── dracula.yaml
    └── my-custom.yaml

On Windows: %APPDATA%/omni-app/themes/ On macOS: ~/Library/Application Support/omni-app/themes/

3. Implementation

  • On startup, scan the themes directory
  • Watch the directory for changes (Tauri's fs plugin supports this)
  • When a theme file changes, hot-reload CSS variables instantly
  • Ship 2-3 bundled themes as defaults

4. User Workflow

Users would:

  1. Copy an existing theme file
  2. Edit colors in any text editor (or ask ChatGPT/Claude to generate one)
  3. Save → app instantly applies changes
  4. Share .yaml files on GitHub, Discord, etc.

Why This Works Better

  • No maintenance burden for a theme editor UI
  • AI-friendly - users can paste their current theme and ask "make this more purple"2
  • Community-driven - Alacritty has 300+ community themes on GitHub3
  • Cross-platform standard - same approach works on Linux, macOS, Windows
  • Power users expect this - matches Warp, Alacritty, Kitty, WezTerm patterns

Quick Implementation Steps

  1. Define a JSON schema for theme files (enables validation + editor autocomplete)
  2. Add a themes directory path using Tauri's path plugin
  3. Use notify crate or Tauri's fs watcher to detect file changes
  4. On change, parse YAML/JSON and inject CSS variables into the DOM
  5. Document the format in your README with examples

This is far less work than building a UI and aligns with how your target users (developers) prefer to customize tools. 456789101112131415161718192021222324252627282930


whats the argument for not having a custom selectable theme?

Good question—here are the legitimate reasons to skip custom themes entirely:

Arguments Against Custom Themes

1. Development & Maintenance Cost

  • Every new UI component must be tested across multiple themes
  • Edge cases with contrast, readability, and visual hierarchy multiply
  • Bug reports become harder to reproduce ("only happens with my custom theme")
  • Future redesigns require updating theme schema, potentially breaking user themes

2. Design Consistency

  • Your app has a specific visual identity and UX decisions baked into the colors
  • Custom themes can break visual hierarchy (e.g., user picks bad contrast)
  • Semantic colors (red=error, green=success) lose meaning if users override them
  • Screenshots/docs look different from what users see, causing confusion

3. Limited Audience

  • Most users never customize themes—typically <5% of user base
  • The users who do are often power users who can handle workarounds (CSS injection, etc.)
  • Dark + Light mode covers 95%+ of actual user needs

4. Support Burden

  • "The app looks broken" → turns out it's their custom theme
  • Users blame the app when their theme has accessibility issues
  • Community themes with bugs reflect poorly on your app

5. Scope Creep Risk

  • Starts with "just themes" → then theme sharing → then a theme browser → then theme ratings
  • Feature requests spiral: "can I theme the titlebar separately?" "can I have per-window themes?"

When Custom Themes Make Sense

Custom themes are worth it when:

  • Your app is a daily driver tool (terminal, editor, notes app) where personalization matters
  • Your target users are developers/power users who expect customization
  • You're building a platform where visual identity varies (e.g., white-label)
  • Competitors offer it and it's a differentiator

Middle Ground Options

If you're unsure, consider:

Option Effort User Value
Dark + Light only Low Covers most users
Dark + Light + 2-3 accent color presets Low Quick personalization
Dark + Light + config file themes Medium Power users happy
Full theme editor High Rarely justified

For a Git client like Omni, Dark + Light + config file themes is probably the sweet spot—matches what tools like Warp and Alacritty do, and your users (developers) already expect config-file customization.


Recommendation for Omni

Given that Omni is a Git client targeting developers, here's what makes sense:

Start Simple, Expand Later

  1. Ship with Dark + Light (you already have this)
  2. Add config file theming later only if users request it
  3. Never build a theme editor — not worth it for this app category

Why This Order Works

Your current setup in colors.css is already structured perfectly for future expansion. The CSS variable architecture means:

  • Adding config file theming later is non-breaking
  • You don't need to refactor anything
  • Users who want customization today can manually inject CSS via devtools or a custom stylesheet

If Users Ask for Themes

Wait for actual demand. Signs that you need it:

  • Multiple GitHub issues requesting custom themes
  • Users sharing CSS hacks in discussions
  • Competitors gaining traction partly due to theming

When that happens, the implementation is straightforward:

// Minimal implementation
1. Watch ~/.config/omni-app/theme.json
2. On change, read file and apply to document.documentElement.style
3. Document the available variables
4. Done — no UI needed

What to Do Now

  1. Document your CSS variables — Add a THEMING.md that lists all customizable variables from your colors.css. Even without official support, power users can use this for CSS injection.
  2. Add a "Custom CSS" field in preferences — A simple textarea where users paste custom CSS. Zero maintenance, maximum flexibility. Apps like Discord, Slack (via plugins), and Obsidian do this.
  3. Keep your current architecture — It's already future-proof. The [data-theme="light"] pattern scales to [data-theme="nord"] trivially.

The 80/20 Solution

If you want to offer something beyond dark/light without full theming:

// Let users pick just an accent color
const accentPresets = [
  { name: 'Blue', value: '#3b82f6' },    // current default
  { name: 'Purple', value: '#8b5cf6' },
  { name: 'Green', value: '#22c55e' },
  { name: 'Orange', value: '#f97316' },
  { name: 'Pink', value: '#ec4899' },
];

This gives users personalization with:

  • 5 lines of config
  • One dropdown in preferences
  • Zero support burden
  • No custom theme files to validate

Most users who "want themes" actually just want their favorite accent color. This covers that need with minimal effort.


did the GitHub calls finish?

Yes, all the GitHub API calls completed successfully. Here's what I retrieved from your repo:

File/Directory Status Key Findings
Root directory Confirmed Tauri + Vite + Tailwind stack
tailwind.config.js CSS variables mapped to Tailwind tokens
src/ Found stores, styles, preferences folders
src/styles/tokens/ Contains colors.css, typography.css, spacing.css
src/styles/tokens/colors.css Full 13KB file with ~80 CSS variables
src/stores/ Uses Zustand (appStore, repositoryStore)

The key takeaway from the code review: your theming architecture is already well-designed with the CSS custom properties in colors.css and the [data-theme="light"] selector pattern. Adding custom themes later would be straightforward without refactoring—just add more [data-theme="theme-name"] blocks or inject variables dynamically.


what are some common themes to include besides default dark and default light?

Here are the most popular themes in the developer tools space:

Tier 1: Must-Have Presets

Theme Style Why Popular
Dracula Dark purple/pink 5M+ VS Code installs, ports for 300+ apps 31
Nord Arctic blue Clean, minimal, huge Linux community following 32
Catppuccin Pastel variants Rising star—4 variants (Latte, Frappé, Macchiato, Mocha) 33
One Dark Atom-inspired Classic, well-balanced contrast 33

Tier 2: Strong Contenders

Theme Style Notes
Gruvbox Retro warm browns Popular with Vim/Neovim users 34
Tokyo Night Neon blues/purples Modern, inspired by Tokyo nightlife 33
Solarized (Dark/Light) Scientific color theory The OG—still widely used 35
Rosé Pine Muted pinks/purples Aesthetic, growing community 36
GitHub (Dark/Light) Familiar to devs Seamless with GitHub workflows 33

Recommendation for Omni

Since you're building a Git client, start with these 4-6:

Built-in themes:
├── Omni Dark (your default)
├── Omni Light (your default)
├── Dracula         # most requested dark theme
├── Nord            # beloved by Linux users
├── Catppuccin Mocha # trending favorite
└── GitHub Dark     # familiar for your Git users

Why These Specifically

  • Dracula and Nord have the largest communities and theme ports—users expect them32
  • Catppuccin is the current trend leader, especially among younger developers3336
  • GitHub Dark makes sense thematically for a Git client—users already associate those colors with code review

Color Values to Get Started

You can grab the official palettes from:

All of these have permissive licenses allowing you to include them as presets. 373839404142434445

Footnotes

  1. https://alacritty.org/config-alacritty.html

  2. https://docs.warp.dev/terminal/appearance/custom-themes 2

  3. https://github.com/alacritty/alacritty-theme

  4. https://learn.microsoft.com/en-us/windows/win32/controls/themesfileformat-overview

  5. https://tauri.app/v1/api/config/

  6. https://www.youtube.com/watch?v=pGzssFNtWXw

  7. https://specifications.freedesktop.org/icon-theme/latest

  8. https://github.com/tauri-apps/awesome-tauri

  9. https://www.reddit.com/r/vscode/comments/pl3afb/how_to_install_color_theme_from_json/

  10. https://people.redhat.com/alexl/files/icon-theme-spec.html

  11. https://www.youtube.com/watch?v=WpVNysQbxa8

  12. https://code.visualstudio.com/docs/configure/themes

  13. https://hiphish.github.io/blog/2023/02/26/how-i-switch-colours-in-alacritty/

  14. https://www.reddit.com/r/linux/comments/q8s73a/found_the_easiest_way_to_apply_and_change/

  15. https://dev.to/rajasegar/alacritty-themes-a-cli-tool-to-set-themes-for-alacritty-terminal-144c

  16. https://stackoverflow.com/questions/62668216/how-can-i-change-the-theme-of-my-hyper-terminal-downloaded-from-hyper-is

  17. https://voidcrunch.xyz/?p=285

  18. https://www.youtube.com/watch?v=fzb1JcZ0fFA

  19. https://www.youtube.com/watch?v=JicvLhPTNkk

  20. https://wiki.archlinux.org/title/Alacritty

  21. https://docs.warp.dev/terminal/appearance/themes

  22. https://github.com/ACHUX21/Hyper-dotfile

  23. https://github.com/eendroroy/alacritty-theme

  24. https://www.warp.dev/mac-terminal-themes

  25. https://v2.tauri.app/learn/window-customization/

  26. https://tauri.app/v1/guides/features/window-customization

  27. https://www.youtube.com/watch?v=zawhqLA7N9Y

  28. https://dev.to/akr/8-tips-for-creating-a-native-look-and-feel-in-tauri-applications-3loe

  29. https://itnext.io/dark-mode-on-tauri-angular-tailwind-app-74df8f7cb8ce

  30. https://dev.to/vinaybommana7/creating-our-own-color-theme-in-vscode-2b9m

  31. https://www.jit.io/blog/best-vs-code-themes-2023

  32. https://www.libhunt.com/compare-nord-vs-catppuccin 2

  33. https://www.gitkraken.com/blog/10-best-vs-code-color-themes-2025 2 3 4 5

  34. https://www.reddit.com/r/neovim/comments/191f5o0/what_are_the_most_popular_colorschemes_for_neovim/

  35. https://nathan-long.com/blog/colorschemes-for-the-discerning-developer/

  36. https://www.reddit.com/r/vscode/comments/1ifxyob/best_vs_code_theme_to_use_in_2025/ 2

  37. https://github.com/Gogh-Co/Gogh

  38. https://hamvocke.com/blog/lets-create-a-terminal-color-scheme/

  39. https://www.interaction-design.org/literature/article/ui-color-palette

  40. https://www.reddit.com/r/linux/comments/1t8i0z/programmers_in_rlinux_what_color_schemes_you_use/

  41. https://hookagency.com/blog/website-color-schemes-2020/

  42. https://github.com/GrayJack/grayjack-vscode-themes

  43. https://www.webportfolios.dev/blog/best-color-palettes-for-developer-portfolio

  44. https://www.bootstrapdash.com/blog/best-color-schemes-for-websites

  45. https://bungalowwebdesign.com/9-best-color-palettes-for-it-service-websites-in-2025-examples/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment