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

@ -6,6 +6,8 @@
#include <optional>
#include <thread>
#include <QBrush>
#include <QColor>
#include <QComboBox>
#include <QDialogButtonBox>
#include <QHeaderView>
@ -38,7 +40,6 @@
namespace
{
// TODO: Make sure these functions return colors that will be visible in the current theme.
QTextCharFormat GetSpecialCharFormat()
{
QTextCharFormat format;
@ -49,7 +50,10 @@ QTextCharFormat GetSpecialCharFormat()
QTextCharFormat GetLiteralCharFormat()
{
QTextCharFormat format;
format.setForeground(QBrush{Qt::darkMagenta});
if (Settings::Instance().IsThemeDark())
format.setForeground(QBrush{QColor(171, 132, 219)});
else
format.setForeground(QBrush{Qt::darkMagenta});
return format;
}
@ -57,35 +61,50 @@ QTextCharFormat GetInvalidCharFormat()
{
QTextCharFormat format;
format.setUnderlineStyle(QTextCharFormat::WaveUnderline);
format.setUnderlineColor(Qt::darkRed);
if (Settings::Instance().IsThemeDark())
format.setUnderlineColor(QColor(255, 69, 0));
else
format.setUnderlineColor(Qt::darkRed);
return format;
}
QTextCharFormat GetControlCharFormat()
{
QTextCharFormat format;
format.setForeground(QBrush{Qt::darkGreen});
if (Settings::Instance().IsThemeDark())
format.setForeground(QBrush{QColor(0, 220, 0)});
else
format.setForeground(QBrush{Qt::darkGreen});
return format;
}
QTextCharFormat GetVariableCharFormat()
{
QTextCharFormat format;
format.setForeground(QBrush{Qt::darkYellow});
if (Settings::Instance().IsThemeDark())
format.setForeground(QBrush{QColor(226, 226, 0)});
else
format.setForeground(QBrush{Qt::darkYellow});
return format;
}
QTextCharFormat GetBarewordCharFormat()
{
QTextCharFormat format;
format.setForeground(QBrush{Qt::darkBlue});
if (Settings::Instance().IsThemeDark())
format.setForeground(QBrush{QColor(66, 138, 255)});
else
format.setForeground(QBrush{Qt::darkBlue});
return format;
}
QTextCharFormat GetCommentCharFormat()
{
QTextCharFormat format;
format.setForeground(QBrush{Qt::darkGray});
if (Settings::Instance().IsThemeDark())
format.setForeground(QBrush{QColor(176, 176, 176)});
else
format.setForeground(QBrush{Qt::darkGray});
return format;
}
} // namespace