Bug 370726

Summary: Text selection tool highlight unintelligible with some color schemes
Product: [Applications] okular Reporter: Jim Sung <jsung>
Component: PDF backendAssignee: Okular developers <okular-devel>
Status: CONFIRMED ---    
Severity: normal CC: i, m.mahmoudian, nate, xaver.hugl
Priority: NOR Keywords: usability
Version: 0.24.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: The Breath Dark theme's color on a PDF with white background and black text

Description Jim Sung 2016-10-14 06:28:27 UTC
On a black-on-white PDF document, if I use the "Text Selection Tool" to generate a selection, it looks like the highlight background color (I guess it is blue by default) is used, but not the highlight foreground color (both "kdiff3" and "kate" seem to use white), which makes the selection unintelligible.

Okular's own https://okular.kde.org/images/screenies/okular-backend-pdf-1.png and https://okular.kde.org/images/screenies/okular-textselection.png show this.

Reproducible: Always

Steps to Reproduce:
1. Open a PDF document.
2. Tool -> Text Selection Tool.
3. Click-and-drag to generate a selection.

Actual Results:  
Okular highlights the selection with black-on-blue.

Expected Results:  
White-on-blue selection.
Comment 1 Nate Graham 2017-09-29 02:39:12 UTC
Using the selection text color from the theme would definitely work, but might look ugly, like we're mangling the presentation of the document. Maybe instead when the text is dark, we could impose a certain amount of lightness on the selection background, to ensure that it's always readable.
Comment 2 Xu Zhao 2020-01-08 23:57:19 UTC
Can confirm this on Okular 1.9.0. Any progress on this bug?
Comment 3 Xu Zhao 2020-04-16 02:37:14 UTC
The problem persists on Okular 1.9.3. Any progress on this issue?
Comment 4 Zamundaaa 2020-06-23 16:25:04 UTC
>Using the selection text color from the theme would definitely work, but might look ugly, like we're mangling the presentation of the document. Maybe instead when the text is dark, we could impose a certain amount of lightness on the selection background, to ensure that it's always readable.

Well, with a dark selection color it's not just ugly but partly to completely unreadable.
Perhaps making the selection color transparent with the background could ensure a certain contrast while still retaining the original text color though?
Comment 5 Xu Zhao 2021-06-07 19:48:24 UTC
I submitted a tentative merge request to address this issue: https://invent.kde.org/graphics/okular/-/merge_requests/440

Maybe someone here could help review it?
Comment 6 Mehrad Mahmoudian 2023-05-26 09:26:18 UTC
Created attachment 159260 [details]
The Breath Dark theme's color on a PDF with white background and black text
Comment 7 Mehrad Mahmoudian 2023-05-26 09:27:09 UTC
I think this is the right thread. I am using Breath Dark theme on my Plasma and the selection theme works pretty fine everywhere that has a dark background (Dolphine, Plasma Settings, Kate, ...) , and also due to color inversion, it works fine in kdiff3 which has white background.

I checked the https://invent.kde.org/graphics/okular/-/merge_requests/440 but saw that it was closed without explanation/conclusion.

I tried to experiment with the color schemes and finally managed to find the right balance, but I think the most ideal situation is to either have a configurable selection color (perhaps the easiest), or similar to kdiff, the text color gets inverted if there is not enough contrast between the highlight color and the text color.


In case it matters, here is my system info:
- Okular Version: 23.04.0
- Operating System: Manjaro Linux 
- KDE Plasma Version: 5.27.4
- KDE Frameworks Version: 5.105.0
- Qt Version: 5.15.9
- Kernel Version: 6.1.26-1-MANJARO (64-bit)
- Graphics Platform: X11
- Processors: 20 × Intel® Core™ i9-10900K CPU @ 3.70GHz
- Memory: 31.1 GiB of RAM
- Graphics Processor: AMD Radeon Pro WX 3200 Series