Bug 152593 - Line Width tool in the sidebar does not respect dark mode
Summary: Line Width tool in the sidebar does not respect dark mode
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
6.2 all versions
Hardware: All Linux (All)
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.5.0.0.beta2 target:7.6.0
Keywords:
Depends on:
Blocks: Linux-Dark-Mode
  Show dependency treegraph
 
Reported: 2022-12-19 14:03 UTC by Rafael Lima
Modified: 2022-12-26 19:50 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenhot showing the problem (22.99 KB, image/png)
2022-12-19 14:03 UTC, Rafael Lima
Details
clip of 7.6.0 master from Win10 in 'dark' theme (115.59 KB, image/png)
2022-12-19 16:18 UTC, V Stuart Foote
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Lima 2022-12-19 14:03:00 UTC
Created attachment 184239 [details]
Screenhot showing the problem

In Impress using a dark theme, if you add a shape and try to edit its line width using the sidebar you'll notice that the Line Width tool does not respect dark mode. The line is dark over a dark background. The line should be in a light color.

See attached image for more details.

System info

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: f0652cb46e4e162032a763f8515354506d1683ed
CPU threads: 16; OS: Linux 5.19; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Calc: CL threaded
Comment 1 V Stuart Foote 2022-12-19 16:18:02 UTC
Created attachment 184242 [details]
clip of 7.6.0 master from Win10 in 'dark' theme

OK on Windows 10 in dark theme mode

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 98f0dd5e15733ac7f1d929d06ab230b5f04121d5
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded
Comment 2 Stéphane Guillou (stragu) 2022-12-19 16:29:07 UTC
Also seen in e.g. Writer.

Already an issue in 6.2 (grey on dark grey):

Version: 6.2.0.0.beta1
Build ID: d1b41307be3f8c19fe6f1938cf056e7ff1eb1d18
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3; 
Locale: en-AU (en_AU.UTF-8); UI-Language: en-US
Calc: threaded

Not just KF5, GTK also affected.
Comment 3 Rafael Lima 2022-12-20 18:48:30 UTC
From what I could find in the code, the entries in the toolbar are images defined in:

https://opengrok.libreoffice.org/xref/core/svx/inc/bitmaps.hlst?r=26643b50#128

And they're used here:

https://opengrok.libreoffice.org/xref/core/svx/source/sidebar/line/LinePropertyPanelBase.cxx?r=f1b7a69b#405

So apparently we need to create the dark variant of these images.
Comment 4 Rafael Lima 2022-12-20 18:49:43 UTC
@Rizal, can you please check if fixing this bug indeed requires new images (dark variant), as per comment #3 ?
Comment 5 V Stuart Foote 2022-12-20 19:06:20 UTC
Maybe, but on Windows builds we get a clean toggle/reverse of the fg/bg colors for the panel in 'dark' theme vs 'light' theme.  So would think the same color swap can be done without needing new bitmaps.
Comment 6 Rafael Lima 2022-12-20 19:38:01 UTC
(In reply to V Stuart Foote from comment #5)
> Maybe, but on Windows builds we get a clean toggle/reverse of the fg/bg
> colors for the panel in 'dark' theme vs 'light' theme.  So would think the
> same color swap can be done without needing new bitmaps.

I think there might be something to easily swap the color of bitmaps, but I could not find this in the code.

Do you have a code pointer for this?
Comment 7 V Stuart Foote 2022-12-20 19:43:18 UTC
I do not, but IIUC Caolán was able to tweak it for the Windows instance. Maybe same can be done for other os/DE...
Comment 8 Caolán McNamara 2022-12-21 10:13:43 UTC
We are indeed using icons there, and
https://opengrok.libreoffice.org/xref/core/svx/inc/bitmaps.hlst?r=26643b50#128
are the ones used.

it happens that the colibre_dark theme has them as
icon-themes/colibre_dark/svx/res/symphony/width1.png
so that's why the Windows case works and the other don't

That said, for the "Line Style" widget right above this Line Width widget we render the lines at runtime instead of using icons, so if we reuse that we don't have to force the icon people to create dark variants of these fairly simple lines and wait for all that to happen

https://gerrit.libreoffice.org/c/core/+/144651
Comment 9 Commit Notification 2022-12-21 13:57:00 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/eeec4a68376d142ab8912a6911bff0081e92a0ed

Resolves: tdf#152593 reuse Line Style preview code for Line Width preview

It will be available in 7.5.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2022-12-21 13:57:03 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/701ec65fff1cc532f7ee7b8be3883c6a536e2c85

Resolves: tdf#152593 reuse Line Style preview code for Line Width preview

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Stéphane Guillou (stragu) 2022-12-26 19:50:53 UTC
Fix verified in:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 18b39c8c9b35528c8fb172339126b613827d09aa
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Thanks Caolán!