Skip to content

Commit

Permalink
[35_3] dark mode for svg icons on Windows/Linux/macOS
Browse files Browse the repository at this point in the history
Co-authored-by: 沈浪熊猫儿 <[email protected]>
  • Loading branch information
da-liii and 沈浪熊猫儿 authored Nov 21, 2023
1 parent 27f3c73 commit bb005f4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Plugins/Qt/qt_picture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ qt_load_icon (url file_name) {
#ifdef OS_MINGW
return QIcon (qt_load_svg_icon (svg));
#else
return QIcon (to_qstring (as_string (svg)));
if (occurs ("dark", tm_style_sheet)) {
return QIcon (qt_load_svg_icon (svg));
} else {
return QIcon (to_qstring (as_string (svg)));
}
#endif
} else {
return QIcon (as_pixmap (*xpm_image (file_name)));
Expand Down Expand Up @@ -388,6 +392,11 @@ qt_load_svg_icon (url file_name) {
QPainter painter (pm);
renderer.render (&painter);

if (occurs ("dark", tm_style_sheet) && may_transform (file_name, *pm)) {
invert_colors (*pm);
saturate (*pm);
}

QPixmap icon (pm->size ());
icon.convertFromImage (*pm);
return icon;
Expand Down

0 comments on commit bb005f4

Please sign in to comment.