Gui: use default app text color for Python code instuctions highlighting

This allows to deal with OS native dark themes
 In such cases, Python instructions were black on a dark background
This commit is contained in:
0penBrain
2022-10-03 17:52:45 +02:00
committed by Chris Hennes
parent c168aec824
commit 5bb041deaa
4 changed files with 18 additions and 9 deletions

View File

@@ -100,7 +100,7 @@ struct PythonConsoleP
callTipsList = nullptr;
interactive = false;
historyFile = QString::fromUtf8((App::Application::getUserAppDataDir() + "PythonHistory.log").c_str());
colormap[QLatin1String("Text")] = Qt::black;
colormap[QLatin1String("Text")] = qApp->palette().windowText().color();
colormap[QLatin1String("Bookmark")] = Qt::cyan;
colormap[QLatin1String("Breakpoint")] = Qt::red;
colormap[QLatin1String("Keyword")] = Qt::blue;
@@ -932,7 +932,7 @@ void PythonConsole::changeEvent(QEvent *e)
}
}
else if (e->type() == QEvent::StyleChange) {
QPalette pal = palette();
QPalette pal = qApp->palette();
QColor color = pal.windowText().color();
unsigned int text = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8);
auto value = static_cast<unsigned long>(text);