Skip to content

Conversation

@alycda
Copy link

@alycda alycda commented Oct 25, 2025

Adds a new --theme (-t) command-line option that allows specifying a direct path to a CUSTOM theme file, similar to how --config works for the configuration file. This is useful for environments like Nix where avoiding symlinks and using CLI overrides is preferred.

The --theme flag takes precedence over the theme specified in the config file (whether custom or not) and supports theme inheritance via the 'inherits' field (which the config override file does not).

Usage: hx --theme /path/to/theme.toml file.txt

Adds a new --theme (-t) command-line option that allows specifying a
direct path to a theme file, similar to how --config works for
configuration files. This is useful for environments like Nix where
avoiding symlinks and using CLI overrides is preferred.

The --theme flag takes precedence over the theme specified in the
config file and supports theme inheritance via the 'inherits' field.

Usage: hx --theme /path/to/theme.toml file.txt

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@alycda
Copy link
Author

alycda commented Oct 25, 2025

alternatively, the --config flag could be updated to point to a directory override instead of single file?

@alycda alycda marked this pull request as draft October 25, 2025 11:09
@alycda
Copy link
Author

alycda commented Oct 25, 2025

I tested with:

HELIX_RUNTIME="$(nix-store -q $(which hx))/lib/runtime" ~helix/target/release/hx --theme ./helix/helix-config/themes/mine.toml

as the runtime was needed so my local build could find the built-in theme files.

with CUSTOM theme:

inherits = "boo_berry"

"ui.background" = {}

"ui.cursor.primary.select" = { fg = "berry", bg = "bubblegum" }
"ui.cursor.primary.insert" = { fg = "berry", bg = "mint" }

and output (logs not committed):

DEBUG: Theme file specified: ./helix/helix-config/themes/mine.toml
DEBUG: Loading theme from file: ./helix/helix-config/themes/mine.toml
DEBUG: Searching for theme 'boo_berry' in directories:
DEBUG:   - ~/.config/helix/themes
DEBUG:   - ~/.config/helix/runtime/themes
DEBUG:   - /nix/store/xkqwkr94b9p123qjcy1kcdq0r6h88ijc-helix-25.07.1/lib/runtime/themes
DEBUG:   - ~/helix/target/release/runtime/themes

@alycda alycda marked this pull request as ready for review October 25, 2025 11:47
@the-mikedavis
Copy link
Member

You can control the configured theme with -c/--config already. Including the theme in the package means including it in your runtime directory - historically you could put themes in ~/.config/helix/themes/*.toml but it should be within a runtime directory like ~/.config/helix/runtime / $HELIX_RUNTIME (or the compiled-in versions) instead. We want to keep the number of CLI flags small since Helix is interactive, so I'm not inclined to accept anything like this.

@alycda
Copy link
Author

alycda commented Oct 26, 2025

@the-mikedavis I understand not wanting to add another cli flag and you're correct that I can specify a non-custom theme in the --config file but I cannot specify a custom theme. I'm wondering if the --config flag should be used for a directory containing the files instead of the config file itself (apologies if this has already been discussed and rejected, I couldn't find any issues regarding that idea). if --config were a directory, then languages.toml could/should also be read from the directory override.

if I updated this pr with a new flag --config-folder might that be something you would accept? Keeping --config(-file) for backwards compatibility. I previously had the assumption that --config flag was for a folder since there are a handful of configuration files.

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