Skip to content

Commit

Permalink
Tweak TopN text color
Browse files Browse the repository at this point in the history
.. to match the same text color used in data table since it
   was a little dull in dark mode and hard to read.
  • Loading branch information
liversedge committed Dec 1, 2021
1 parent 8b0af9a commit 4ae6dbe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Charts/OverviewItems.cpp
Expand Up @@ -3402,6 +3402,8 @@ TopNOverviewItem::itemPaint(QPainter *painter, const QStyleOptionGraphicsItem *,
int width = paintarea.width() - (numrect.width() + daterect.width() + valuerect.width() + (margins * 6));
QRectF barrect = QRectF(0,10, width, 30);

// text color
QColor cnormal = (GCColor::luminance(GColor(CCARDBACKGROUND)) < 127) ? QColor(200,200,200) : QColor(70,70,70);

// PAINT
for (int i=0; i<maxrows && i<ranked.count(); i++) {
Expand All @@ -3424,7 +3426,7 @@ TopNOverviewItem::itemPaint(QPainter *painter, const QStyleOptionGraphicsItem *,
}

// rank
painter->setPen(QColor(100,100,100));
painter->setPen(cnormal);
painter->drawText(paintarea.topLeft()+QPointF(margins, margins+(i*rowheight)+fm.ascent()), QString("%1.").arg(i+1));

// date
Expand Down Expand Up @@ -3452,7 +3454,6 @@ TopNOverviewItem::itemPaint(QPainter *painter, const QStyleOptionGraphicsItem *,
painter->fillRect(bar, markerbrush);

// value
painter->setPen(QColor(100,100,100));
painter->drawText(paintarea.topLeft()+QPointF(numrect.width()+daterect.width()+fullbar.width()+(margins*4),0)+QPointF(margins, margins+(i*rowheight)+fm.ascent()), ranked[i].value);

}
Expand Down

0 comments on commit 4ae6dbe

Please sign in to comment.