Skip to content

Add user theme support - #79

Merged
jeremy merged 3 commits into
mainfrom
styled-theme
Jan 26, 2026
Merged

jeremy merged 3 commits into
mainfrom
styled-theme

Conversation

@jeremy

@jeremy jeremy commented Jan 26, 2026

Copy link
Copy Markdown
Member

Summary

  • Add support for user-defined themes via ~/.config/bcq/theme/colors.toml
  • Auto-detect and link Omarchy theme during installation
  • Support NO_COLOR env var (industry standard for disabling colors)
  • Support BCQ_THEME env var for custom theme file path

How it works

bcq looks for its own theme config at ~/.config/bcq/theme/colors.toml. On systems like Omarchy, users symlink to their system theme:

ln -s ~/.config/omarchy/current/theme ~/.config/bcq/theme

The installer automatically creates this symlink if Omarchy is detected.

Color mapping

colors.toml bcq semantic
accent / color4 Primary
color1 Error (red)
color2 Success (green)
color3 Warning (yellow)
color7 Secondary
color8 Muted, Border
foreground Foreground
background Background

Test plan

  • make check passes
  • Test on Omarchy: verify theme colors match system theme
  • Test NO_COLOR=1 bcq projects disables colors
  • Test BCQ_THEME=/path/to/colors.toml uses custom theme
  • Test fallback to default theme when no config exists

Resolve theme from ~/.config/bcq/theme/colors.toml, falling back to
the default Material Design theme. Supports:

- NO_COLOR env var (industry standard for disabling colors)
- BCQ_THEME env var for custom theme file path
- User theme directory can be symlinked to system themes

Color mapping from terminal color formats:
- accent/color4 → Primary
- color1 → Error, color2 → Success, color3 → Warning
- color7 → Secondary, color8 → Muted/Border
- foreground/background → Foreground/Background
If ~/.config/omarchy/current/theme exists, symlink it to
~/.config/bcq/theme so bcq automatically uses the system theme.
Copilot AI review requested due to automatic review settings January 26, 2026 07:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive user theme support to bcq, enabling users to customize colors through configuration files, environment variables, or symlinks to system themes like Omarchy.

Changes:

  • Added ResolveTheme() function with precedence: NO_COLOR → BCQ_THEME env → user config (~/.config/bcq/theme/colors.toml) → default
  • Implemented lightweight TOML parser for theme files with validation
  • Updated installer to auto-detect and symlink Omarchy theme during installation

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
internal/tui/theme.go Core theme resolution logic with TOML parsing, color validation, and mapping to bcq semantic colors
internal/tui/theme_test.go Comprehensive test coverage for theme parsing, validation, and resolution logic
internal/output/render.go Integration of ResolveTheme() into NewRenderer() to apply user themes to CLI output
scripts/install.sh Added setup_theme() function to auto-detect and symlink Omarchy theme during installation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/install.sh Resolved
Comment thread internal/tui/theme_test.go Resolved
Comment thread internal/tui/theme_test.go Resolved
Comment thread internal/tui/theme.go Resolved
Comment thread internal/output/render.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a614dbe539

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/tui/theme.go Resolved
- Strip inline TOML comments before parsing (e.g., `accent = "#89b4fa" # blue`)
- Add test cases for inline comments and unquoted values
- Improve test isolation in ResolveTheme tests
- Add dedicated LoadUserTheme test coverage
- Clarify render.go comment to not reference Omarchy specifically
- Add error handling for symlink creation in installer
@jeremy
jeremy enabled auto-merge (squash) January 26, 2026 07:40
@jeremy
jeremy merged commit 6480442 into main Jan 26, 2026
8 checks passed
@jeremy
jeremy deleted the styled-theme branch January 26, 2026 07:41
jeremy added a commit that referenced this pull request Feb 19, 2026
* Add user theme support with colors.toml

Resolve theme from ~/.config/bcq/theme/colors.toml, falling back to
the default Material Design theme. Supports:

- NO_COLOR env var (industry standard for disabling colors)
- BCQ_THEME env var for custom theme file path
- User theme directory can be symlinked to system themes

Color mapping from terminal color formats:
- accent/color4 → Primary
- color1 → Error, color2 → Success, color3 → Warning
- color7 → Secondary, color8 → Muted/Border
- foreground/background → Foreground/Background

* Auto-link Omarchy theme in installer

If ~/.config/omarchy/current/theme exists, symlink it to
~/.config/bcq/theme so bcq automatically uses the system theme.

* Address PR review feedback

- Strip inline TOML comments before parsing (e.g., `accent = "#89b4fa" # blue`)
- Add test cases for inline comments and unquoted values
- Improve test isolation in ResolveTheme tests
- Add dedicated LoadUserTheme test coverage
- Clarify render.go comment to not reference Omarchy specifically
- Add error handling for symlink creation in installer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants