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.

  • ea

    When I use redshift in combination with xcalib –invert -alter, the effect of the color inversion breaks after a few secs. xcalib is a little tool to load calibrate the monitor.

    I would like to see a switch in redshift that tells it to invert all colors.
    Sometimes when I read PDF, I wish the background of those documents were black and the foreground color white. This could be easily achieved by the color inversion.

    An toggle switch in the gtk applet would be the killer feature for me.

  • ea

    where would I have to put this code in redshift to implement the color inversion?

    for (i = 0; i = ramp_size / 2)
    break;
    tmpRampVal = r_ramp[i];
    r_ramp[i] = r_ramp[ramp_size - i - 1];
    r_ramp[ramp_size - i - 1] = tmpRampVal;
    tmpRampVal = g_ramp[i];
    g_ramp[i] = g_ramp[ramp_size - i - 1];
    g_ramp[ramp_size - i - 1] = tmpRampVal;
    tmpRampVal = b_ramp[i];
    b_ramp[i] = b_ramp[ramp_size - i - 1];
    b_ramp[ramp_size - i - 1] = tmpRampVal;
    }

  • Balls C McGonads

    1. Why do you not build the latest version of Redshift for older Ubuntu versions? I am using Ubuntu 1004 and the latest version available in the PPA is 1.5.
    2. Is there a way to have configurable points on the color-temperature scale (as opposed to only day/night)? I often find that at night if I am doing something to stay awake, I wish to be able to raise the color temperature just a little bit. I end up toggling redshift but then the screen becomes too blue…

  • DSpider

    Is there a setting to have it shift GRADUALLY over the course of, say, 30 minutes instead of 15 seconds?

  • http://www.facebook.com/kim.douglas.mason Kim Mason

    Nice. I run a second monitor though, and it only adjusts the primary monitor. I’m running Fedora 15. Any hints?

  • http://www.facebook.com/kim.douglas.mason Kim Mason

    Answered my own question: I left ‘adjustment-method=vidmode’ out of the config, and it works perfectly.

    Great stuff!

  • Pingback: -=SUbWAY=- » Blog Archive » How lack of sleep turned my vision red (or: combating insomnia with science)

  • Pingback: Talk 145: vim vim win | RadioTux GNU/Linux

  • Pingback: Redshift, f.lux i temperatura światła | KHRoN'z blog

  • Francois

    Thanks for your work, it’s a very nice and usefull application !

  • anonymisa

    right after starting redshift my eyes relaxed thank you u

  • http://www.nonzen.in sajith

    Thank you for this!

  • http://profiles.google.com/mdshw5 Matt Shirley

    I’m trying to continue using Redshift after installing Gnome 3, but the gtk-redshift application does not seem to launch. I can invoke redshift from bash and have an effect, but it would be nice to have a gui. Is this related to GTK3 compatibility?

  • http://jonls.dk/ Jon Lund Steffensen

    Yes, the Gnome clock applet has disappeared in 3, so you need to either use geoclue or set your location manually on the command line (also works with gtk-redshift btw)  or set your location in a config file (example: http://jonls.dk/2010/10/redshift-1-6-released/).

  • Dimon Limon

    Hi Jon!

    I’ve a quite similar problem as Matt Shirley has:

    Since Ubuntu 11.10 (with Gnome Shell) gtk-redshift won’t launch a startup. When I manually enter e.g. “gtk-redshift -l geoclue -m vidmode -t 6500:4500″ in terminal, redshift starts and works like it should do, but when the same command is entered in the Gnome Startup Manager, Redshift won’t start at all…

    See this two pictures for clarification:

    http://i.imgur.com/XlyO4.png

    http://i.imgur.com/ciWmE.png

  • http://jonls.dk/ Jon Lund Steffensen

    Hi, if geolue tries to get your location from your ip address, and you’re not connected to internet when the startup manager starts redshift, it will fail. It’s a known “bug”.

  • http://jonls.dk/ Jon Lund Steffensen

    This may be added in the future (no promises though). You can follow the progress here: https://bugs.launchpad.net/redshift/+bug/900937

  • http://jonls.dk/ Jon Lund Steffensen

    Probably colorramp_fill() in colorramp.c.

  • http://jonls.dk/ Jon Lund Steffensen

    Yes, randr should be preferred especially in multi-monitor situations.

  • http://jonls.dk/ Jon Lund Steffensen

    It doesn’t already??

  • http://jonls.dk/ Jon Lund Steffensen

    Yes, it should transition automatically. Are you sure your location is correct?

  • Dimon Limon

    Hi Jon!

    Works like a charm with f.i. “gtk-redshift -l 48.20:16.37 -m vidmode -t 6500:4500″

  • Pingback: How to Reduce Computer Eye Strain

  • Classy

    Why don’t you just compile from source? https://launchpad.net/redshift/+download

  • Anonymous

    Awesome little program!

    However, I would really like an option to adjust the redshift based on time of day instead of latitude+longitude, e.g. make redshift kick in every day at 22.00 and deactivate automatically at 07.00. (I’m sorry if it’s been brought up already, but there doesn’t appear to be a way to search through comments)

    What do you think, jonls?

  • http://jonls.dk/ Jon Lund Steffensen

    We’re having a discussion on this feature request here: https://bugs.launchpad.net/redshift/+bug/676718

  • Pingback: F.lux Suits your Eyes to Daylight Changes on the Screen - Hack How | Hack How

  • Pingback: Logiciels à avoir by gasp - Pearltrees

  • Pingback: [patch request] - f.lux / nighttime color temperature display - webOS Nation Forums

  • Pingback: Sleep management: Controlling Blue Light Exposure | Post-Neolithic (n̄)