Desaturate extreme temperatures to improve colors#45
Draft
aeraglyx wants to merge 1 commit intopsi4j:mainfrom
Draft
Desaturate extreme temperatures to improve colors#45aeraglyx wants to merge 1 commit intopsi4j:mainfrom
aeraglyx wants to merge 1 commit intopsi4j:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An experiment to test desaturating screen before applying the temperature multiplier to improve readability of saturated colors.
Problem
Imagine blue text on black background. When using very low temperatures, blue and green channels get multiplied to almost 0, making it hard to read (compared to greyscale or red text). Same thing for white text on red background - blue/green components get dimmed, and what remains is red on red... So potentially an accessibility thing.
Solution
We can first partially desaturate the image and then apply the temperature correction. To do that, instead of using only the diagonal components of the CTM, we can split the contributions within each row. The result is the same overall temperature (no change for greyscale), but saturated text is more readable and images look (subjectively) more pleasant.
In this PR, I'm exponentially reducing saturation the further we get from 6500K (in the inverse space). There is one variable to control the desaturation strength, through experimentation I found 0.4 to work pretty well.
Attribution - calibration image found here.
Technically, it might be better to use some proper Chromatic Adaptation Transform, but I believe those can go negative, which
hyprland_ctm_control_v1does not support anyway.Works in Hyprland, currently no clue about other backends...