-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added hex colors to manifest.json #294
Conversation
This looks like a great contribution, thanks! Does your script pass the linting rules? You can test with |
Also, I think the colour picking should just be added to |
I'm going to add the color script to manifest.json and fix the linting errors |
When trying to commit, the svgo script throws out this error
|
Ahh, that's just the shell command substitution failing because you're running it on Windows. You should be able to remove the |
Should i just delete the repository and recommit everything in a single commit to avoid the commit spam ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff, some small tweaks.
No, don't worry about that, I'll squash these into a single commit when it gets merged. |
All done. |
Fixed.. |
@smokes Thanks, great contribution! Published as |
const fileName = `${id.toLowerCase()}.svg`; | ||
const svgPath = path.resolve(__dirname, '../svg/color/', fileName); | ||
let color; | ||
if (fs.existsSync(svgPath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the point of this check. If an icon is in the manifest, it should be guaranteed to exist. If it does not, it should fail loudly, not silently.
if (fs.existsSync(svgPath)) { | ||
const svg = fs.readFileSync(svgPath, 'utf8'); | ||
const fillColor = getColors(svg).fills[0]; | ||
color = fillColor ? fillColor.hex().toUpperCase() : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, we should fail loudly (meaning throw an error) if the color cannot be found, as that's definitely something we'll want to look into.
@@ -44,10 +45,19 @@ const overrides = new Map([ | |||
|
|||
const icons = manifest.map(icon => { | |||
const id = typeof icon === 'string' ? icon : icon.symbol; | |||
const fileName = `${id.toLowerCase()}.svg`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filename is a word, so should have been filename
, not fileName
.
|
Everything fixed in 5a160a8 |
Thought it would be useful to have the hex colors in manifest.json, also included a script to grab the colors from the svgs