Skip to content

Commit

Permalink
Fix highlighted piece color
Browse files Browse the repository at this point in the history
  • Loading branch information
jagannatharjun committed Jun 18, 2024
1 parent d71086e commit 4cde4da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/gui/properties/piecesbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,8 @@ void PiecesBar::paintEvent(QPaintEvent *)

if (!m_highlightedRegion.isNull())
{
QColor highlightColor {this->palette().color(QPalette::Active, QPalette::Highlight)};
highlightColor.setAlphaF(0.35f);
QRect targetHighlightRect {m_highlightedRegion.adjusted(borderWidth, borderWidth, borderWidth, height() - 2 * borderWidth)};
painter.fillRect(targetHighlightRect, highlightColor);
painter.fillRect(targetHighlightRect, highlightedPieceColor());
}

QPainterPath border;
Expand Down Expand Up @@ -217,6 +215,13 @@ QColor PiecesBar::pieceColor() const
return palette().color(QPalette::Highlight);
}

QColor PiecesBar::highlightedPieceColor() const
{
QColor col = palette().color(QPalette::Highlight).darker();
col.setAlphaF(0.35);
return col;
}

QColor PiecesBar::colorBoxBorderColor() const
{
return palette().color(QPalette::ToolTipText);
Expand Down
2 changes: 2 additions & 0 deletions src/gui/properties/piecesbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ class PiecesBar : public QWidget
QColor backgroundColor() const;
QColor borderColor() const;
QColor pieceColor() const;
QColor highlightedPieceColor() const;
QColor colorBoxBorderColor() const;

const QVector<QRgb> &pieceColors() const;

// mix two colors by light model, ratio <0, 1>
Expand Down

0 comments on commit 4cde4da

Please sign in to comment.