From 57c0c0bc9f86467d90c0c10aac680bdba8e56469 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:22:08 +0300 Subject: [PATCH] feat(toggle): add more `M.wk` fields for better user customization (#4521) ## Description Add to `M.wk` fields for `icon`, `color_enabled` and `color_disabled` for more granual user customization. ## Related Issue(s) No, rather a discussion #4512 ## Screenshots ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/util/toggle.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/util/toggle.lua b/lua/lazyvim/util/toggle.lua index 46e92c78..d693dd9d 100644 --- a/lua/lazyvim/util/toggle.lua +++ b/lua/lazyvim/util/toggle.lua @@ -3,6 +3,9 @@ local M = {} ---@class lazyvim.Toggle ---@field name string +---@field icon? string +---@field color_enabled? string +---@field color_disabled? string ---@field get fun():boolean ---@field set fun(state:boolean) @@ -50,7 +53,8 @@ function M.wk(lhs, toggle) { lhs, icon = function() - return safe_get() and { icon = " ", color = "green" } or { icon = " ", color = "yellow" } + return safe_get() and { icon = toggle.icon or " ", color = toggle.color_enabled or "green" } + or { icon = toggle.icon or " ", color = toggle.color_disabled or "yellow" } end, desc = function() return (safe_get() and "Disable " or "Enable ") .. toggle.name