feat: add option to remove all tab colors from context menu

This commit is contained in:
Rafael-Ordaz_nabors 2026-06-09 15:33:21 -05:00
parent 524489ae11
commit 34e78eb25f

14
main.ts
View file

@ -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 }