D19542: [WIP] Make pop-up note text visible whatever background color is
Yuri Chornoivan
noreply at phabricator.kde.org
Wed Mar 6 11:00:22 GMT 2019
yurchor added a comment.
In D19542#425698 <https://phabricator.kde.org/D19542#425698>, @davidhurka wrote:
> 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?
Do you mean that the attached test case (text.pdf) works for you (the text in annotation window for the right blue pop-up note is visible)?
That's what I have for the git/master:
F6662406: invisible.png <https://phabricator.kde.org/F6662406>
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/6c629e3c/attachment.html>
More information about the Okular-devel
mailing list