Keep perceived contrast in random background color
ClosedPublic

Authored by mglb on Apr 5 2019, 12:33 PM.

Details

Summary

Randomize colors using HSLuv color space instead of HSL. It has
perceptually uniform lightness, which means every color with the same
lightness value is perceived as equally bright by humans. Displays
quality and lack of calibration in most monitors lowers this uniformity,
but even on worst color display it should be better than standard HSL.

More information about HSLuv: http://www.hsluv.org/

Minor changes:

  • Random seed takes PID into account to prevent repeated colors in separate Konsole processes
  • Key names in a config were changed
  • Adapted "Black on random light" color scheme

Breeze with random ranges on default bg and fg: hue=360° saturation=100:

To be done in future:

  • Automatically convert color schemes which use old randomization method.

Diff Detail

Repository
R319 Konsole
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mglb requested review of this revision.Apr 5 2019, 12:33 PM
mglb created this revision.
mglb edited subscribers, added: Konsole, VDG; removed: konsole-devel.

Thanks, I agree the colors look much better. This seems like a lot of code for just random backgrounds and I"m not sure how many people use that colorscheme.

What's the status of this? Still a WIP? I'm fine w/ adding it to Konsole; the other schemes could be adjusted to use this later correct?

mglb added a comment.Jul 26 2019, 5:18 PM

I kind of forgot about this. Time to bump it on todo list.

There are two important things to do:

  • Automatic conversion of old schemes when it is loaded, so existing schemes will work, albeit a bit differently.
  • Right now, turning color randomization off and on in profile settings resets randomization settings in a scheme - needs to be fixed.

Ok, those can be done later IMHO - any objection to committing this now?

mglb updated this revision to Diff 63928.Aug 17 2019, 2:56 PM
mglb retitled this revision from [WIP] Keep perceived contrast in random background color to Keep perceived contrast in random background color.
mglb edited the summary of this revision. (Show Details)
  • Randomization on/off works as intended
  • Minor fixes

The only remaining thing is auto conversion of old randomization parameters. To be done in future.

This can be merged.

mglb updated this revision to Diff 63930.Aug 17 2019, 3:21 PM

Spaces, rebase

I don't see any issues testing so far - minor issue obseloteKeys is misspelled

mglb updated this revision to Diff 63933.Aug 17 2019, 4:02 PM

s/obselote/obsolete/

hindenburg added inline comments.Aug 17 2019, 5:33 PM
src/ColorScheme.cpp
42–51

nitpick - you don't need to fix these now - "static definition in anonymous namespace; static is redundant here"

mglb updated this revision to Diff 63942.Aug 17 2019, 7:17 PM

Remove static in anonymous namespace

mglb marked an inline comment as done.Aug 17 2019, 7:18 PM
hindenburg accepted this revision.Aug 17 2019, 8:08 PM

thanks for sticking w/ this

This revision is now accepted and ready to land.Aug 17 2019, 8:08 PM
This revision was automatically updated to reflect the committed changes.

FYI, these are showing up in the builds

https://build.kde.org/job/Applications/job/konsole/job/kf5-qt5%20SUSEQt5.12/lastSuccessfulBuild/warnings30Result/

ColorScheme.cpp:314, GNU Make + GNU C Compiler (gcc), Priority: Normal

assignment from temporary initializer_list does not extend the lifetime of the underlying array [-Winit-list-lifetime]

ColorScheme.cpp:316, GNU Make + GNU C Compiler (gcc), Priority: Normal

assignment from temporary initializer_list does not extend the lifetime of the underlying array [-Winit-list-lifetime]

FYI, these are showing up in the builds

https://build.kde.org/job/Applications/job/konsole/job/kf5-qt5%20SUSEQt5.12/lastSuccessfulBuild/warnings30Result/

ColorScheme.cpp:314, GNU Make + GNU C Compiler (gcc), Priority: Normal

assignment from temporary initializer_list does not extend the lifetime of the underlying array [-Winit-list-lifetime]

ColorScheme.cpp:316, GNU Make + GNU C Compiler (gcc), Priority: Normal

assignment from temporary initializer_list does not extend the lifetime of the underlying array [-Winit-list-lifetime]

fixed in https://invent.kde.org/kde/konsole/merge_requests/28