Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d8844e3
Implement dynamic SVG icon colorization system
conradolandia Sep 1, 2025
ad10864
Add lxml dependency for SVG colorization system
conradolandia Sep 1, 2025
5753388
Add lxml dependency to setup.py for pip installations
conradolandia Sep 1, 2025
5f6d6fa
Restore lost icons
conradolandia Sep 1, 2025
4f2fe6d
Delete old unneded icons again (result of badly executed commit d8844…
conradolandia Sep 1, 2025
9e3d991
Merge branch 'spyder-ide:master' into icon_colorizer
conradolandia Sep 9, 2025
ac4af28
Add missing ICON_* definitions to IconManager.ICON_COLORS, and update…
conradolandia Sep 9, 2025
061ceba
Improve class SVGColorize with classmethods and refactor some methods…
conradolandia Sep 10, 2025
5e1a225
Clean up redundant ond methods
conradolandia Sep 10, 2025
f2653e7
Organize functions separating concerns better and update connection s…
conradolandia Sep 11, 2025
d83055f
Move imports to the top of the files
conradolandia Sep 11, 2025
9d57c83
Move new method to the proper location
conradolandia Sep 11, 2025
bdf2add
Move imports to the top of the file
conradolandia Sep 11, 2025
2b440f5
Fix maximize svg to remove bad path. Clean up some methods to avoid d…
conradolandia Sep 11, 2025
3b65875
Restore warning, maybe we still need it
conradolandia Sep 11, 2025
9f3cc36
Add debug parameter to method
conradolandia Sep 11, 2025
ad5fc16
Fix issues from code review
conradolandia Sep 18, 2025
394406f
Merge branch 'spyder-ide:master' into icon_colorizer
conradolandia Sep 18, 2025
eba5eae
Code style fixes, remove filled blank lines and repeated code
ccordoba12 Oct 6, 2025
7406e69
Merge branch 'master' into icon_colorizer
ccordoba12 Oct 6, 2025
0b803a9
Fix dependencies
ccordoba12 Oct 6, 2025
d41fd14
Correct red color value for spyder logo
conradolandia Oct 6, 2025
7e886fb
Replace color for S in spyder logo
conradolandia Oct 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies:
- ipython >=8.15.0,<10.0.0,!=8.17.1,!=9.1.0,!=9.2.0,!=9.3.0,!=9.4.0
- ipython_pygments_lexers >=1.0
- jedi >=0.17.2,<0.20.0
- lxml >=4.9.0
- jellyfish >=0.7
- jsonschema >=3.2.0
- keyring >=17.0.0
Expand Down
1 change: 1 addition & 0 deletions requirements/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies:
- ipython >=8.15.0,<10.0.0,!=8.17.1,!=9.1.0,!=9.2.0,!=9.3.0,!=9.4.0
- ipython_pygments_lexers >=1.0
- jedi >=0.17.2,<0.20.0
- lxml >=4.9.0
- jellyfish >=0.7
- jsonschema >=3.2.0
- keyring >=17.0.0
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ def run(self):
'ipython_pygments_lexers>=1.0',
'jedi>=0.17.2,<0.20.0',
'jellyfish>=0.7',
'lxml>=4.9.0',
'jsonschema>=3.2.0',
'keyring>=17.0.0',
'nbconvert>=4.0',
Expand Down
55 changes: 50 additions & 5 deletions spyder/api/widgets/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
)

# Local imports
from spyder.api.config.mixins import (
SpyderConfigurationAccessor,
SpyderConfigurationObserver
)
from spyder.api.config.mixins import SpyderConfigurationAccessor
from spyder.api.exceptions import SpyderAPIError
from spyder.api.shortcuts import SpyderShortcutsMixin
from spyder.api.widgets.menus import SpyderMenu
Expand All @@ -39,6 +36,7 @@
from spyder.utils.registries import (
ACTION_REGISTRY, MENU_REGISTRY, TOOLBAR_REGISTRY, TOOLBUTTON_REGISTRY)
from spyder.utils.stylesheet import PANES_TOOLBAR_STYLESHEET
from spyder.utils.svg_colorizer import SVGColorize


