Add built-in theme support with various pre-defined themes
Some checks failed
ci/someci/tag/woodpecker/5 Pipeline is pending
ci/someci/tag/woodpecker/6 Pipeline is pending
ci/someci/tag/woodpecker/7 Pipeline is pending
ci/someci/tag/woodpecker/1 Pipeline failed
ci/someci/tag/woodpecker/2 Pipeline failed
ci/someci/tag/woodpecker/3 Pipeline failed
ci/someci/tag/woodpecker/4 Pipeline failed

- Introduce multiple built-in themes (`default_dark`, `default_light`, `gruvbox`, `dracula`, `solarized`, `midnight-ocean`, `rose-pine`, `monokai`, `material-dark`, `material-light`).
- Implement theming system with customizable color schemes for all UI components in the TUI.
- Include documentation for themes in `themes/README.md`.
- Add fallback mechanisms for default themes in case of parsing errors.
- Support custom themes with overrides via configuration.
This commit is contained in:
2025-10-03 07:44:11 +02:00
parent 6a3f44f911
commit 96e2482782
24 changed files with 1740 additions and 247 deletions

89
themes/README.md Normal file
View File

@@ -0,0 +1,89 @@
# OWLEN Built-in Themes
This directory contains the built-in themes that are embedded into the OWLEN binary.
## Available Themes
- **default_dark** - High-contrast dark theme (default)
- **default_light** - Clean light theme
- **gruvbox** - Popular retro color scheme with warm tones
- **dracula** - Dark theme with vibrant purple and cyan colors
- **solarized** - Precision colors for optimal readability
- **midnight-ocean** - Deep blue oceanic theme
- **rose-pine** - Soho vibes with muted pastels
- **monokai** - Classic code editor theme
- **material-dark** - Google's Material Design dark variant
- **material-light** - Google's Material Design light variant
## Theme File Format
Each theme is defined in TOML format with the following structure:
```toml
name = "theme-name"
# Text colors
text = "#ffffff" # Main text color
placeholder = "#808080" # Placeholder/muted text
# Background colors
background = "#000000" # Main background
command_bar_background = "#111111"
status_background = "#111111"
# Border colors
focused_panel_border = "#ff00ff" # Active panel border
unfocused_panel_border = "#800080" # Inactive panel border
# Message role colors
user_message_role = "#00ffff" # User messages
assistant_message_role = "#ffff00" # Assistant messages
thinking_panel_title = "#ff00ff" # Thinking panel title
# Mode indicator colors (status bar)
mode_normal = "#00ffff"
mode_editing = "#00ff00"
mode_model_selection = "#ffff00"
mode_provider_selection = "#00ffff"
mode_help = "#ff00ff"
mode_visual = "#ff0080"
mode_command = "#ffff00"
# Selection and cursor
selection_bg = "#0000ff" # Selection background
selection_fg = "#ffffff" # Selection foreground
cursor = "#ff0080" # Cursor color
# Status colors
error = "#ff0000" # Error messages
info = "#00ff00" # Info/success messages
```
## Color Format
Colors can be specified in two formats:
1. **Hex RGB**: `#rrggbb` (e.g., `#ff0000` for red, `#ff8800` for orange)
2. **Named colors** (case-insensitive):
- **Basic**: `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`
- **Gray variants**: `gray`, `grey`, `darkgray`, `darkgrey`
- **Light variants**: `lightred`, `lightgreen`, `lightyellow`, `lightblue`, `lightmagenta`, `lightcyan`
**Note**: For colors not in the named list (like orange, purple, brown), use hex RGB format.
OWLEN will display an error message on startup if a custom theme has invalid colors.
## Creating Custom Themes
To create your own theme:
1. Copy one of these files to `~/.config/owlen/themes/`
2. Rename and modify the colors
3. Set `theme = "your-theme-name"` in `~/.config/owlen/config.toml`
4. Or use `:theme your-theme-name` in OWLEN to switch
## Embedding in Binary
These theme files are embedded into the OWLEN binary at compile time using Rust's `include_str!()` macro. This ensures they're always available, even if the files are deleted from disk.
Custom themes placed in `~/.config/owlen/themes/` will override built-in themes with the same name.

23
themes/default_dark.toml Normal file
View File

