Let a color setting track a live palette index instead of a frozen RGB
value, addressing issue 12991. OSC 1337 SetColors=<name>=i:N binds the
color to palette index N (0-15 follow the loaded preset and dark mode;
16-255 are the fixed cube and grayscale ramp), so a badge or tab color
can follow the preset rather than a hardcoded color.
Implementation reuses the existing expression-binding system:
- Expose the live palette as a colors.* variable scope
(colors.ansi.<name>, colors.indexed[N], and named colors) in
iTermColorScopeVariables, updated from the color map.
- SetColors=<name>=i:N writes a KEY_BINDINGS entry so the standard
binding observer applies and re-applies the color reactively.
- Alpha: an optional @A suffix (badge only) and a new
iterm2.with_alpha(color:, alpha:) built-in, honored only by colors
that render with alpha (badge and cursor guide).
- Ownership: palette bindings are tagged {expression, owner} in
KEY_BINDINGS so a concrete override or reset clears only the bindings
this feature created, never a user-authored one, without inspecting
expression text.
- Override/reset/baseline handling so a concrete SetColors, an OSC
110/111 reset, a UI color pick, or a tab clear defeats the binding,
and a later reset restores the Edit-Session value.
Adds ModernTests/iTermColorScopeVariablesTests and release notes in
docs/notes-3.7.1.txt.