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 }