@@ -0,0 +1,23 @@
name = "default_dark"
text = "white"
background = "black"
focused_panel_border = "lightmagenta"
unfocused_panel_border = "#5f1487"
user_message_role = "lightblue"
assistant_message_role = "yellow"
thinking_panel_title = "lightmagenta"
command_bar_background = "black"
status_background = "black"
mode_normal = "lightblue"
mode_editing = "lightgreen"
mode_model_selection = "lightyellow"
mode_provider_selection = "lightcyan"
mode_help = "lightmagenta"
mode_visual = "magenta"
mode_command = "yellow"
selection_bg = "lightblue"
selection_fg = "black"
cursor = "magenta"
placeholder = "darkgray"
error = "red"
info = "lightgreen"

23
themes/default_light.toml Normal file
View File

@@ -0,0 +1,23 @@
name = "default_light"
text = "black"
background = "white"
focused_panel_border = "#4a90e2"
unfocused_panel_border = "#dddddd"
user_message_role = "#0055a4"
assistant_message_role = "#8e44ad"
thinking_panel_title = "#8e44ad"
command_bar_background = "white"
status_background = "white"
mode_normal = "#0055a4"
mode_editing = "#2e8b57"
mode_model_selection = "#b58900"
mode_provider_selection = "#008b8b"
mode_help = "#8e44ad"
mode_visual = "#8e44ad"
mode_command = "#b58900"
selection_bg = "#a4c8f0"
selection_fg = "black"
cursor = "#d95f02"
placeholder = "gray"
error = "#c0392b"
info = "green"

23
themes/dracula.toml Normal file
View File

@@ -0,0 +1,23 @@
name = "dracula"
text = "#f8f8f2"
background = "#282a36"
focused_panel_border = "#ff79c6"
unfocused_panel_border = "#44475a"
user_message_role = "#8be9fd"
assistant_message_role = "#ff79c6"
thinking_panel_title = "#bd93f9"
command_bar_background = "#44475a"
status_background = "#44475a"
mode_normal = "#8be9fd"
mode_editing = "#50fa7b"
mode_model_selection = "#f1fa8c"
mode_provider_selection = "#8be9fd"
mode_help = "#bd93f9"
mode_visual = "#ff79c6"
mode_command = "#f1fa8c"
selection_bg = "#44475a"
selection_fg = "#f8f8f2"
cursor = "#ff79c6"
placeholder = "#6272a4"
error = "#ff5555"
info = "#50fa7b"

23
themes/gruvbox.toml Normal file
View File

@@ -0,0 +1,23 @@
name = "gruvbox"
text = "#ebdbb2"
background = "#282828"
focused_panel_border = "#fe8019"
unfocused_panel_border = "#7c6f64"
user_message_role = "#b8bb26"
assistant_message_role = "#83a598"
thinking_panel_title = "#d3869b"
command_bar_background = "#3c3836"
status_background = "#3c3836"
mode_normal = "#83a598"
mode_editing = "#b8bb26"
mode_model_selection = "#fabd2f"
mode_provider_selection = "#8ec07c"
mode_help = "#d3869b"
mode_visual = "#fe8019"
mode_command = "#fabd2f"
selection_bg = "#504945"
selection_fg = "#ebdbb2"
cursor = "#fe8019"
placeholder = "#665c54"
error = "#fb4934"
info = "#b8bb26"

23
themes/material-dark.toml Normal file
View File

@@ -0,0 +1,23 @@
name = "material-dark"
text = "#eeffff"
background = "#263238"
focused_panel_border = "#80cbc4"
unfocused_panel_border = "#546e7a"
user_message_role = "#82aaff"
assistant_message_role = "#c792ea"
thinking_panel_title = "#ffcb6b"
command_bar_background = "#212b30"
status_background = "#212b30"
mode_normal = "#82aaff"
mode_editing = "#c3e88d"
mode_model_selection = "#ffcb6b"
mode_provider_selection = "#80cbc4"
mode_help = "#c792ea"
mode_visual = "#f07178"
mode_command = "#ffcb6b"
selection_bg = "#546e7a"
selection_fg = "#eeffff"
cursor = "#ffcc00"
placeholder = "#546e7a"
error = "#f07178"
info = "#c3e88d"

View File

