feat: add theme selection palette

Also, refactor to share palette code and make palettes scroll properly
with the mouse wheel.
This commit is contained in:
CJ van den Berg 2024-08-14 21:27:32 +02:00
parent 8c3c786357
commit 4b6c08154b
11 changed files with 675 additions and 490 deletions

View file

@ -42,6 +42,7 @@ pub fn create(a: std.mem.Allocator, parent: Widget) !Widget {
try self.menu.add_item_with_handler("Open recent project ·(wip)·· :r", menu_action_open_recent_project);
try self.menu.add_item_with_handler("Show/Run commands ·········· :p", menu_action_show_commands);
try self.menu.add_item_with_handler("Open config file ··········· :c", menu_action_open_config);
try self.menu.add_item_with_handler("Change theme ··············· :t", menu_action_change_theme);
try self.menu.add_item_with_handler("Quit/Close ················· :q", menu_action_quit);
self.menu.resize(.{ .y = 15, .x = 9, .w = 32 });
command.executeName("enter_mode", command.Context.fmt(.{"home"})) catch {};
@ -126,6 +127,10 @@ fn menu_action_open_config(_: **Menu.State(*Self), _: *Button.State(*Menu.State(
command.executeName("open_config", .{}) catch {};
}
fn menu_action_change_theme(_: **Menu.State(*Self), _: *Button.State(*Menu.State(*Self))) void {
command.executeName("change_theme", .{}) catch {};
}
fn menu_action_quit(_: **Menu.State(*Self), _: *Button.State(*Menu.State(*Self))) void {
command.executeName("quit", .{}) catch {};
}