mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-02 17:28:33 +00:00
DolphinQt: Adjust panel-specific colors and syntax highlighting for dark theme.
This commit is contained in:
parent
887b07af71
commit
521d6e93c7
8 changed files with 97 additions and 28 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue