command_palette.ts

 1import { ColorScheme } from "../theme/color_scheme"
 2import { with_opacity } from "../theme/color"
 3import { text, background } from "./components"
 4import { toggleable } from "../element"
 5
 6export default function command_palette(theme: ColorScheme): any {
 7    const key = toggleable({
 8        base: {
 9            text: text(theme.highest, "mono", "variant", "default", {
10                size: "xs",
11            }),
12            corner_radius: 2,
13            background: background(theme.highest, "on"),
14            padding: {
15                top: 1,
16                bottom: 1,
17                left: 6,
18                right: 6,
19            },
20            margin: {
21                top: 1,
22                bottom: 1,
23                left: 2,
24            },
25        },
26        state: {
27            active: {
28                text: text(theme.highest, "mono", "on", "default", {
29                    size: "xs",
30                }),
31                background: with_opacity(background(theme.highest, "on"), 0.2),
32            },
33        },
34    })
35
36    return {
37        keystroke_spacing: 8,
38        // TODO: This should be a Toggle<ContainedText> on the rust side so we don't have to do this
39        key: {
40            inactive: { ...key.inactive },
41            active: key.active,
42        },
43    }
44}