Trouble with theme color in docx

Tomaž Vajngerl quikee at gmail.com
Tue Jan 3 11:02:25 UTC 2023


Hi Regina,

On Mon, Jan 2, 2023 at 6:43 AM Regina Henschel <rb.henschel at t-online.de>
wrote:

> Hi Miklos, hi Tomaž, hi all,
>
> Tomaž, I have put you in CC because you are currently heavily working on
> theme colors.
>
> I come across the problem, that my import in
> https://gerrit.libreoffice.org/c/core/+/143615 does not get the correct
> color, if theme colors other than 'accent1'..'accent6' are used.
>
> Colored text in shapes in PowerPoint and fill and stroke of shapes in
> Word use e.g.:
> <a:rPr> <a:solidFill> <a:schemeClr val="bg1">
> But colored text in shapes in Word uses e.g.:
> <w:rPr> <w:color w:themeColor="background1">
>
> The themeColor attribute uses ST_ThemeColor (ISO 17.18.97) and that are
> the long variants of the color keys, e.g:
> background1, dark1, light1
>
> <schemeClr> uses the ST_SchemeColorVal enumeration (ISO 20.1.10.54).
> That one has the same items as the elements in <clrScheme> in
> <themeElements> but with the additional items 'bg1', 'bg2', 'tx1', 'tx2'.
> The ClrScheme::getColor() method maps these additional items to 'lt1',
> 'lt2', 'dk1' and 'dk2' respectively before searching the color. But it
> does not catch the keys used with themeColor attribute.
>

Yes, you can add the missing long keys here and map them to the dark/light
variant.


> The only kind of mapping with the long variants that I have found at all
> is TDefTableHandler::getThemeColorTypeIndex and those assignments look
> wrong to me (e.g. using 0 for background1 and for dark1).
>

This is indeed wrong.. background should map to light and text to dark. I
will fix this but it will take a while until it hits master, unless you
need to change this too?


> VML import/export is likely effected too, because it uses <w:color
> w:themeColor=".."> too.
>

Yes, probably this needs to be changed also, but it's only for backwards
compatibility.


> Where to fix it?
>

I think for this you will need to change the implementation in oox to just
map the keys and it should work I guess.


> Kind regards,
> Regina


Tomaž
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20230103/c57f726e/attachment.htm>


More information about the LibreOffice mailing list