1import Theme from "../themes/common/theme";
2import { border, modalShadow, player } from "./components";
3
4export default function terminal(theme: Theme) {
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 let colors = {
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(7).hex(),
21 brightBlack: theme.ramps.neutral(4).hex(),
22 brightRed: theme.ramps.red(0.25).hex(),
23 brightGreen: theme.ramps.green(0.25).hex(),
24 brightYellow: theme.ramps.yellow(0.25).hex(),
25 brightBlue: theme.ramps.blue(0.25).hex(),
26 brightMagenta: theme.ramps.magenta(0.25).hex(),
27 brightCyan: theme.ramps.cyan(0.25).hex(),
28 brightWhite: theme.ramps.neutral(7).hex(),
29 /**
30 * Default color for characters
31 */
32 foreground: theme.ramps.neutral(7).hex(),
33 /**
34 * Default color for the rectangle background of a cell
35 */
36 background: theme.ramps.neutral(0).hex(),
37 modalBackground: theme.ramps.neutral(1).hex(),
38 /**
39 * Default color for the cursor
40 */
41 cursor: player(theme, 1).selection.cursor,
42 dimBlack: theme.ramps.neutral(7).hex(),
43 dimRed: theme.ramps.red(0.75).hex(),
44 dimGreen: theme.ramps.green(0.75).hex(),
45 dimYellow: theme.ramps.yellow(0.75).hex(),
46 dimBlue: theme.ramps.blue(0.75).hex(),
47 dimMagenta: theme.ramps.magenta(0.75).hex(),
48 dimCyan: theme.ramps.cyan(0.75).hex(),
49 dimWhite: theme.ramps.neutral(5).hex(),
50 brightForeground: theme.ramps.neutral(7).hex(),
51 dimForeground: theme.ramps.neutral(0).hex(),
52 };
53
54 return {
55 colors,
56 modalContainer: {
57 background: colors.modalBackground,
58 cornerRadius: 8,
59 padding: 8,
60 margin: 25,
61 border: border(theme, "primary"),
62 shadow: modalShadow(theme),
63 },
64 };
65}