Skip to content

Commit

Permalink
Use a contrasting fore ground colour for BufferFormat error style
Browse files Browse the repository at this point in the history
This makes it automatically work for Light or Dark theme
  • Loading branch information
Zorro666 committed Nov 16, 2023
1 parent 7d2094d commit 6ea7710
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions qrenderdoc/Widgets/BufferFormatSpecifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,13 @@ BufferFormatSpecifier::BufferFormatSpecifier(QWidget *parent)

QColor base = formatText->palette().color(QPalette::Base);

QColor col = QColor::fromHslF(0.0f, 1.0f, qBound(0.1, base.lightnessF(), 0.9));
QColor backCol = QColor::fromHslF(0.0f, 1.0f, qBound(0.1, base.lightnessF(), 0.9));
QColor foreCol = contrastingColor(backCol, QColor(0, 0, 0));

formatText->styleSetBack(ERROR_STYLE, SCINTILLA_COLOUR(col.red(), col.green(), col.blue()));
formatText->styleSetBack(ERROR_STYLE,
SCINTILLA_COLOUR(backCol.red(), backCol.green(), backCol.blue()));
formatText->styleSetFore(ERROR_STYLE,
SCINTILLA_COLOUR(foreCol.red(), foreCol.green(), foreCol.blue()));

ConfigureSyntax(formatText, SCLEX_BUFFER);

Expand Down

0 comments on commit 6ea7710

Please sign in to comment.