[Feature Request] - Theme / Layout Overrides for Picker
DevOps Toolbox did a great video on your project which brought me here. Read through all the docs and I'm currently configuring wt. I didn't find anything related to styling the wt switch picker command. Are there any plans on allowing users to override the color theme or having dynamic split orientation of the picker?
Theme:
Some of these git status icons end up being harder to read due to contrast issues for the selected row. Maybe extending bat themes or something.
Layout:
Something like vertical vs. horizontal based off of terminal width, similar to how lazygit does it mainPanelSplitMode: "flexible"
Thanks for the suggestion, and welcome! 👋
This is a feature request rather than a bug, so I'll leave it for a maintainer to evaluate and prioritize.
Worth noting that #1184 covers a related concern around color legibility in console output — the contrast issue you mention for the selected row in the picker may overlap with that discussion.
thanks for the issue!
Something like vertical vs. horizontal based off of terminal width, similar to how
lazygitdoes itmainPanelSplitMode: "flexible"
we do actually have this! But I guess the claim is that we should lean towards top-and-bottom more, which seems reasonable given the example above...
we could add custom color schemes. I was keener to keep on a single color scheme unless we really needed to extend — the additional config options mean we face less pressure to make the standard config options good, and make the configs a bit less cognizable
the main thing I see that looks bad is the ? in status with the selection bar. Are there other things you immediately see? I know folks' perceptions can be different...
thanks for the issue!
Something like vertical vs. horizontal based off of terminal width, similar to how
lazygitdoes itmainPanelSplitMode: "flexible"we do actually have this! But I guess the claim is that we should lean towards top-and-bottom more, which seems reasonable given the example above...
we could add custom color schemes. I was keener to keep on a single color scheme unless we really needed to extend — the additional config options mean we face less pressure to make the standard config options good, and make the configs a bit less cognizable
the main thing I see that looks bad is the
?in status with the selection bar. Are there other things you immediately see? I know folks' perceptions can be different...
I guess not necessarily lean towards it. Just because some people might have their own preferences based on a variety of factors (zoom level, number of worktrees, monitor size, etc.). I was thinking sane defaults with a way to override the breakpoint would be ideal.
As for the color. I guess that's a harder one to decide. I've seen tools do full on themes, tap into a list of predefined themes (delta), ability to override specific items of the UI (I think bacon does something like this), or reading the terminal's theme. Not quite sure the lift to get this going. But you know devs, they can get pretty picky about their terminal ricing. If you want to avoid bloating the main config, maybe having a sibling themes directory in .config/ that the user can reference some UI elements and that gets sourced into the main config.
we use ansi colors, which refer to named colors, and the terminal interprets based on its theme. rather than exact colors
the advantage of that approach is we're intrinsically compatible with themes, because we are the theme
one exception seems to be dim bright black! which lots of themes don't show clearly. so I'm changing that
so we should ground in the cases: if there are other colors we use that are commonly imperfect in themes, let's fix those! otherwise I would lean away from doing our own color customizations
is that reasonable?
please reopen / comment with any more cases that look bad; thanks!
Some branches seem to get very poor contrast for me. I'm not sure why some are rendered differently.
This is how most look:
I'm using wezterm with this theme: https://github.com/thesimonho/kanagawa-paper.nvim/master/extras/wezterm/kanagawa-paper-ink.toml
@willparsons the faint rows are deliberate: gray branch text marks a branch that's already integrated into the default branch (or sits at the same commit), meaning it's safe to remove. Under the picker's selection bar that faint text used to wash out, as in your first screenshot. #3267 fixed it in v0.63.0: on the selected row, that text is now drawn in a solid mid-gray (palette 245) instead of faint.
In your screenshot the selected row's text is #DCD7BA, which is kanagawa-paper's default foreground, not the 245 gray the fix draws. So I suspect you're on a release older than 0.63. Can you check wt --version? If you're on 0.63 or later and still see this, please say so and we'll dig in, because that would be a real bug.
I'm on version 0.80.0.
Let me know if there's anything I can to aid debugging.
@willparsons thanks for checking. You're right, this is a real bug, and it's a different one from what I guessed.
/ chore/tsdown-update is a branch with no worktree, and it isn't one of the faint "safe to remove" rows. Branch-only rows start with a dim / marker followed by a color reset, and that reset leaves the branch name pinned to your terminal's default foreground (#DCD7BA). On the selected row, that color overrides the picker's dark selected-row text (237), so you get light text on the light bar. Worktree rows like main don't have the reset, which is why they look fine.
#4408 fixes this by letting text after a reset use the selected row's dark text color. No config or theme change is needed on your side.
Another case: on a dark theme the selection bar (current_bg:251, #c6c6c6) is very bright, and branch names on dimmed rows are hard to read on it, even with the 245 gray from #3267. On a light theme the same bar looks fine. Unlike the rest of the picker, the bar is a fixed 256-color gray rather than one of the theme's colors, so it can't follow a dark theme the way the other colors do.
@disrupted confirmed. With the standard xterm 256-color palette, the selected row draws faint text in 245 (#8a8a8a) on the 251 bar (#c6c6c6). That's a contrast ratio of about 2.0:1, well under the 4.5:1 WCAG asks for body text. The bar's normal text (237) gets about 6.7:1, so only the dimmed rows have the problem. Those are the same colors on a light theme, so the difference you see is the bar standing out against a dark background rather than a different palette.
Both colors are hardcoded. The bar is set in picker/mod.rs, and the comment there explains why a light bar was chosen as the compromise for both theme types. The faint gray is SELECTED_FAINT_FG in picker/items.rs.
I see two ways to fix it:
- Darken the faint gray under the bar. 241 (
#626262) reaches about 3.6:1 and 240 about 4.2:1, and both still read lighter than the 237 normal text. This is a one-constant change, but the bar stays bright on dark themes. - Rethink the bar itself, for example by using a theme-relative color instead of a fixed gray. This addresses what you describe, but it reopens the tradeoff recorded in that comment, so it's a call for @max-sixty.
Happy to open a PR for the first option if that's the direction.
@worktrunk-bot the first one would already help somewhat until we can decide on a long-term solution
@disrupted opened #4796. It changes the selected row's faint text from 245 to 240 (#585858), which takes contrast on the 251 bar from about 2.0:1 to about 4.2:1 while still keeping it lighter than the normal 237 text. The bar color itself is unchanged, so the longer-term question stays open here.