diff options
author | Cyriaque Skrapits <cysoun@gmail.com> | 2023-10-27 21:48:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-27 21:48:55 +0200 |
commit | 9fec01149ec391194f9eaa0d5e3926f14a9e0b80 (patch) | |
tree | 142037289773828fff7521456e74188d772987ee /plugins | |
parent | f02ce208852d5682c4a088e40ad9958bfb6180a4 (diff) | |
download | lite-xl-plugins-9fec01149ec391194f9eaa0d5e3926f14a9e0b80.tar.gz lite-xl-plugins-9fec01149ec391194f9eaa0d5e3926f14a9e0b80.zip |
gitstatus: color icons as well (#164)
* gitstatus: also color icons
* gitstatus: add flag to toggle colored icons
* gitstatus: add `color_icons` in config_spec
* gitstatus: bump version to 0.2
* Update plugins/gitstatus.lua
Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
---------
Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/gitstatus.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/gitstatus.lua b/plugins/gitstatus.lua index 9a36142..04f6b15 100644 --- a/plugins/gitstatus.lua +++ b/plugins/gitstatus.lua @@ -7,11 +7,19 @@ local StatusView = require "core.statusview" local TreeView = require "plugins.treeview" config.plugins.gitstatus = common.merge({ + color_icons = true, recurse_submodules = true, -- The config specification used by the settings gui config_spec = { name = "Git Status", { + label = "Colorize icons", + description = "Colorize the icons as well", + path = "color_icons", + type = "toggle", + default = true + }, + { label = "Recurse Submodules", description = "Also retrieve git stats from submodules.", path = "recurse_submodules", @@ -39,6 +47,15 @@ function TreeView:get_item_text(item, active, hovered) return text, font, color end +-- Override TreeView's get_item_icon to add modification color +local treeview_get_item_icon = TreeView.get_item_icon +function TreeView:get_item_icon(item, active, hovered) + local character, font, color = treeview_get_item_icon(self, item, active, hovered) + if config.plugins.gitstatus and config.plugins.gitstatus.color_icons and cached_color_for_item[item.abs_filename] then + color = cached_color_for_item[item.abs_filename] + end + return character, font, color +end local git = { branch = nil, |