From fb1df784642ed3bf695db826aebc1e82a1a4513b Mon Sep 17 00:00:00 2001 From: Joshua Minor Date: Sun, 21 Nov 2021 15:24:45 -0800 Subject: [PATCH] Switched to TreeView:color_for_item(abs_path) --- data/plugins/treeview.lua | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/data/plugins/treeview.lua b/data/plugins/treeview.lua index 7531fb87..659393ec 100644 --- a/data/plugins/treeview.lua +++ b/data/plugins/treeview.lua @@ -42,7 +42,6 @@ function TreeView:new() self.target_size = default_treeview_size self.cache = {} self.tooltip = { x = 0, y = 0, begin = 0, alpha = 0 } - self.color_overrides = {} end @@ -281,13 +280,9 @@ function TreeView:draw_tooltip() end -function TreeView:set_color_override(abs_filename, color) - self.color_overrides[abs_filename] = color -end - - -function TreeView:clear_all_color_overrides() - self.color_overrides = {} +function TreeView:color_for_item(abs_filename) + -- other plugins can override this to customize the color of each icon + return nil end @@ -315,7 +310,7 @@ function TreeView:draw() end -- allow for color overrides - local icon_color = self.color_overrides[item.abs_filename] or color + local icon_color = self:color_for_item(item.abs_filename) or color -- icons x = x + item.depth * style.padding.x + style.padding.x