mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-04-07 23:43:42 +00:00
Choose font color based on background color
This commit is contained in:
parent
1e1b7e0382
commit
61a081d3c6
3 changed files with 11 additions and 4 deletions
|
|
@ -619,8 +619,7 @@ void Marker::updateSymbol()
|
|||
p.setPen(traceColor);
|
||||
p.setBrush(traceColor);
|
||||
p.drawConvexPolygon(points, 3);
|
||||
auto brightness = traceColor.redF() * 0.299 + traceColor.greenF() * 0.587 + traceColor.blueF() * 0.114;
|
||||
p.setPen((brightness > 0.6) ? Qt::black : Qt::white);
|
||||
p.setPen(Util::getFontColorFromBackground(traceColor));
|
||||
p.drawText(QRectF(0,0,width, height*2.0/3.0), Qt::AlignCenter, QString::number(number) + suffix);
|
||||
} else {
|
||||
symbol = QPixmap(1,1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue