Bug 125329 - Automatic font color changes from black to white on resize of charts (or filesave) with dark document background (comment 14)
Summary: Automatic font color changes from black to white on resize of charts (or file...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: accessibility, bibisected, bisected, regression
Depends on:
Blocks: Chart Options-Dialog-Colours Automatic-Color
  Show dependency treegraph
Reported: 2019-05-17 00:34 UTC by Cathy Crumbley
Modified: 2024-06-03 03:46 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:

data for testing chart (21.33 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-05-17 00:36 UTC, Cathy Crumbley

Note You need to log in before you can comment on or make changes to this bug.
Description Cathy Crumbley 2019-05-17 00:34:38 UTC
Observed in versions and

To reproduce the problem:

Go to Tools > Options  > Application Colors  
Under Document background, select Dark Gray 3 and click OK
Select data for chart (example data attached) and ensure that font color is Automatic
Click on Chart Wizard icon in the Standard toolbar
Select any chart type
Click Finish
Click outside chart to leave edit mode
Click chart to select it
Click and drag a selection handle to increase or decrease chart size 

Expected result:
The font color in the chart axis labels and legend is black 

The font color in the chart changes from black to white when the chart size is changed. Because the chart background is white, the white text becomes invisible.
Comment 1 Cathy Crumbley 2019-05-17 00:36:46 UTC
Created attachment 151473 [details]
data for testing chart
Comment 2 BogdanB 2019-05-17 16:07:28 UTC
I could reproduce this on Linux 6.2

Build ID: aecc05fe267cc68dde00352a451aa867b3b546ac
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ro-RO (ro_RO.UTF-8); UI-Language: en-US
Calc: threaded
Comment 3 BogdanB 2019-05-17 16:13:17 UTC
With the mention that text is first black, but after going outside of the chart and resize it the font color change...To automatic which in this case became WHITE.

Reproduce also on

Build ID: 96ab20756316b25b7f2343a15596bc5114ea5a68
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2019-05-02_14:29:16
Locale: ro-RO (ro_RO.UTF-8); UI-Language: en-US
Calc: threaded
Comment 4 Timur 2020-04-01 07:12:45 UTC Comment hidden (obsolete)
Comment 5 Timur 2020-05-11 09:21:26 UTC Comment hidden (obsolete)
Comment 6 Luke Deller 2020-05-20 13:25:06 UTC
Thanks Timur.

This commit 77e21bb36a2cdaaa0f4049dee0d45c5b2325c6e9 simply changes the threshold at which a colour is considered "dark".

When I revert the change in commit 77e21bb36a2cdaaa0f4049dee0d45c5b2325c6e9 upon latest git master, I can still reproduce the problem using a document background of "Dark Grey 3" (red=28,green=28,blue=28).

I suspect your bibisection was using a slightly lighter colour?  Would it be possible to repeat bibisection with a darker colour?

In terms of debugging the underlying problem, I notice that the decision to use a white font comes from editeng/source/editeng/impedit3.cxx ImpEditEngine::GetAutoColor()
(because if I change that to return COL_LIGHTRED instead of COL_WHITE then try to reproduce this bug, the font color in the chart axis label becomes light red when I resize the chart).
This wrong decision appears to be because it is referring to background colour of the ImpEditEngine instance which is different from the background colour of the chart.
Comment 7 Timur 2021-07-16 10:41:39 UTC Comment hidden (obsolete)
Comment 8 QA Administrators 2023-07-17 03:13:26 UTC Comment hidden (obsolete)
Comment 9 Stéphane Guillou (stragu) 2023-09-06 11:41:43 UTC
Still reproduced in using the Dark scheme in Application Colours. After resize or filesave, colour becomes unreadable.

The other way around, in Draw/Impress, the chart starts with unreadable dark-on-dark, then uses white on resize or filesave.

No change in Writer.

Given that:
- we now have the Dark scheme in Application Colours
- it is applied automatically in some cases (see e.g. bug 152184)
- it affects Draw/Impress as well, not just Calc
- it is a regression
- it affects accessibility
I am increasing the priority to "high"

Version: (X86_64) / LibreOffice Community
Build ID: c7cda394c5de06de37d8109c310df89a4d4c3a98
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 10 Heiko Tietze 2023-09-06 12:16:37 UTC
Confirming the issue for Dark/Impress with transparent chart background but not Calc where the background is white.
Comment 11 Stéphane Guillou (stragu) 2023-09-06 13:52:29 UTC Comment hidden (obsolete)
Comment 12 Heiko Tietze 2023-09-11 05:32:13 UTC
(In reply to Stéphane Guillou (stragu) from comment #11)
> Try resizing the object outside of edit mode, maybe?
Nope, maybe because I'm on kf5.
Comment 13 Xisco Faulí 2023-09-14 14:18:43 UTC Comment hidden (obsolete)
Comment 14 Stéphane Guillou (stragu) 2023-09-15 09:12:23 UTC
To avoid the issue of thresholds, I tested with a black document background (thanks for the hints, Luke).

Using the linux-64-releases bibisect repo:
- OOo 3.3 to LO white font, doesn't change after resize
- since early 4.0 (some builds could not run): starts with black font, but resize updates it to white

Because Calc uses a white chart area, it looks like the issue was inherited (white on white always) and slightly improved in 4.0 (black on white at creation, but white on white at resize).
Because Draw uses a "none" fill for the chart area, it looks like a regression in 4.0 (was white on black always, but is now black on black at creation, then white on black at resize).

So the underlying issue is the same in both components, but there's two aspects:
- generally, automatic font colour in the chart should consistently be based on whatever is visible behind it, straight away at chart creation. This is an inherited issue.
- specifically, the issue of font colour change on resize is a regression in 4.0. I'm focusing the summary on this issue.

Using linux-43all bibisect repo, looking for the "font colour updates after a resize" issue, I get to the following range:

From that range, I'd say the most likely one is the mega commit "re-base on ALv2 code": 44cfc7cb6533d827fd2d6e586d92c61d7d7f7a70

Charts objects are extra tricky in that they have a chart area but they also have an object background (see e.g. bug 125714) and can contain a number of extra objects with their own background (title, legend).
Comment 15 Stéphane Guillou (stragu) 2023-09-15 09:17:21 UTC
(In reply to Heiko Tietze from comment #12)
> Nope, maybe because I'm on kf5.
I can reproduce the switch in colour in both Draw and Calc with gtk3, kf5 (cairo+xcb), and gen.