Skip to content

feat(theme): selected text colour as a theme field - #616

Merged
kipavy merged 1 commit into
devfrom
feat/selection-foreground
Oct 11, 2026
Merged

kipavy merged 1 commit into
devfrom
feat/selection-foreground

Conversation

@kipavy

@kipavy kipavy commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Refs #317

Problem

A theme can set the selection background but not the colour of the text inside it. Selected text always keeps its own colours, so a theme cannot reproduce the Termius Dark look from the issue (selected text turns green).

Change

  • TerminalTheme takes an optional selectionForeground. It goes to xterm with the rest of the terminal palette. Unset keeps today's behaviour, so existing themes and the built-in presets are unchanged.
  • Theme creator: new "Selected Text" row under Terminal Base. Unset shows an empty swatch and a dash. The picker opens on the foreground colour, and once a colour is picked the row gets a reset button.
  • terminalColorsFor uses the field for selectionFg, so tmux copy mode follows it. An unparseable value falls back to the foreground.
  • Two new strings in all six locales.
  • The creator's UI and terminal colour rows were two copies of the same markup. They now share ColorRow and RowIconButton.

Testing

  • tsc --noEmit clean, related vitest suites pass (43 tests, 2 new in terminalColors.test.ts).
  • Live debug build in a private headless container, WebGL renderer:
    • pick, reset, pick again, save: the saved theme carries the field and becomes active
    • with the field set, red, yellow and bold cyan lines all take the theme colour while selected
    • clearing the field on the active theme restores per-cell colours in an open terminal without a reload
    • the other colour rows and their highlight buttons still work after the refactor

Not covered

  • Android was not checked.
  • The live run used a debug binary from Oct 9 with the current frontend. The change is frontend-only.
  • Terminal rows still pass the picker a 7-character value, so a translucent selection opens as opaque. Unchanged here.

A theme could set the selection background but not the colour of the text
inside it, so selected text always kept its own colours. Themes now take an
optional selectionForeground, passed to xterm with the rest of the terminal
palette. Leaving it unset keeps today's behaviour, so existing themes and the
built-in presets are unchanged.

The theme creator shows it as "Selected Text" under Terminal Base. An unset
field shows an empty swatch; once a colour is picked the row gets a reset
button. The colour sent to tmux for copy mode follows the field too.

The creator's UI and terminal colour rows were two copies of the same markup.
They now share one row component and one icon button.

Refs #317
@kipavy
kipavy merged commit 65245f1 into dev Oct 11, 2026
5 checks passed
@kipavy
kipavy deleted the feat/selection-foreground branch October 11, 2026 13:32
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.

1 participant