Skip to content

Commit b461d2f

Browse files
authoredMar 27, 2024
Remove the fill attribute from all icons (#488)
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 b461d2f

12 files changed

+23
-19
lines changed
 

‎lib/generate-icon-components.mjs

+12
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,12 @@ const promises = icons.map((svg) => {
2729
});
2830
await Promise.all(promises);
2931

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

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

‎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)
Failed to load comments.