@@ -0,0 +1,23 @@
name = "material-light"
text = "#212121"
background = "#eceff1"
focused_panel_border = "#009688"
unfocused_panel_border = "#b0bec5"
user_message_role = "#448aff"
assistant_message_role = "#7c4dff"
thinking_panel_title = "#f57c00"
command_bar_background = "#ffffff"
status_background = "#ffffff"
mode_normal = "#448aff"
mode_editing = "#388e3c"
mode_model_selection = "#f57c00"
mode_provider_selection = "#009688"
mode_help = "#7c4dff"
mode_visual = "#d32f2f"
mode_command = "#f57c00"
selection_bg = "#b0bec5"
selection_fg = "#212121"
cursor = "#c2185b"
placeholder = "#90a4ae"
error = "#d32f2f"
info = "#388e3c"

View File

@@ -0,0 +1,23 @@
name = "midnight-ocean"
text = "#c0caf5"
background = "#0d1117"
focused_panel_border = "#58a6ff"
unfocused_panel_border = "#30363d"
user_message_role = "#79c0ff"
assistant_message_role = "#89ddff"
thinking_panel_title = "#9ece6a"
command_bar_background = "#161b22"
status_background = "#161b22"
mode_normal = "#79c0ff"
mode_editing = "#9ece6a"
mode_model_selection = "#ffd43b"
mode_provider_selection = "#89ddff"
mode_help = "#ff739d"
mode_visual = "#f68cf5"
mode_command = "#ffd43b"
selection_bg = "#388bfd"
selection_fg = "#0d1117"
cursor = "#f68cf5"
placeholder = "#6e7681"
error = "#f85149"
info = "#9ece6a"

23
themes/monokai.toml Normal file
View File

@@ -0,0 +1,23 @@
name = "monokai"
text = "#f8f8f2"
background = "#272822"
focused_panel_border = "#f92672"
unfocused_panel_border = "#75715e"
user_message_role = "#66d9ef"
assistant_message_role = "#ae81ff"
thinking_panel_title = "#e6db74"
command_bar_background = "#272822"
status_background = "#272822"
mode_normal = "#66d9ef"
mode_editing = "#a6e22e"
mode_model_selection = "#e6db74"
mode_provider_selection = "#66d9ef"
mode_help = "#ae81ff"
mode_visual = "#f92672"
mode_command = "#e6db74"
selection_bg = "#75715e"
selection_fg = "#f8f8f2"
cursor = "#f92672"
placeholder = "#75715e"
error = "#f92672"
info = "#a6e22e"

23
themes/rose-pine.toml Normal file
View File

@@ -0,0 +1,23 @@
name = "rose-pine"
text = "#e0def4"
background = "#191724"
focused_panel_border = "#eb6f92"
unfocused_panel_border = "#26233a"
user_message_role = "#31748f"
assistant_message_role = "#9ccfd8"
thinking_panel_title = "#c4a7e7"
command_bar_background = "#26233a"
status_background = "#26233a"
mode_normal = "#9ccfd8"
mode_editing = "#ebbcba"
mode_model_selection = "#f6c177"
mode_provider_selection = "#31748f"
mode_help = "#c4a7e7"
mode_visual = "#eb6f92"
mode_command = "#f6c177"
selection_bg = "#403d52"
selection_fg = "#e0def4"
cursor = "#eb6f92"
placeholder = "#6e6a86"
error = "#eb6f92"
info = "#9ccfd8"

23
themes/solarized.toml Normal file
View File

@@ -0,0 +1,23 @@
name = "solarized"
text = "#839496"
background = "#002b36"
focused_panel_border = "#268bd2"
unfocused_panel_border = "#073642"
user_message_role = "#2aa198"
assistant_message_role = "#cb4b16"
thinking_panel_title = "#6c71c4"
command_bar_background = "#073642"
status_background = "#073642"
mode_normal = "#268bd2"
mode_editing = "#859900"
mode_model_selection = "#b58900"
mode_provider_selection = "#2aa198"
mode_help = "#6c71c4"
mode_visual = "#d33682"
mode_command = "#b58900"
selection_bg = "#073642"
selection_fg = "#93a1a1"
cursor = "#d33682"
placeholder = "#586e75"
error = "#dc322f"
info = "#859900"