Skip to content

Commit

Permalink
feat(icon-packs): fix font awesome icons not following context color
Browse files Browse the repository at this point in the history
  • Loading branch information
aidenlx committed Mar 9, 2022
1 parent 2b0d43a commit a93d1df
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/icon-packs/file-icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ export class FileIconData implements FileIconDataType {
return (async () => {
const svgEl = await this.plugin.fileIconCache.getIcon(this.path);
if (svgEl) {
el.append(svgEl);
svgEl.addClass("isc-svg-icon");
this.fixFontAwesome(svgEl);
el.append(svgEl);
} else {
console.error("failed to get icon data for", this.path);
}
Expand All @@ -73,4 +74,12 @@ export class FileIconData implements FileIconDataType {
return el;
}
}

fixFontAwesome(svg: SVGElement): void {
if (!faPacks.includes(this.pack)) return;
for (const pathEl of svg.getElementsByTagName("path")) {
pathEl.setAttr("fill", "currentColor");
}
}
}
const faPacks = ["fab", "far", "fas"];

0 comments on commit a93d1df

Please sign in to comment.