Commit 72368b71 authored by Andrew Smith's avatar Andrew Smith Committed by Kurt Hindenburg

Allow small colour changes when varying dark backgrounds

Black backgrounds don't get a (visible) random colour if "Vary the
background colour" has been checked. This is because the only
changes currently made aren't visible if the colour is black. Instead,
if we get a black background allow a small change in the colour
value so that the randomized colour is noticeable.

BUG: 311263
FIXED-IN: 18.12

Test Plan:
Create a new profile with a black background and the "Vary the
background colour" option checked. Opening new tabs with this
profile should produce tabs with slightly different background colours.

Reviewers: #konsole, konsole-devel, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: #konsole, konsole-devel

Tags: #konsole

Differential Revision:
parent d1e5296e
......@@ -301,8 +301,16 @@ void ColorScheme::setRandomizedBackgroundColor(bool randomize)
// adjusted as much as possible.
// the value and saturation are left alone to maintain read-ability
// except for dark background schemes which allow a change in the
// colour value (one less than the dark background threshold)
if (randomize) {
setRandomizationRange(BGCOLOR_INDEX, MAX_HUE, 255, 0);
int maxValue = 0;
if (hasDarkBackground()) {
maxValue = 126;
setRandomizationRange(BGCOLOR_INDEX, MAX_HUE, 255, maxValue);
} else {
if (_randomTable != nullptr) {
setRandomizationRange(BGCOLOR_INDEX, 0, 0, 0);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment