terminal.ts

 1import { ColorScheme } from "../themes/common/colorScheme";
 2
 3export default function terminal(colorScheme: ColorScheme) {
 4  /**
 5   * Colors are controlled per-cell in the terminal grid.
 6   * Cells can be set to any of these more 'theme-capable' colors
 7   * or can be set directly with RGB values.
 8   * Here are the common interpretations of these names:
 9   * https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
10   */
11  return {
12    black: colorScheme.ramps.neutral(0).hex(),
13    red: colorScheme.ramps.red(0.5).hex(),
14    green: colorScheme.ramps.green(0.5).hex(),
15    yellow: colorScheme.ramps.yellow(0.5).hex(),
16    blue: colorScheme.ramps.blue(0.5).hex(),
17    magenta: colorScheme.ramps.magenta(0.5).hex(),
18    cyan: colorScheme.ramps.cyan(0.5).hex(),
19    white: colorScheme.ramps.neutral(1).hex(),
20    brightBlack: colorScheme.ramps.neutral(0.4).hex(),
21    brightRed: colorScheme.ramps.red(0.25).hex(),
22    brightGreen: colorScheme.ramps.green(0.25).hex(),
23    brightYellow: colorScheme.ramps.yellow(0.25).hex(),
24    brightBlue: colorScheme.ramps.blue(0.25).hex(),
25    brightMagenta: colorScheme.ramps.magenta(0.25).hex(),
26    brightCyan: colorScheme.ramps.cyan(0.25).hex(),
27    brightWhite: colorScheme.ramps.neutral(1).hex(),
28    /**
29     * Default color for characters
30     */
31    foreground: colorScheme.ramps.neutral(1).hex(),
32    /**
33     * Default color for the rectangle background of a cell
34     */
35    background: colorScheme.ramps.neutral(0).hex(),
36    modalBackground: colorScheme.ramps.neutral(0.1).hex(),
37    /**
38     * Default color for the cursor
39     */
40    cursor: colorScheme.players[0].cursor,
41    dimBlack: colorScheme.ramps.neutral(1).hex(),
42    dimRed: colorScheme.ramps.red(0.75).hex(),
43    dimGreen: colorScheme.ramps.green(0.75).hex(),
44    dimYellow: colorScheme.ramps.yellow(0.75).hex(),
45    dimBlue: colorScheme.ramps.blue(0.75).hex(),
46    dimMagenta: colorScheme.ramps.magenta(0.75).hex(),
47    dimCyan: colorScheme.ramps.cyan(0.75).hex(),
48    dimWhite: colorScheme.ramps.neutral(0.6).hex(),
49    brightForeground: colorScheme.ramps.neutral(1).hex(),
50    dimForeground: colorScheme.ramps.neutral(0).hex(),
51  };
52}