Skip to content

Commit e0691b1

Browse files
committed
Remove the fill attribute from all icons
The fill attribute prevents the icon from receiving the proper coloring. This wasn't an issue in the symbolset version because svg-symbols strips the attribute.
1 parent 7922aab commit e0691b1

12 files changed

+21
-19
lines changed

lib/generate-icon-components.mjs

+10
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const COMPONENT_ICON_FOLDER = join(
1515
"icons",
1616
);
1717

18+
const iconsWithFill = [];
19+
1820
const files = await readdir(ICON_FOLDER);
1921
const icons = files
2022
.filter((file) => extname(file) === ".svg")
@@ -27,6 +29,10 @@ const promises = icons.map((svg) => {
2729
});
2830
await Promise.all(promises);
2931

32+
if (iconsWithFill.length > 0) {
33+
throw new Error(`The following icons have a fill attribute which might cause issues: ${iconsWithFill.join(', ')}`)
34+
}
35+
3036
async function generateComponent(iconName) {
3137
const componentName = pascalCase(iconName, {
3238
mergeAmbiguousCharacters: true,
@@ -36,6 +42,10 @@ async function generateComponent(iconName) {
3642
.toString()
3743
.replace(">", " ...attributes>"); // We assume the first closing bracket belongs to the svg element
3844

45+
if (iconContent.includes('fill="')) {
46+
iconsWithFill.push(iconName);
47+
}
48+
3949
const componentContent = `// THIS FILE IS GENERATED. ANY CHANGES TO THIS FILE WILL BE LOST.
4050
import type { TOC } from '@ember/component/template-only';
4151

public/icons/caret-up-down.svg

+1-1
Loading

public/icons/eye.svg

+1-1
Loading

public/icons/github.svg

+1-5
Loading

public/icons/html-dot.svg

+1-1
Loading

public/icons/image.svg

+1-3
Loading

public/icons/link-broken.svg

+1-1
Loading

public/icons/users-one-of-four.svg

+1-1
Loading

public/icons/users-three-of-four.svg

+1-1
Loading

public/icons/users-two-of-four.svg

+1-1
Loading

public/icons/visible.svg

+1-1
Loading

0 commit comments

Comments
 (0)