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
feat: ✨ clone and recolorize icons #2305
Conversation
vscode-test was renamed to @vscode/test-electron and the former package was unable to run tests on windows. this commit removes vscode-test and updates it to the last version of @vscode/test-electron
Regarding d931fc4, I updated |
That's fine for me. I couldn't find the time so far for updating the test setup, but feel free to do so if it helps you implement the changes. It will be helpful. |
improves recolorization logic, keeping originally darker colors dark and lighter colors light even after recolor
adds support for a custom svg attribute `mit-no-recolor` that, when set to true, will keep the original color of the svg node on which is applied
PreviewThank you for creating a pull request. This preview shows you how your changes will look on the different themes: You can find more information how to contribute in the contribution guidelines. |
PreviewThank you for creating a pull request. This preview shows you how your changes will look on the different themes: You can find more information how to contribute in the contribution guidelines. |
8445f2f and 77d76a9 change some edge-case icons, adding a custom attribute It doesn't change anything about the icons, it just adds the attributes. The failing check in the action is because some of these files were already using "forbidden" colors. Well it doesn't change anything else.... with one exception: |
support for creating clones by configuring them in the fileIcons.ts and folderIcons.ts files so that the icons are created at build time allowing contributors to create clones that are shipped with the extension
PreviewThank you for creating a pull request. This preview shows you how your changes will look on the different themes: You can find more information how to contribute in the contribution guidelines. |
Thank you for the update. Yes, I'm aware of the fact that not all icons are using material design colors. It's due to the fact that I've added this policy later on, so some icons are not following it, but I want new icons to have proper colors. Don't worry if the pipeline complains about this fact, we can merge this PR anyway. Please let me know once this PR is ready to test, then I'll have a more detailed look. Right now I'm a few days off, so I'm not able to respond quickly or to test this feature. I'll be back by mid of next week. |
That's a valid PR. It parses colors in svg files and replace them if they are found in the clone configuration. In my repo I did something more barebones by putting a placeholder in the svg files and allowing users to change the color of the node containing the placeholder attribute. But this implementation is actually dynamic as it parses the icons first and build the colors map before replacing. Good job |
@PKief, I think the main functionalities are already done, and they seems to be working pretty good. You can review it whenever you have the time, but it's not ready for merging yet as I need add some tests and update the documentation explaining how to use the new features first. Cheers! |
PreviewThank you for creating a pull request. This preview shows you how your changes will look on the different themes: You can find more information how to contribute in the contribution guidelines. |
PreviewThank you for creating a pull request. This preview shows you how your changes will look on the different themes: You can find more information how to contribute in the contribution guidelines. |
Hi @PKief, I just finished updating tests and docs. And the main functionality is also already done. But there are two places that I missed before and I probably need to revisit:
But I don't want to add too much complexity in this pr before your review, it's already a pretty long PR. I'll look into it tho, and add those changes later. |
Some clarifications about the code and the functionality that might not be obvious:
|
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.
After over a thousand pull requests for this icon extension, this PR is one of the best and most comprehensive. I have checked the functionality and everything works perfectly. Thank you also for writing unit tests and adapting and improving the Contributing Guide. I know this is a lot of work and I would like to thank you very much for it! I would be happy if you could take a look at one of my comments, otherwise everything is really very well worked out.
PreviewThank you for creating a pull request. This preview shows you how your changes will look on the different themes: You can find more information how to contribute in the contribution guidelines. |
In addition, I just tried to check if I can replace the angular and nest file icons with the clones. Everything worked pretty good, until I run the command "npm run check" which shows me this error messages: The check command checks all icon definitions and throws an error if there's an icon used in the fileIcons.ts but no SVG icon is available in the icons directory. In the past I've used this to make sure, that no SVG icon is forgotten but defined in the icon associations. Would you mind taking a look at this as well? |
PreviewThank you for creating a pull request. This preview shows you how your changes will look on the different themes: You can find more information how to contribute in the contribution guidelines. |
Nice catch! There are two paths to fix this check that I can think of:
What do you think @PKief ? |
@lucas-labs Thank you for sharing your ideas. I'd prefer the first option, because the check can expect the clone functionality to be working. It's just about ensuring that every icon is at it's place. So I'd be fine with checking if the define icon of "base" is existing. |
PreviewThank you for creating a pull request. This preview shows you how your changes will look on the different themes: You can find more information how to contribute in the contribution guidelines. |
PreviewThank you for creating a pull request. This preview shows you how your changes will look on the different themes: You can find more information how to contribute in the contribution guidelines. |
Hi @PKief, I fixed the failing check script. It should be working ok now. I also fixed an issue with the |
Although, checking the We could change the -"preversion": "npm run contributors ...",
+"preversion": "npm run compile && npm run contributors ...",
"version": "npm run changelog && git add CHANGELOG.md",
-"vscode:prepublish": "npm run lint && npm run compile && npm run package-web"
+"vscode:prepublish": "npm run lint && npm run package-web" Do you think there's a better way to do this? |
Personally, I would prefer not showing all of the cloned versions of an icon in the preview. It's fine if the cloned icons are not shown there. If we for instance take a look at the variations of the nest icon, it's just a waste of space in this preview and does not bring too much value: It will be much simplier, if just the base icon is shown here. |
That means for the check script, it would be fine just filtering out the *.clone.svg files. What's your opinion about this? Would you agree with that? |
Yeah for sure, I just assumed that you might have wanted to keep the variatios in the preview as it is today. But we could just filter them out of the list, that's ok! |
PreviewThank you for creating a pull request. This preview shows you how your changes will look on the different themes: You can find more information how to contribute in the contribution guidelines. |
Done, now the preview images generator doesn't take clones into account. |
Thank you for your quick feedback and customization of the PR. I have just tested your changes and it works perfectly now! |
Merge SuccessfulThanks for your contribution! 🎉 The changes will be part of the upcoming update on the marketplace. |
This PR aims to introduce the feature described in #2304
It allows to "clone" any existent icon and recolorize it to create variants of the same icon with different colors that can be assigned to folder names, file extensiones and file names by user settings.
example
caveats
This PR adds two dependencies to the package:
chroma-js
: to calculate color distances and find matches inside the material palettesvgson
: to parse the svg files and manipulate them//TODO
lightColor
configuration, to create light variants of the clonemit-no-recolor="true"
as a node attributefolderIcons.ts
andfileIcons.ts
files, so that they are generated at build time.Closes #2304
Closes #228