Dark mode support

Centralized all colors, tweaked application paletter in darkmode to make it darker.
This commit is contained in:
eelke 2025-02-23 08:32:15 +01:00
parent aac55b0ed1
commit 86a9a0d709
19 changed files with 335 additions and 73 deletions

View file

@ -14,6 +14,7 @@
CodeEditor::CodeEditor(QWidget *parent)
: QPlainTextEdit(parent)
, gutterArea(new EditorGutter(this))
, colorTheme(GetColorTheme())
{
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateGutterAreaWidth(int)));
connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateGutterArea(QRect,int)));
@ -69,8 +70,7 @@ void CodeEditor::resizeEvent(QResizeEvent *e)
void CodeEditor::highlightCurrentLine()
{
QTextEdit::ExtraSelection selection;
QColor lineColor = QColor(Qt::yellow).lighter(160);
selection.format.setBackground(lineColor);
selection.format.setBackground(colorTheme.currentLine);
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
selection.cursor = textCursor();
selection.cursor.clearSelection();
@ -87,8 +87,7 @@ void CodeEditor::onTextChanged()
void CodeEditor::addErrorMarker(int position, int length)
{
QTextEdit::ExtraSelection selection;
QColor lineColor = QColor(Qt::red).lighter(160);
selection.format.setBackground(lineColor);
selection.format.setBackground(colorTheme.errorLine);
selection.format.setFontItalic(true);
selection.cursor = textCursor();
selection.cursor.setPosition(position);