diff --git a/avogadro/lastinstall/CMakeLists.txt b/avogadro/lastinstall/CMakeLists.txt index 37c34845..26218f7a 100644 --- a/avogadro/lastinstall/CMakeLists.txt +++ b/avogadro/lastinstall/CMakeLists.txt @@ -50,7 +50,7 @@ if((APPLE OR WIN32) AND NOT ${CMAKE_VERSION} VERSION_LESS 2.8.8) list(APPEND plugins ${location}) endforeach() else() - foreach(qt_plugin Qt5::QJpegPlugin Qt5::QWbmpPlugin Qt5::QWebpPlugin Qt5::QGifPlugin) + foreach(qt_plugin Qt5::QSvgPlugin Qt5::QJpegPlugin Qt5::QWbmpPlugin Qt5::QWebpPlugin Qt5::QGifPlugin) get_property(location TARGET ${qt_plugin} PROPERTY LOCATION_RELEASE) list(APPEND plugins ${location}) endforeach() diff --git a/avogadro/mainwindow.cpp b/avogadro/mainwindow.cpp index 8b27a45b..e520f007 100644 --- a/avogadro/mainwindow.cpp +++ b/avogadro/mainwindow.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include #include @@ -2178,12 +2179,20 @@ void MainWindow::buildTools() { PluginManager* plugin = PluginManager::instance(); + // determine if need dark mode or light mode icons + // e.g. https://www.qt.io/blog/dark-mode-on-windows-11-with-qt-6.5 + const QPalette defaultPalette; + // is the text lighter than the window color? + bool darkMode = (defaultPalette.color(QPalette::WindowText).lightness() > + defaultPalette.color(QPalette::Window).lightness()); + // Now the tool plugins need to be built/added. QList toolPluginFactories = plugin->pluginFactories(); foreach (ToolPluginFactory* factory, toolPluginFactories) { ToolPlugin* tool = factory->createInstance(QCoreApplication::instance()); tool->setParent(this); + tool->setIcon(darkMode); if (tool) m_tools << tool; }