Skip to content

Configurable keymaps, colors #58

Open

Description

@jadonwb

Hello, I have noticed that keymaps and colors are not configurable right now, the main navigation works for me since I use vim, but often times people who don't use qwerty need to remap hjkl to something else. I also personally like ^ to be start of line instead of 0.

Also I like that it uses my terminal colors, but I would like to be able to pick some of those choices, like markdown headers, or tweak the highlight color. I use a light theme and the current choice of color for selection/visual/highlight is kinda hard to read.

I am willing to tackle this myself if that is okay, but I thought I would mention it here in case you have a preferred way of doing this.

I haven't explored the source too deeply yet so it won't be immediate if I do take a look (and I'm busy this next week or so).

Activity

  1. backnotprop commented on Sep 2, 2026

    @backnotprop
    Contributor

    Accepted, and yes, please take it. No rush; a week or two is fine.

    A few notes so you can build against the shape we'd merge:

    Config. There's already a strict TOML config at ~/.config/plannotator-tui/config.toml (see crates/plannotator-tui/src/config.rs). Add [keys] and [colors] tables there rather than new files. Keep the existing rules: deny_unknown_fields, defaults identical to today's behavior, and an unknown key, action name, or color string is an error that names it. plannotator-tui config should print the effective values.

    Keys. All bindings live in crates/plannotator-tui/src/app/input.rs, one dispatch per mode. Map action names to a list of keys, e.g.

    [keys]
    left = ["h", "Left"]
    line-start = ["^", "Home"]

    so a user can rebind hjkl without losing the arrow keys. The README key table is the list of actions; please keep it in sync.

    Colors. Name the semantic roles we actually have rather than a theme engine: heading, selection, cursor, comment, looks-good, delete, and the toolbar/header backgrounds. Constants are at the top of app/draw.rs, app/header.rs, and layout.rs. Accept the usual ratatui color strings (yellow, #ffcc00, 238). The selection is currently REVERSED, which is the light-theme problem you're hitting, so making that a real style is the right fix.

    Two PRs, keys first, is easiest to review. Tests are plain unit tests next to the code, and cargo test plus cargo clippy gate CI. Ask here if anything in the source is unclear.

  2. alesch commented on Sep 9, 2026

    @alesch

    Confirmed repro on a light terminal, in case it's useful for the [colors] work.

    Env: plannotator-tui 0.7.0 (x86_64-unknown-linux-gnu), Solarized Light terminal (light bg, dark default fg). Seen both standalone and via herdr-annotate 0.3.0.

    In practice the most unreadable parts aren't the REVERSED selection — they're the absolute 256-color background constants, which don't adapt to a light background at all:

    • BLOCK_BG = Color::Indexed(236) (app/draw.rs:27) — used for the focused block (app/draw.rs:169) and the focused file-tree row (app/draw.rs:133). Renders as a #303030 bar under the terminal's dark default fg → near-invisible text.
    • TOOLBAR_BG = Color::Indexed(238) (app/draw.rs:28, applied at :245/:250) — the bottom help bar.
    • CURSOR_BG = Color::Indexed(240) (app/draw.rs:29, applied at :205) — the keyboard cursor cell.

    The .reversed() picker row (app/pick.rs:159) and char selection (app/draw.rs:198) are also low-contrast, matching your note.

    So the semantic roles you listed cover it — two small notes for whoever implements it:

    • "selection" needs to include the block highlight, not just char selection.
    • the file-tree row currently shares BLOCK_BG, so it wants the same role or its own.

    Screenshot below (Solarized Light): the dark bar over the first paragraph is the focused block; the "which message?" picker popup shows the same problem.

  3. backnotprop commented on Sep 9, 2026

    @backnotprop
    Contributor

    Thanks, that's useful and precise. Agreed: the three indexed backgrounds (block, toolbar, cursor) are the real light-theme problem, and the [colors] roles should cover the block highlight and the tree row, not just the character selection. @jadonwb this is a good checklist for the colors half when you get there.

  4. alesch commented on Sep 16, 2026

    @alesch

    Have you seen this herdr proposal?
    It seems the right thing to do: Inherit the theme from herdr...

  5. backnotprop commented on Sep 21, 2026

    @backnotprop
    Contributor

    Readable defaults for light terminals shipped in v0.9.2 (#85). At startup the TUI asks the terminal for its background colour and, if it's light, uses a light set of the painted backgrounds: focused block, toolbar, cursor, comment and approve tints, and a solid selection instead of reverse video. Dark terminals get exactly the previous colours. Two overrides for terminals that don't answer or if you want to force it: theme = "light" | "dark" | "auto" under [ui] in config.toml, or PLANNOTATOR_TUI_THEME; plannotator-tui config shows the effective value. @alesch, thanks for the precise contrast notes; this covers the three indexed backgrounds you listed plus the tree row. @jadonwb, the [keys] and [colors] tables are still yours if you want them; the new theme.rs palette is the natural place for [colors] to hook in.

  6. jadonwb commented on Sep 22, 2026

    @jadonwb
    Author

    I appreciate the updates, however I have not had much time, so please do not wait on me if you already have a good idea on where to start.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions