diff --git a/images/themes/default/console/iconClassBrowserConsole.svg b/images/themes/default/console/iconClassBrowserConsole.svg
index 42bc5711d627..031539ea9426 100644
--- a/images/themes/default/console/iconClassBrowserConsole.svg
+++ b/images/themes/default/console/iconClassBrowserConsole.svg
@@ -1 +1,10 @@
-
\ No newline at end of file
+
+
diff --git a/images/themes/default/console/iconCommentEditorConsole.svg b/images/themes/default/console/iconCommentEditorConsole.svg
index 6094e84fedfe..44790de3166c 100644
--- a/images/themes/default/console/iconCommentEditorConsole.svg
+++ b/images/themes/default/console/iconCommentEditorConsole.svg
@@ -1 +1,4 @@
-
\ No newline at end of file
+
+
diff --git a/python/console/console.py b/python/console/console.py
index ba15c4460f1a..3e495bc66ce3 100644
--- a/python/console/console.py
+++ b/python/console/console.py
@@ -46,7 +46,7 @@
QApplication,
QShortcut,
)
-from qgis.PyQt.QtGui import QDesktopServices, QKeySequence
+from qgis.PyQt.QtGui import QDesktopServices, QKeySequence, QColor, QPalette
from qgis.PyQt.QtWidgets import QVBoxLayout, QMessageBox
from qgis.utils import iface
from .console_sci import ShellScintilla
@@ -320,7 +320,10 @@ def __init__(self, parent=None):
self.toggleCommentEditorButton.setCheckable(False)
self.toggleCommentEditorButton.setEnabled(True)
self.toggleCommentEditorButton.setIcon(
- QgsApplication.getThemeIcon("console/iconCommentEditorConsole.svg")
+ QgsApplication.getThemeIcon(
+ "console/iconCommentEditorConsole.svg",
+ self.palette().color(QPalette.ColorRole.WindowText),
+ ),
)
self.toggleCommentEditorButton.setMenuRole(QAction.MenuRole.PreferencesRole)
self.toggleCommentEditorButton.setIconVisibleInMenu(True)
diff --git a/python/console/console_editor.py b/python/console/console_editor.py
index c7e868372c52..9503f6f92e2c 100644
--- a/python/console/console_editor.py
+++ b/python/console/console_editor.py
@@ -48,7 +48,7 @@
Qt,
QUrl,
)
-from qgis.PyQt.QtGui import QKeySequence
+from qgis.PyQt.QtGui import QKeySequence, QColor, QPalette
from qgis.PyQt.QtNetwork import QNetworkRequest
from qgis.PyQt.QtWidgets import (
QAction,
@@ -261,7 +261,10 @@ def contextMenuEvent(self, e):
menu.addSeparator()
toggle_comment_action = QAction(
- QgsApplication.getThemeIcon("console/iconCommentEditorConsole.svg"),
+ QgsApplication.getThemeIcon(
+ "console/iconCommentEditorConsole.svg",
+ self.palette().color(QPalette.ColorRole.WindowText),
+ ),
QCoreApplication.translate("PythonConsole", "Toggle Comment"),
menu,
)