Background: More red / Less blue at night
To save the eyes at night, adding more red and/or subtracting blue, is becoming popular in Windows 10 (blue-light filter) and Linux; Gnome Desktop (Night Light) and Ubuntu Unity Desktop with add-ons such as Red Shift or f.lux.
I'm wondering how to accomplish the same with Ubuntu's built-in command line xrandr <monitor> --gamma 1:1:1
feature. The 1:1:1
represents percentage of red:green:blue. I presume 1
= 100%. I'm not sure if the above packages add more red (1.2:1:1
) for ~20% increase or reduce blue (1:1:0.8
) for ~20% decrease or both for ~40% change.
Gnome Night Light example doesn't help
According to OMG Ubuntu, within Gnome's Night Light you can use these numerical values:
- 1000 — Lowest value (super warm/red)
- 4000 — Default night light on temperature
- 5500 — Balanced night light temperature
- 6500 — Default night light off temperature
- 10000 — Highest value (super cool/blue)
To test these numerical values, how would does one translate them to override the default --gamma 1:1:1
?
What xorg's documentation says
Xorg's documentation doesn't say very much about --gamma
controls:
−−gamma red:green:blue
- Set the specified floating point values as gamma correction on the crtc currently attached to this output. Note that you cannot get two different values for cloned outputs (i.e.: which share the same crtc) and that switching an output to another crtc doesn’t change the crtc gamma corrections at all.
Floating decimal points will be helpful because the script I want to upgrade sets xbacklight
brightness slowly once a minute over a 90 to 120 minute transition period at dawn and dusk. I want to enhance the script with both xrandr --brightness
software support for external monitors and OLED built in displays and xrandr --gamma
support for red light / blue light filters. Xorg doesn't say how many decimal positions are supported but I think I think I will set bc
calculations should be to 3 or 4 decimal positions for readability / precision balance.
Summary
I'm hoping to mimic what "the big guys" at Microsoft and Gnome are doing with their "more red" and/or "less blue" techniques. I haven't delved into Wayland yet but answers using that system will also be appreciated as it will no doubt be a future concern.