Bug 433945 - Background transparency not applied to custom background colors
Summary: Background transparency not applied to custom background colors
Status: REPORTED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 20.12.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: J
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-04 10:23 UTC by me
Modified: 2021-03-08 13:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
screenshot (263.51 KB, image/jpeg)
2021-03-04 10:23 UTC, me
Details
kde neon live cd screenshot (516.74 KB, image/png)
2021-03-05 01:55 UTC, me
Details

Note You need to log in before you can comment on or make changes to this bug.
Description me 2021-03-04 10:23:30 UTC
Created attachment 136362 [details]
screenshot

SUMMARY

Text in konsole loses transparent background when setting custom background with ANSI escape codes. Its background should also be transparent for visual consistency.

STEPS TO REPRODUCE
1. Open konsole settings -> Appearence -> set background transparency to 50%.
2. Type "echo -e '\u001b[40m123456'" to display some text with custom black background.

OBSERVED RESULT

The background is not transparent.

EXPECTED RESULT

The background should be transparent as well.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

Although normally not a big problem, losing background transparency make it look really bad for vim with a custom color scheme, which usually sets a custom background and makes transparency mismatch between the text area and the scroll bar. Please see the attached screenshot.
Comment 1 J 2021-03-04 13:10:37 UTC
Hi

Thank you for creating a report.

Can you please send a bit more information on the software/OS Versions you are using please? I am seeing a mixture of information not relating to actual OS, version number etc. Please copy to clipboard from system info and paste is here when you can.

Thank you
Regards
J
Comment 2 me 2021-03-04 13:22:27 UTC
Oops, forgot about it :(. It seems not related to a specific version anyways.

SOFTWARE/OS VERSIONS
Linux: Arch Linux
KDE Plasma Version: 5.21.2
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2
Kernel Version: 5.11.2-arch1-1
OS Type: 64-bit
Graphics Platform: X11
Comment 3 J 2021-03-04 15:44:23 UTC
Hi

No worries :), That's perfect thank you. It mainly for the Devs and for diagnosis/reproducing means.

So I have followed your steps specified and viewed the picture you have attached.

Reproduced steps:

To get to the settings I had to follow Konsole > Settings > Edit Current profile > Appearance >  Edit (Chosen colour scheme, mine was Breeeze) > change background transparency to 50%

Run the echo command in Konsole with ANSI escape colour code you specified: echo -e '\u001b[40m123456'


Results:

The background is transparent for me and functions as intended, there is no black background around the text for me like what is specified in the picture.

VIM was also opened and displayed the transparent background and scroll bar as intended.

To confirm  I also tried the colour codes:

42,43,44 and all display the background around text as expected.

I have a few more questions?

Are you using the default Konsole profile when changing the transparency?

Have you tried making a fresh Konsole profile, changing the transparency closing the Konsole and then running the command?


Thank you
Regards
J
Comment 4 me 2021-03-05 01:54:38 UTC
> Are you using the default Konsole profile when changing the transparency?

No, I'm using a downloaded color scheme (One Half Light). I have also changed a few other settings.

> Have you tried making a fresh Konsole profile, changing the transparency closing the Konsole and then running the command?

I was able to reproduce this using the KDE Neon live CD in QEMU using the default profile and after restarting Konsole.

When the background color is black, which matches the original background color, transparency is applied correctly. For other colors, it is not applied. Please see the new screenshot.

The script I used to display different backgrounds is:

for x in {0..8}; do for i in {30..37}; do for a in {40..47}; do echo -ne "\e[$x;$i;$a""m\\\e[$x;$i;$a""m\e[0;37;40m "; done; echo; done; done; echo ""
Comment 5 me 2021-03-05 01:55:12 UTC
Created attachment 136383 [details]
kde neon live cd screenshot
Comment 6 J 2021-03-08 12:50:34 UTC
Hi

Thanks for the info, I have installed the One Half Light Theme and had another play around.
I have run the original ANSI escape code you specified ("echo -e '\u001b[40m123456'" ) using the One Half Light Theme set to 50% transparency and it shows the same blocked out text background in your first image. 

To confirm it was not the theme itself I tried a variety of colour schemes, and as you mentioned any black background colour scheme set to 50% transparency displays the text the correct way(readable), but any colour scheme with a light or white background displays the text in a black box (Barely readable or unreadable) same as the example in your first image.


Conclusion:
I was able to reproduce after installing the custom theme (One Half Light) and testing any default colour scheme with a light or white background.

Software/OS Version:
Operating System: Fedora 33
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2
Kernel Version: 5.10.17-200.fc33.x86_64
OS Type: 64-bit
Comment 7 me 2021-03-08 13:45:29 UTC
Hello,

I've just dig through the code and found the line causing this behaviour:

https://invent.kde.org/utilities/konsole/-/blob/master/src/terminalDisplay/TerminalPainter.cpp#L395

So does it work this way by design? If so that's too bad. :(