DolphinQt: Adjust panel-specific colors and syntax highlighting for dark theme.

This commit is contained in:
Admiral H. Curtiss 2023-08-01 20:47:17 +02:00 committed by Nayla Hanegan
parent 887b07af71
commit 521d6e93c7
No known key found for this signature in database
GPG key ID: 3075216CED0DB01D
8 changed files with 97 additions and 28 deletions

View file

@ -3,6 +3,11 @@
#include "DolphinQt/Config/GameConfigHighlighter.h"
#include <QBrush>
#include <QColor>
#include "DolphinQt/Settings.h"
struct HighlightingRule
{
QRegularExpression pattern;
@ -13,22 +18,36 @@ GameConfigHighlighter::~GameConfigHighlighter() = default;
GameConfigHighlighter::GameConfigHighlighter(QTextDocument* parent) : QSyntaxHighlighter(parent)
{
const bool is_dark_theme = Settings::Instance().IsThemeDark();
QTextCharFormat equal_format;
equal_format.setForeground(Qt::red);
if (is_dark_theme)
equal_format.setForeground(QBrush{QColor(255, 96, 96)});
else
equal_format.setForeground(Qt::red);
QTextCharFormat section_format;
section_format.setFontWeight(QFont::Bold);
QTextCharFormat comment_format;
comment_format.setForeground(Qt::darkGreen);
if (is_dark_theme)
comment_format.setForeground(QBrush{QColor(0, 220, 0)});
else
comment_format.setForeground(Qt::darkGreen);
comment_format.setFontItalic(true);
QTextCharFormat const_format;
const_format.setFontWeight(QFont::Bold);
const_format.setForeground(Qt::blue);
if (is_dark_theme)
const_format.setForeground(QBrush{QColor(132, 132, 255)});
else
const_format.setForeground(Qt::blue);
QTextCharFormat num_format;
num_format.setForeground(Qt::darkBlue);
if (is_dark_theme)
num_format.setForeground(QBrush{QColor(66, 138, 255)});
else
num_format.setForeground(Qt::darkBlue);
m_rules.emplace_back(HighlightingRule{QRegularExpression(QStringLiteral("=")), equal_format});
m_rules.emplace_back(