Redshift

Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night. This program is inspired by f.lux (read here for the reason why I started this project).

Download

Latest release is redshift 1.7 published on 2011-07-04. There are also packages available for some distributions:

Project page (bug tracker)

This is the project page for redshift. Please report bugs or ask questions there.

Project description

Redshift adjusts the color temperature according to the position of the sun. A different color temperature is set during night and daytime. During twilight and early morning, the color temperature transitions smoothly from night to daytime temperature to allow your eyes to slowly adapt. At night the color temperature should be set to match the lamps in your room. This is typically a low temperature at around 3000K-4000K (default is 3700K). During the day, the color temperature should match the light from outside, typically around 5500K-6500K (default is 5500K). The light has a higher temperature on an overcast day.

Redshift running in one-shot mode

Technical details

On linux and similar systems the color temperature is set with an X server extension. On the windows platform it is set using GDI. The color temperature is changed by setting appropriate gamma ramps. If you have configured your own gamma ramps they will be overwritten but in that case you probably care too much about color accuracy to use this program anyway. Your graphics driver and X server needs to either support at least RANDR version 1.3 or the VidMode extension.

Redshift assumes that your screen will produce light at a color of 6500K when no color correction is applied by the program. Thus, 6500K is the neutral temperature. Setting the color temperature to a value higher than this results in more blue light, and setting a lower value will result in more red light.

Configuration options

Redshift will continously update the color temperature at regular intervals. One shot mode can be selected if you only want to do one adjustment. The color adjustments done by Redshift can be temporarily toggled on and off by sending it the USR1 signal:

 $ pkill -USR1 redshift

