Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 3c2eff3d authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

Inject custom style sheet with system colors

WebView follows the color of the application but text does not leading to
black text on dark gray background.

BUG: 360214

Differential Revision:
parent 24c0b5fd
......@@ -72,6 +72,22 @@ class ScriptingHtmlDialog : public QDialog {>setNetworkAccessManager(NULL); //Disable talking to remote servers>mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAsNeeded);>mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded);
// inject a style sheet that follows system colors, otherwise we might end up with black text on dark gray background
const QString styleSheet = QStringLiteral(
"body { background: %1; color: %2; }" \
"a { color: %3; }" \
"a:visited { color: %4; } "
// you can only provide a user style sheet url, so we turn it into a data url here
const QUrl dataUrl(QStringLiteral("data:text/css;charset=utf-8;base64,") + QString::fromLatin1(styleSheet.toUtf8().toBase64()));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment