Skip to content

Conversation

@conradolandia
Copy link
Contributor

@conradolandia conradolandia commented Apr 12, 2025

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.

imagen

imagen

Key Changes

New Components:

  • Added spyder/utils/svg_colorizer.py with the SVGColorize class that handles icon colorization based on theme colors
  • Created a new svg folder for theme-agnostic icons that use class names instead of direct fill colors
  • Removed redundant light and dark icon folders from spyder/images

Enhancements:

  • Improved IconManager class in spyder/utils/icon_manager.py:
    • Added SVG colorization support
    • Implemented icon caching for better performance
    • Refactored code by dividing operations into private methods (_process_svg_icon, _process_regular_icon, _apply_icon_states)
  • Updated SvgToScaledPixmap class in spyder/api/widgets/mixins.py to support theme-based SVG colorization
  • Modified ConnectionStatusWidget._set_icon in spyder/plugins/remoteclient/widgets/connectionstatus.py to pass theme colors to icons

Benefits

  • UI automatically adapts to current theme without requiring duplicate icon assets
  • Easier theme customization and development
  • Improved performance through icon caching
  • Foundation for future UI theming enhancements

Dependencies

  • Requires lxml >=5.3.2

Future Plans

This enhancement is the first step toward a fully themable Spyder UI.

Checklist

  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable)
  • Included a screenshot or animation (if affecting the UI)

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

@conradolandia conradolandia marked this pull request as ready for review April 12, 2025 02:29
- 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.
Copy link
Member

@ccordoba12 ccordoba12 left a 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 ccordoba12 changed the title Automatic colorization of SVG icons PR: Automatic colorization of SVG icons Sep 15, 2025
@ccordoba12 ccordoba12 added this to the v6.1.0b2 milestone Sep 15, 2025
@ccordoba12 ccordoba12 modified the milestones: v6.1.0b2, v6.1.0rc1 Sep 18, 2025
@ccordoba12 ccordoba12 modified the milestones: v6.1.0rc1, v6.2.0a1 Sep 21, 2025
@ccordoba12 ccordoba12 changed the title PR: Automatic colorization of SVG icons PR: Automatic colorization of SVG icons according to the interface theme Oct 6, 2025
Copy link
Member

@ccordoba12 ccordoba12 left a 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!

@ccordoba12 ccordoba12 merged commit 7e726b2 into spyder-ide:master Oct 7, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants