terminal.ts

 1import { ColorScheme } from "../theme/colorScheme"
 2import { StyleTree } from "../types"
 3
 4export default function terminal(theme: ColorScheme): StyleTree.TerminalStyle {
 5    /**
 6     * Colors are controlled per-cell in the terminal grid.
 7     * Cells can be set to any of these more 'theme-capable' colors
 8     * or can be set directly with RGB values.
 9     * Here are the common interpretations of these names:
10     * https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
11     */
12    return {
13        black: theme.ramps.neutral(0).hex(),
14        red: theme.ramps.red(0.5).hex(),
15        green: theme.ramps.green(0.5).hex(),
16        yellow: theme.ramps.yellow(0.5).hex(),
17        blue: theme.ramps.blue(0.5).hex(),
18        magenta: theme.ramps.magenta(0.5).hex(),
19        cyan: theme.ramps.cyan(0.5).hex(),
20        white: theme.ramps.neutral(1).hex(),
21        bright_black: theme.ramps.neutral(0.4).hex(),
22        bright_red: theme.ramps.red(0.25).hex(),
23        bright_green: theme.ramps.green(0.25).hex(),
24        bright_yellow: theme.ramps.yellow(0.25).hex(),
25        bright_blue: theme.ramps.blue(0.25).hex(),
26        bright_magenta: theme.ramps.magenta(0.25).hex(),
27        bright_cyan: theme.ramps.cyan(0.25).hex(),
28        bright_white: theme.ramps.neutral(1).hex(),
29        /**
30         * Default color for characters
31         */
32        foreground: theme.ramps.neutral(1).hex(),
33        /**
34         * Default color for the rectangle background of a cell
35         */
36        background: theme.ramps.neutral(0).hex(),
37        modal_background: theme.ramps.neutral(0.1).hex(),
38        /**
39         * Default color for the cursor
40         */
41        cursor: theme.players[0].cursor,
42        dim_black: theme.ramps.neutral(1).hex(),
43        dim_red: theme.ramps.red(0.75).hex(),
44        dim_green: theme.ramps.green(0.75).hex(),
45        dim_yellow: theme.ramps.yellow(0.75).hex(),
46        dim_blue: theme.ramps.blue(0.75).hex(),
47        dim_magenta: theme.ramps.magenta(0.75).hex(),
48        dim_cyan: theme.ramps.cyan(0.75).hex(),
49        dim_white: theme.ramps.neutral(0.6).hex(),
50        bright_foreground: theme.ramps.neutral(1).hex(),
51        dim_foreground: theme.ramps.neutral(0).hex(),
52    }
53}