Skip to content

Commit

Permalink
fix: issue with icon color for custom rule (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianWoelki committed Dec 21, 2023
1 parent 934572f commit 9ba6bc7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/lib/util/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const setIconForNode = (
let iconContent = style.applyAll(plugin, possibleIcon, node);
if (color) {
node.style.color = color;
iconContent = svg.colorize(possibleIcon, color);
iconContent = svg.colorize(iconContent, color);
}
node.innerHTML = iconContent;
} else {
Expand Down
18 changes: 10 additions & 8 deletions src/settings/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import inheritance from '@lib/inheritance';
import style from '@lib/util/style';
import IconFolderPlugin from '@app/main';
import { getFileItemTitleEl } from '../util';
import svg from '@app/lib/util/svg';

/**
* Helper function that refreshes the style of all the icons that are defined, in some
Expand Down Expand Up @@ -56,17 +57,18 @@ const refreshStyleOfIcons = async (plugin: IconFolderPlugin): Promise<void> => {
for (const rule of customRule.getSortedRules(plugin)) {
const fileItems = await customRule.getFileItems(plugin, rule);
for (const fileItem of fileItems) {
const titleEl = getFileItemTitleEl(fileItem);
const iconNode = titleEl.querySelector('.iconize-icon') as HTMLElement;
let iconContent = iconNode.innerHTML;

iconContent = style.applyAll(plugin, iconContent, iconNode);

if (rule.color) {
continue;
iconContent = svg.colorize(iconContent, rule.color);
iconNode.style.color = rule.color;
}

const titleEl = getFileItemTitleEl(fileItem);
const iconNode = titleEl.querySelector('.iconize-icon') as HTMLElement;
iconNode.innerHTML = style.applyAll(
plugin,
iconNode.innerHTML,
iconNode,
);
iconNode.innerHTML = iconContent;
}
}
}
Expand Down

0 comments on commit 9ba6bc7

Please sign in to comment.