xonecas.io
64875
Mc

mini-coder / files

mini-coder / src / tui / styles.ts

933 bytes
1import { NORMAL_FG, PALETTE, sgrFg } from "./theme.ts";
2
3/**
4 * Inline foreground styling from the palette. The foreground is restored by
5 * re-asserting `Normal`'s, never by resetting: the row's background, set by the
6 * renderer, must survive, and no cell may fall back to the terminal's colours.
7 */
8const fg = (hex: string) => (text: string): string => `${sgrFg(hex)}${text}${sgrFg(NORMAL_FG)}`;
9
10/** `Comment`, the colour diff context lines share. */
11export const dim = fg(PALETTE.comment);
12export const red = fg(PALETTE.red);
13export const green = fg(PALETTE.green);
14export const yellow = fg(PALETTE.yellow);
15/** Diff hunk headers; the palette's `blue` sits closest to the old ANSI cyan. */
16export const cyan = fg(PALETTE.blue);
17/** The user's own words; also `Function`, which user rows never collide with. */
18export const blue = fg(PALETTE.blue);
19/** The tool accent: call-line heads. */
20export const teal = fg(PALETTE.teal);