class SpyderToolButtonMixin:
Expand Down Expand Up @@ -757,7 +755,7 @@ class SvgToScaledPixmap(SpyderConfigurationAccessor):
def svg_to_scaled_pixmap(self, svg_file, rescale=None, in_package=True):
"""
Transform svg to a QPixmap that is scaled according to the factor set
by users in Preferences.
by users in Preferences. Uses the icon manager for proper colorization.

Parameters
----------
Expand All @@ -771,6 +769,7 @@ def svg_to_scaled_pixmap(self, svg_file, rescale=None, in_package=True):
if in_package:
image_path = get_image_path(svg_file)

# Get user's DPI scale factor
if self.get_conf('high_dpi_custom_scale_factor', section='main'):
scale_factors = self.get_conf(
'high_dpi_custom_scale_factors',
Expand All @@ -780,6 +779,52 @@ def svg_to_scaled_pixmap(self, svg_file, rescale=None, in_package=True):
else:
scale_factor = 1

# Check if the SVG has colorization classes before colorization
should_colorize = False
try:
svg_paths_data = SVGColorize.get_colored_paths(
image_path, ima.ICON_COLORS
)
if svg_paths_data and svg_paths_data.get('paths'):
# Check if any of the paths have colorization classes
# (not just default colors)
paths = svg_paths_data.get('paths', [])
for path in paths:
# If a path has a color that's not the default color,
# it means it has a colorization class
default_color = ima.ICON_COLORS.get(
'ICON_1', '#FF0000' # Get default color from palette
)
if path.get('color') != default_color:
should_colorize = True
break
except Exception:
should_colorize = False

# Try to use the icon manager for colorization only if SVG supports it
if should_colorize:
icon = ima.get_icon(svg_file)
if icon and not icon.isNull():
# Get the original SVG dimensions
pm = QPixmap(image_path)
width = pm.width()
height = pm.height()

# Apply rescale factor
if rescale is not None:
aspect_ratio = width / height
width = int(width * rescale)
height = int(width / aspect_ratio)

# Get a properly scaled pixmap from the icon
# Use the maximum dimension to maintain aspect ratio
max_dimension = max(
int(width * scale_factor),
int(height * scale_factor)
)
return icon.pixmap(max_dimension, max_dimension)

# Fallback to original method for icons without colorization classes.
# Get width and height
pm = QPixmap(image_path)
width = pm.width()
Expand Down
5 changes: 5 additions & 0 deletions spyder/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
JELLYFISH_REQVER = '>=0.7'
JSONSCHEMA_REQVER = '>=3.2.0'
KEYRING_REQVER = '>=17.0.0'
LXML_REQVER = ">=4.9.0"
NBCONVERT_REQVER = '>=4.0'
NUMPYDOC_REQVER = '>=0.6.0'
PACKAGING_REQVER = '>=20.0'
Expand Down Expand Up @@ -166,6 +167,10 @@
'features': _("Save Github credentials to report internal "
"errors securely"),
'required_version': KEYRING_REQVER},
{'modname': "lxml",
'package_name': "lxml",
'features': _("Colorize SVG icons according to the interface theme"),
'required_version': LXML_REQVER},
{'modname': "nbconvert",
'package_name': "nbconvert",
'features': _("Manipulate Jupyter notebooks in the Editor"),
Expand Down
1 change: 0 additions & 1 deletion spyder/images/dark/ArchiveFileIcon.svg

This file was deleted.

1 change: 0 additions & 1 deletion spyder/images/dark/binary.svg

This file was deleted.

3 changes: 0 additions & 3 deletions spyder/images/dark/clear_console.svg

This file was deleted.

3 changes: 0 additions & 3 deletions spyder/images/dark/connection_connected.svg

This file was deleted.

3 changes: 0 additions & 3 deletions spyder/images/dark/connection_disconnected.svg

This file was deleted.

3 changes: 0 additions & 3 deletions spyder/images/dark/connection_error.svg

This file was deleted.

3 changes: 0 additions & 3 deletions spyder/images/dark/connection_waiting.svg

This file was deleted.

1 change: 0 additions & 1 deletion spyder/images/dark/debug.svg

This file was deleted.

1 change: 0 additions & 1 deletion spyder/images/dark/debug_cell.svg

This file was deleted.

1 change: 0 additions & 1 deletion spyder/images/dark/debug_selection.svg

This file was deleted.

1 change: 0 additions & 1 deletion spyder/images/dark/dock.svg

This file was deleted.

1 change: 0 additions & 1 deletion spyder/images/dark/editdelete.svg

This file was deleted.

1 change: 0 additions & 1 deletion spyder/images/dark/environ.svg

This file was deleted.

1 change: 0 additions & 1 deletion spyder/images/dark/file_type_tex.svg

This file was deleted.

1 change: 0 additions & 1 deletion spyder/images/dark/filecloseall.svg

This file was deleted.

1 change: 0 additions & 1 deletion spyder/images/dark/findnext.svg

This file was deleted.

1 change: 0 additions & 1 deletion spyder/images/dark/findprevious.svg

This file was deleted.

1 change: 0 additions & 1 deletion spyder/images/dark/genprefs.svg

This file was deleted.

Loading
Loading