summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/builtins.zig')
-rw-r--r--src/builtins.zig32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/builtins.zig b/src/builtins.zig
index 7e20a95b..620c6b1c 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -182,6 +182,38 @@ pub const NextColor = struct {
}
};
+/// The theme BY NAME — `Theme acme`. The ring grew past the point where
+/// cycling to the one you want is reasonable, so this is the way to ask for
+/// one, and NextColor stays as the way to browse. Inert without an argument
+/// (there is no theme called nothing), which is also why it has no leader path:
+/// a key path names a builtin and can never carry the name of a theme.
+///
+/// A LINEAR SCAN over a couple of dozen names, on a keystroke: the alternative
+/// is a comptime name->index map, which is a second copy of the ring to build
+/// for a lookup nobody will ever measure.
+pub const Theme = struct {
+ pub fn run(c: Ctx) void {
+ const want = std.mem.trim(u8, c.arg orelse return, " \t\r\n");
+ for (pardes.themes, 0..) |t, i| {
+ if (std.mem.eql(u8, t.name, want)) {
+ c.p.theme_idx = i;
+ return;
+ }
+ }
+ }
+};
+
+/// ...and the list of what Theme takes, as a buffer you walk. Its rows are
+/// `Theme <name>` COMMANDS rather than locations, so n/N execute them instead
+/// of looking them (output_pane.Traits.executes) and stepping the list wears
+/// each theme in turn — the picker is the list, and there is nothing to
+/// confirm because arriving already applied it.
+pub const ThemeSel = struct {
+ pub fn run(c: Ctx) void {
+ output_pane.openThemes(c.p, c.id);
+ }
+};
+
pub const Crt = struct {
pub fn run(c: Ctx) void {
c.p.crt_on = !c.p.crt_on;