-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
PR: Automatic colorization of SVG icons according to the interface theme #24199
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add SVGColorize class for theme-based icon colorization using lxml - Create unified svg/ directory with all icons from light/ directory - Update icon_manager.py to support dynamic SVG colorization - Add ICON_COLORS dictionary mapping CSS classes to theme colors - Implement _process_svg_icon and _process_regular_icon methods - Update image_path_manager.py to prioritize svg/ directory - Support for ICON_1, ICON_2, ICON_3, ICON_4, SPYDER_LOGO_WEB, SPYDER_LOGO_SNAKE classes This system allows SVG icons to automatically adapt to the current theme by replacing CSS class names with actual color values from SpyderPalette.
82718d6 to
d8844e3
Compare
- Add lxml>=4.9.0 to requirements/main.yml - Add lxml>=4.9.0 to binder/environment.yml - Required for SVGColorize class XML parsing functionality
- Add lxml>=4.9.0 to install_requires for main dependencies - Add lxml>=4.9.0 to extras_require['test'] for test dependencies - Ensures pip install -e .[test] includes lxml for SVG colorization
…d class in SVG icons
… in icon_manager to handle icon colorization better for HiDPI resolutions
…tatus methods to handle icon colorization
…oing redundant checks
ccordoba12
reviewed
Sep 15, 2025
Member
ccordoba12
left a comment
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.
Thanks for your work on this @conradolandia!
ccordoba12
approved these changes
Oct 7, 2025
Member
ccordoba12
left a comment
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.
Thanks for this great contribution @conradolandia!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Changes
This PR enhances Spyder's icon system to dynamically adapt to theme colors, eliminating the need for separate icon sets per theme. Icons now use semantic class names that map to theme color variables, making the UI more consistent and easier to maintain.
Key Changes
New Components:
spyder/utils/svg_colorizer.pywith theSVGColorizeclass that handles icon colorization based on theme colorssvgfolder for theme-agnostic icons that use class names instead of direct fill colorslightanddarkicon folders fromspyder/imagesEnhancements:
IconManagerclass inspyder/utils/icon_manager.py:_process_svg_icon,_process_regular_icon,_apply_icon_states)SvgToScaledPixmapclass inspyder/api/widgets/mixins.pyto support theme-based SVG colorizationConnectionStatusWidget._set_iconinspyder/plugins/remoteclient/widgets/connectionstatus.pyto pass theme colors to iconsBenefits
Dependencies
lxml >=5.3.2Future Plans
This enhancement is the first step toward a fully themable Spyder UI.
Checklist
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct:
@conradolandia