D19542: [WIP] Make pop-up note text visible whatever background color is
David Hurka
noreply at phabricator.kde.org
Wed Mar 6 10:35:40 GMT 2019
davidhurka added a comment.
Erm, my Okular 1.6.2 already does this, just with another threshold. Below value() = 129, the text (and the header) become white, above value() = 128, they become black.
While searching for the code, I just found ui/drawingtoolactions.cpp:48, which does something similar:
// draw check mark
const int lightness = ((color.red() * 299) + (color.green() * 587) + (color.blue() * 114)) / 1000;
p.setPen( lightness < 128 ? Qt::white : Qt::black );
p.drawText( QRect( QPoint( 0, 0 ), pmSel.size() ), Qt::AlignCenter, QStringLiteral("\u2713") );
Is it possible that Qt automatically sets the text color based on the background color, when the text color is not explicitely given?
REPOSITORY
R223 Okular
REVISION DETAIL
https://phabricator.kde.org/D19542
To: yurchor, #okular
Cc: davidhurka, aacid, okular-devel, tfella, ngraham, darcyshen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20190306/4a8c9c78/attachment.html>
More information about the Okular-devel
mailing list