The command line options are explained in the following paragraphs. All options have reasonable defaults. You’ll need to specify your current location only if redshift can’t obtain the location from an automatic location provider. All color adjustment methods will be tried until one that works is found unless you explicitly select one. The same applies to location providers.

  -h		Display this help message
  -v		Verbose output
  -V		Show program version

  -b N		Screen brightness to apply (max is 1.0)
  -c FILE	Load settings from the specified configuration file
  -g R:G:B	Additional gamma correction to apply
  -l LAT:LON	Your current location
  -l PROVIDER	Select provider for automatic location updates
  		(Type `list' to see available providers)
  -m METHOD	Method to use to set color temperature
  		(Type `list' to see available methods)
  -o		One shot mode (do not continously adjust color temperature)
  -x		Reset mode (remove adjustment from screen)
  -r		Disable temperature transitions
  -t DAY:NIGHT	Color temperature to set at daytime/night

Example (location is Copenhagen, Denmark):

 $ redshift -l 55.7:12.6 -t 5700:3600 -g 0.8 -m vidmode -v

Configuration file

A configuration file can be created, but the documentation is a bit sparse. You’ll have to create it manually. There’s an example here.

Status icon

Start the program gtk-redshift instead of redshift, with the same arguments as you would pass to redshift. This will create an icon for Redshift in the system tray. The icon will allow you to toggle Redshift on and off. Thanks goes to the Tango Desktop Project for the icon. gtk-redshift requires at least Python 2.6 and PyGTK 2.12.

Redshift status icon

Redshift status icon

Automatic location provider

Redshift can automatically determine your current location from Geoclue. The location can also be specified manually either with a command line option or in the configuration file.

Known bugs and limitations

  • Redshift won’t affect the color of your cursor when your graphics driver is configured to use hardware cursors. Some graphics drivers have an option to disable hardware cursors in xorg.conf.

Comments, suggestions, patches or donations will be greatly appreciated.

  • Aaron Griffin

    f.lux sucks on the Mac. There is so little control.

    I would LOVE to see a Mac port of this, as I use a Mac during the day

  • Claes

    Hi, very good program! Have you considered contributing it to Gnome? To make it part of the distribution? With the current work going in there that relates to color correction of photographies, I think it makes sense to have this as an option (i.e. they control the same things but for different intents)

  • Aitjcize

    This program is awsome!!!
    I’m thinking that if it is possible to detect the surroundings with the webcam and adjust it automatically?

  • Pingback: Help your eyes hurt less with Redshift in Ubuntu

  • Pingback: How to setup Redshift for Ubuntu | lazyscripter.com

  • lusitano78

    Very interesting application, since I always change my brigthtness monitor at the end of the day…

    On my Debian Squeeze – Gnome system, the gtk-redshift toggle function returns :

    Traceback (most recent call last):
    File “/usr/lib/pymodules/python2.5/gtk_redshift/statusicon.py”, line 51, in toggle_cb
    process.send_signal(signal.SIGUSR1)
    AttributeError: ‘Popen’ object has no attribute ‘send_signal’

    It seems that SIGUSR1 does not exist ? What should I do ?

  • Jon Lund Steffensen

    @lusitano78: The send_signal method seems to have been introduced in python 2.6. Please upgrade python if you want to use gtk-redshifft.

  • schrat

    Even at lowest brightness level my Display always “felt” way to bright at night or on cloudy days. I’ve been using Redshift for about a week now and I love it.

    Thank you so much.

  • Anton

    @Jon I love the idea of the script which checks the weather, however I see two problem with it:
    – it does that during startup only.
    – it does not work for my region (Asia)
    Please implement that functionality as an option too, so it would check weather let’s say hourly and change the color temperature continuously?

    Thanks a lot!

    @schrat it is opposite to me: I had to increase night temperature to 4500 on my old T42 Thinkpad with R300 ATI (x11-drivers/xf86-video-ati-6.12.6). It works fine with x11-drivers/xf86-video-intel

  • lusitano78

    Python 2.5 AND 2.6 are already installed on my system.
    Both scripts /usr/lib/pymodules/python2.5/gtk_redshift/statusicon.py and
    /usr/lib/pymodules/python2.6/gtk_redshift/statusicon.py are linked to the same file
    /usr/share/pyshared/gtk_redshift/statusicon.py .
    So I understand that gtk_redshift uses python2.5 in place of using the later version 2.6 automatically. Is that right ?
    I cannot uninstall 2.5 because a lot of packages are depending on it (adpt, brasero, compiz, evince, gdm, gnome, etc.).
    On Squeeze repository there is also python 3.
    So what should I do with all that ?

  • Jon Lund Steffensen

    @lusitano78: Ask in the debian forums perhaps?

  • lusitano78

    Yes, I will try some debian forums.
    But before that, something is not clear for me : the toggle function returns an error message saying that it cannot find the signal.SIGUSR1 in a python2.5 script. That indicates gtk-redshift uses python 2.5 (!). If the error message were about a python 2.6 script, that would mean it would use python 2.6, and there should be no error because signal.SIGUSR1 is part of 2.6. So gtk-redshift seems to not use the appropriate python version…
    What do you think of this ?

  • Jon Lund Steffensen

    @lusitano78: Yes, it seems that gtk-redshift is running in the default python interpreter which happens to be version 2.5 in your case. You may have to switch the default python to be 2.6 or edit the gtk-redshift script to explicitly request to be run in python 2.6.

  • lusitano78

    Unfortunately, I am not a programmer and I don’t know anything on python. So I cannot edit the gtk-redshift script to make it running in 2.6 (but perhaps could you give me some hint ?)
    Otherwise, the page http://wiki.debian.org/ReleaseGoals/Python2.6 indicates there is some work to get python 2.6 by default in Squeeze.
    So I cannot go further. I will use only redshift, waiting for Squeeze improvement.
    Anyway, thanks for your answers.

  • loner

    I hope you will add support for Ubuntu Lucid soon, now that it has been released.

  • Tito

    Hello,
    I discovered redshift just one week ago and used it until I upgraded to Lucid 64 bits yesterday. Now I cannot install from PPA and I tried to compile from source but when I run ./configure it says
    checking whether to enable RANDR method… missing dependencies
    checking whether to enable VidMode method… missing dependencies
    configure: error: either RANDR or VidMode must be enabled.
    Do I miss something here?

    Just one day without Redshift I realized how useful it is.
    Thanks for a great app. :)

  • Jon Lund Steffensen

    @loner, Tito: I will update the PPA for Lucid as soon as have time. If you want to build from source you’ll need libxxf86vm-dev for VidMode and libxcb-randr0-dev for RANDR support.

  • Tito

    Thank you for a quick reply.
    I successfully compiled and install it. But when I run it says

    $ redshift -l 55.7:12.6 -t 5700:3600 -g 0.8 -m vidmode -v
    VidMode method was not enabled at compile time

    Then I changed to randr

    $ redshift -l 55.7:12.6 -t 5700:3600 -g 0.8 -m randr -v
    Location: 55.700001, 12.600000
    Gamma: 0.800, 0.800, 0.800
    Gamma ramp size too small: 0
    Initialization of RANDR failed.

  • http://sprayfly.com Jonathan Lumb

    Thank you so much for this great piece of software… it feels so much better on the eyes! Excellent!

  • Videl

    I have exactly the same error output as Tito… Is there any way to fix it ? I’m using a NVidia Graphic Card with driver installed. I noticed that I can’t compile Redshift with VidMode too. (with libxxf86vm-dev)

    (I’m on Ubuntu 10.04, by the way.)

    Thanks for the program though, it looks cool.

  • Jon Lund Steffensen

    @Aaron Griffin: Buy me a mac and I’ll port it :)

    @lusitano78: If you can obtain the full path to the python 2.6 executable you can edit the first line to point to this executable instead of “/usr/bin/env python”.

    @Tito: Something is still missing for VidMode support. When you run the configure script does it still report missing dependencies for VidMode?

  • Tito

    You’re right. Here is the output of ./configure
    http://pastebin.com/fRV1rKfN
    Line 47 says vidmode is still missing but I have already installed libxxf86vm-dev.
    Do I need other libraries? Thanks :)

  • Jon Lund Steffensen

    @Tito, Videl: If you explicitly enable vidmode the configure script will stop if the dependencies are not met. Like this: “./configure --enable-vidmode“. Check that you have x11proto-xf86vidmode-dev installed. I suspect that it isn’t pulled in automatically.

  • Tito

    The script stops when I use ./configure -enable-vidmode.
    The package x11proto-xf86vidmode-dev is there, including libxxf86vm1, libxxf86vm1-dbg libxxf86vm-dev.
    I typed vidmode in synaptic and installed everything that came up but still it’s not enabled. :(

  • Jon Lund Steffensen

    @Tito: Try “pkg-config xxf86vm --cflags --libs“. Does that return an error message? Maybe libxext-dev is missing? (https://bugs.launchpad.net/ubuntu/+source/pkg-config/+bug/336634)

  • Tito

    That solved the problem!
    libxext-dev and x11proto-xext-dev were missing.
    Thank you very very much :)

  • ledom

    Thanks for this soft. I wait for PPA update.

    An idea, why to not mesure ambiant luminosity with a webcam for screen luminosity adjusting?

  • lusitano78

    About the ledom idea : the “luminosity” of a screen, in fact its luminance, is measured in candela per square meter (cd/m2, SI unit) or in footlambert (fL), while its color temperature is measured in Kelvin Degree (°K). The first one measures the amount of light, and the second one represents a kind of spectrum of the light.
    A web cam could perhaps measure something on the screen, but this measurement might have no clear relation with the luminance, because of the measurement area, the web cam spectrum and calibration, etc. In fact it is not a luminance measurement tool… But it could never measure a color temperature.
    The idea to adjust the color temperature comes (probably) from the idea that a low color temperature is less tiring for the eyes, AND that the screen color temperature should change in the same way the sun color temp does (and the ambiant light too). Without color temperature measurement, the adjustment can be done only by trials, with an empirical way. It is not perfect, but that’s it !
    Adjusting the color temperature is a good idea, which might be associated to the monitoring of the screen luminance. That could be a further improvement of redshift, but managing two parameters at the same time might be difficult for many users because of that empirical way (without measuring tools), so a good user manual should be delivered to help them.

  • Videl

    Thanks ! Everything is working fine now :) .

  • ledom

    Thanks. I want to speak about screen brightness adjustment based on amount of light in the room, mesured by a webcam. But the webcam must mesure on an uniform and non moving thing, like a wall.

  • Jon Lund Steffensen

    Redshift 1.3 will be released on 2010-05-12. It will allow adjusting individual CRTCs with RANDR (patch contributed by Alexandros Frantzis) and it will also include a few minor fixes (sorry, no GUI improvements yet). I will also try to get packages for Ubuntu Lucid out the same day. If you want to contribute a translation please log in to launchpad.net and go here: https://translations.launchpad.net/redshift/trunk . Translations entered before tuesday will be included in 1.3.

  • lusitano78

    Yes, in that case, a good trick is to use a white paper sheet (the same as
    for a printer) put on the wall. Its reflexion ratio (RR) of the ambiant light
    is close to 100 %. The monitor adjustment procedure could be as following :
    Measure the sheet luminance in cd/m2. Calculate the ambiant light in lux. Power off the monitor. Measure the monitor screen luminance base level. Power on the monitor and display a full screen window with a black background. Adjust the brightness so this black level luminance is just above the base level. Display a full screen window with a white background. Adjust the contrast to get this white level about 150-250 cd/m2 above the black level luminance. This white may be higher, but must be comfortable and never be dazzling (tiring the eyes). The brightness and contrast adjustments are often interdependent.
    The problem is the luminance meter, and I do not believe a webcam could really help. But without tool and white paper, using only the notion of “black level just above the base level” and “white level comfortable and never be dazzling”, this works correctly.
    I hope that could help in the case redshift would be improved by adding the luminance monitoring…

  • Matt

    I second the Lucid difficulties.

  • http://www.linuxgeek.ro Mahara

    @Tito

    For 64 bit Ubuntu you can try this .deb -> http://tinyurl.com/2b3vhoo

  • Jon Lund Steffensen

    Version 1.3 has been released. It allows adjusting individual CRTCs with RANDR (contribution by Alexandros Frantzis). It also includes support for the Windows platform (GDI API). Redshift can now be compiled with MinGW.
    Apparently, they changed the way Ubuntu packages are produced. I will probably have to spend hours getting acquainted with the new system. Don’t expect Ubuntu Lucid packages before Sunday.

  • Tito

    @Mahara
    Thanks for the .deb. Unfortunately, I had a bit of a problem about memory consumption in 64-bit lucid and decided to roll back to 32.

    @Jon
    I can’t wait to try it out :) .

  • Konstantin

    Thanks for the great app!

    There seems to be a minor packaging bug. After installing to a non-default prefix, e.g. /opt/redshift, it says

    No module named gtk_redshift.statusicon

  • Jon Lund Steffensen

    Ubuntu Lucid packages for redshift 1.3 are in the PPA. Enjoy.

    @Konstantin: If you install in a non-default prefix you need to make python look for modules in that prefix also (/opt/redshift/lib/python2.6/site-packages/).

  • http://genaud.net Alex

    Hey Jon,

    I’m up in Greenland and have trouble sleeping this time of year and hope Redshift can help. What is the purpose of entering latitude? I don’t want Redshift to emulate the day time – cuz it’s sunny ALL THE TIME. I’m using Redshift now at 21:00 and it’s pretty red, so it’s doing something.

    So, how does latitude effect the color temperature? Is it more or less red in high latitude evenings?

    Cheers,
    Alex

  • Peter

    I can’t tell if its a conflict between programs or my input that was the problem or if I just found a bug.

    I am using Ubuntu 9.10
    I enter the below command and redshift sets the color temp correctly, except it just starts blinking between bright and dim. This has a period of about 1 or 2 seconds.
    redshift -l 55.7:-120 -t 5700:3600 -g 0.8 -m randr -v

  • Jon Lund Steffensen

    @Alex: Hi Alex. The purpose of entering latitude is for redshift to be able to track sunset and sunrise for your location exactly. I understand how that may not help your circadian rhythm very much. Maybe you could just set a location further south that you would like to track? Btw, the reason why it’s reddening at 21:00 is that redshift starts to transition to nighttime when the sun is less than three degrees above the horizon, even if the sun doesn’t go below the horizon.

    @Peter: I can’t reproduce that bug in redshift 1.3. Are you using 1.2? Do you know if you have other programs running that are modifying the gamma ramps of your graphics device?

  • some guy

    I think the program just uses trigonometry to figure out when the sun rises and sets at your location. Given your situation, probably you want to use the latitude you grew up at rather than the one in the arctic where you live now.

    (I wondered if you were joking until I saw the pictures at your website.)

  • http://genaud.net Alex

    Hey Jon and ‘some guy’,

    Thanks for the tip. I’ve set one of my laptops (X200) to 40 degrees north because it doesn’t seem to shift as much as the other (nw8240).

    What’s the typical use case of Redshift? I assumed it was to tune down the lights at night to help people transition to sleep (circadian rhythm). Otherwise, until fast refresh eInk, I think most people will use a computer indoors with consistent lighting.

    As for circadian rhythm, light, and latitude, it’s not just ‘what one is used to growing up’. It’s well documented that people in northern Scandinavia and Russia have high rates of winter depression and the Inuit have high summer suicide rates. Granted these are extreme latitudes and other factors are involved, such as lack of vitamin D and the high tax on such luxuries as chocolate. :D

    Just wondering why not set an average latitude and use the system clock as default, rather than require the -l flag.

  • musturd

    I switched from xflux to redshift because of the greater control (in redshift).
    I just wanted to say that I love your program!

    Thank you for making my eyes feel better.

  • Jon Lund Steffensen

    @Alex: The primary function of redshift is to remove “that blue glow” which is caused by the screen having a different color temperature than the surroundings. Since we cannot easily measure the color temperature of the surroundings (not even with a webcam) we have to come up with some reasonable model of when the color should change. Most people will use the outside light during daytime and will turn on electrical lights around the time when the sun sets, that’s why redshift changes the temperature of the screen around sunset, and that’s why redshift has to track the position of the sun. In your case that model doesn’t really work that well because you don’t actually want to follow the rhythm of the sun at the location where you are.

  • http://www.kence.org Casey Peel

    Just FYI: Redshift works great on Fedora 12. To get the gtk-redshift program to work however, you need to move the python packages to the correct directory after the ‘make install’.

    (as root)
    mv /usr/local/lib/python2.6/site-packages/gtk-redshift /usr/lib/python2.6/site-packages

    Odds are good you can then:
    rmdir -p /usr/local/lib/python2.6

    Sadly I’m not a packaging guru or I’d offer to create a .spec for a Fedora RPM.

  • Jon Lund Steffensen

    @Casey Peel: Great to hear that it works in fedora. To avoid having to move the python module run ./configure --prefix=/usr then make and make install as usual.

  • Matthew Fleming

    I just tried installing the package for Ubuntu 10.04 but it is segfaulting.

    redshift -l 47.6178:-122.3568 -m RANDR -t 5700:3600 -v -s 0
    Location: 47.617802, -122.356796
    Gamma: 1.000, 1.000, 1.000
    Segmentation fault

    Looks like I don’t have symbols installed, so the stack traceback in gdb is useless.

  • Jon Lund Steffensen

    @Matthew Fleming: Hi Matthew. I can’t reporoduce the segfault you’re getting. Does it only happen when you run redshift with specific parameter values? Does it happen with the vidmode method?

  • some guy again

    @Alex: I could’ve suggested you use 0° latitude, but I anticipated you might prefer SOME seasonal change. I wouldn’t presume to guess an exact amount.

    I know when I first moved to Seattle from the Bay Area, I spent much energy the first winter hooking up high-temperature lights on timers in an attempt to cope with 16 hours of darkness every night, on top of endlessly damp freezing wind. But I got used to it, and after the first year it wasn’t such a big deal. It doesn’t last forever.

    I understand even farther north is its own special experience.