From 34e78eb25f3c2c7646686d00904c117feab105ec Mon Sep 17 00:00:00 2001 From: Rafael-Ordaz_nabors Date: Tue, 9 Jun 2026 15:33:21 -0500 Subject: [PATCH] feat: add option to remove all tab colors from context menu --- main.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/main.ts b/main.ts index 3a7632e..7e4782f 100644 --- a/main.ts +++ b/main.ts @@ -89,6 +89,12 @@ export default class ColorTabPlugin extends Plugin { item.setIcon("x"); item.onClick(() => this.removeTabColor(leaf)); }); + + menu.addItem((item) => { + item.setTitle("Remove all tabs' color"); + item.setIcon("x-circle"); + item.onClick(() => this.removeAllTabColors()); + }); } // ── Color application ───────────────────────────────────────────────────── @@ -111,6 +117,14 @@ export default class ColorTabPlugin extends Plugin { this.applyColorToLeaf(leaf, null); } + removeAllTabColors() { + this.settings.fileColors = {}; + this.saveSettings(); + this.app.workspace.iterateAllLeaves((leaf) => + this.applyColorToLeaf(leaf, null) + ); + } + applyColorToLeaf(leaf: WorkspaceLeaf, color: string | null) { const tabHeader = ( leaf as unknown as { tabHeaderEl: HTMLElement }