UI color palettes vs. document color palettes
Friedrich W. H. Kossebau
kossebau at kde.org
Wed May 9 22:55:00 BST 2012
Hi,
I am currently looking into fixing the conflict of the character/paragraph
preview rendering e.g. in the paragraph style selection combobox (see
attachment), which shows most with dark UI color schemes.
Who else has looked into that before or is perhaps looking right now or plans
to do so?
One reason I see in the member KoTextDocumentLayout::PaintContext::textContext
of type QAbstractTextDocumentLayout::PaintContext, which seems nowhere
explicitely initialized, thus keeps as values "the application's default
palette" (cmp. API dox). Which can result in non-compatible mixing of the
document colors and the UI colors.
E.g. in "KoTextLayoutArea::paint(...)" for styles that have no color set for
the text the text color as set for the UI is used -> fail for dark UI schemes.
--- 8< ---
painter->setPen(context.textContext.palette.color(QPalette::Text)); // for
text that has no color.
--- 8< ---
Similar in "TextShape::paintComponent(...)" for hightlighting the palette is
actually the one of the UI... which kind of makes sense here, okay.
--- 8< ---
KoTextDocumentLayout::PaintContext pc;
[...]
QPalette palette = pc.textContext.palette;
selection.format.setBackground(palette.brush(QPalette::Highlight));
selection.format.setForeground(palette.brush(QPalette::HighlightedText));
pc.textContext.selections.append(selection);
--- 8< ---
>From what I understood the flag "UseWindowFontColor" is also just resulting in
black or white, depending on the luma of the effective background, but never
the UI colors, right? Hm, that is actual an error in
KoTextLayoutArea::paint(...), "the window foreground color should be used as
the foreground color for a light background color", not black (20.385
style:use-window-font-color). Which again will be a problem with dark UI color
schemes, which might need the inverse treatment, i.e. if the difference of the
luma is too low, then black should be used.
Still, what to do in the case that flag is not set? What should be used for
the background in the style preview in general?
The color of the current shape?
The color of the page?
What if the background is not a simple color, but something more complicated?
And I still am curious why KoTextLayoutArea::paint(...) renders the text in
black on the document, when it uses the UI text color if called from
KoStyleThumbnailer, for the same paragraph/character style.
Cheers
Friedrich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Selection of paragraph styles with dark UI color scheme
Type: image/png
Size: 25801 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20120509/3cd6b879/attachment.png>
More information about the calligra-devel
mailing list