3

I know how to change brightness and gamma with xrandr:

xrandr --output eDP1 --brightness 0.8 --gamma "0.90:0.85:0.80"

but how can I change saturation, ie decrease the amount of color and move on the spectrum closer to black/white ?

I need a way to change this on the command line, not on the hardware settings of my monitor.

I am using Debian 10

1 Answer 1

4
+100

The most convenient way (as of 2022) is via a tool named vibrant-cli (which should work on any X11 setup). The syntax is:

vibrant-cli OUTPUT [SATURATION]
Get or set saturation of output.

OUTPUT is the name of the X11 output. You can find this by running xrandr.
SATURATION is a floating point value between (including) 0.0 and (including) 4.0.

    0.0 or 0 means monochrome
    1.0 or 1 is normal color saturation (100%)
    if empty the saturation will not be changed

e.g. to reduce saturation to 30% on my laptop I'd run

vibrant-cli eDP-1 0.3
libvibrant version 1.0.2
Saturation of eDP-1 is 0.300000

libvibrant identifies your graphics chipset and attempts to change the saturation via the known methods supported by the driver for that particular GPU. If your hardware/drivers don't support changing color vibrance, you'll get an error.
Note that Color Management for DRM (Direct Rendering Manager) layer is rather recent:

Color Manager framework defines a color correction property for color space
transformation and Gamut mapping.  
This property is called CTM (Color Transformation Matrix).

This patch adds a new structure in DRM layer for CTM. This structure can be used
by all user space agents to configure CTM coefficients for color correction.

So, in order to determine whether your platform supports color management via open-source drivers1 (i915 and amdgpu) you would run xrandr --properties. If there is no mention of CTM or if it says CTM: 0 then your setup doesn't support changing saturation via CTM (maybe via other methods, see the note at the bottom of the post concerning nVidia).
If you have a line like CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 e.g. for eDP-1 output:

..................
eDP-1 connected primary.....
..................
link-status: Good 
        supported: Good, Bad
CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 
        0 1 
CONNECTOR_ID: 78 
        supported: 78

then your setup supports color management i.e. the property Color Transform Matrix can be set... This is still a job of vibrant-cli unless, of course, you want to do the math yourself... for instance, to set saturation to 0 (grayscale) the command is

xrandr --output eDP-1 --set CTM '1431655765,0,1431655765,0,1431655765,0,1431655765,0,1431655765,0,1431655765,0,1431655765,0,1431655765,0,1431655765,0'

1: I only have access to those two platforms (and I have not tried the AMD proprietary driver - no idea if it supports CTM). For the nVidia GPUs, apparently there's a property called digital vibrance that can be set (when using the nVidia driver) via nVidia control panel or in terminal running e.g. nvidia-settings -a [gpu:0]/DigitalVibrance[DFP-1]=235 (consult the manual for proper syntax). I don't know if nouveau supports the same property or not...

9
  • thank you. I have compiled vibrant-cli, but when I run it, I get: Cannot find output DisplayPort-0 in the list of supported outputs, it either does not exist or is not supported Dec 31, 2022 at 6:33
  • my GPU is: Radeon_Pro_WX_5100. And I have pasted xrandr output here: ctxt.io/2/AAAQnxiVFQ Dec 31, 2022 at 14:22
  • I am using open source driver (in linux kernel) Dec 31, 2022 at 18:21
  • @400theCat - support for CTM was added to the xf86 video driver not long ago if you read the discussion it says "If kernel driver does not support color management, the properties will remain disabled." so if your kernel doesn't support it I'm afraid there's not much you can do. Try adding amdgpu.dc=1 to your boot parameters and see if that changes anything. Other than that you could try a very up-to-date linux LIVEUSB (e.g. Manjaro) and see if things change when using the most recent kernel/xorg drivers. Dec 31, 2022 at 18:39
  • thank you for your investigation. Does it mean, with current kernel, it will not work using vibrant, while some other tool might work? Or will it not work in principle, because GPU driver does not support this operation? Jan 1, 2023 at 7:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .