UI color palettes vs. document color palettes

C. Boemann cbo at boemann.dk
Thu May 10 15:12:19 BST 2012


On Wednesday 09 May 2012 23:55:00 Friedrich W. H. Kossebau wrote:
> 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?
No one i think, but pierre stirnweiss is the one who made the combobox


> 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.
Yes it is initialized by the shape normally, probably need something similar 
for the thumbnailer

but the palette is indeed taken from the application as it should

> 
> 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< ---
> 
see my reply below

> 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< ---
Right

> 
> 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.
> 
Well we do like Ms word. show white and black and ignore the ui colors
How it should be imho

> 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?

the color of the page i would say. It's a preview not a ui element, however we 
should do this by setting the palette as we show some widgets on top.

> 
> What if the background is not a simple color, but something more
> complicated?
That is just bad i guess, not sure anyone has a solution, and even so i fear 
it may be very difficult to implement

> 
> 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.
no answer there



More information about the calligra-devel mailing list