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.5 published on 2010-08-18. 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:

 $ killall -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

  -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

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 the GNOME clock applet if you have configured your location there. To enter you location: click the clock applet, then open locations, click edit and add your city.

In the future this feature may be extended with GeoClue support so Redshift will be able to get your current location from your IP address or from a GPS device (see bug #529600).

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.

212 Responses to Redshift

  1. Martin says:

    Hi; tried it on ubuntu 9.10 i386 desktop; compiled ok but doesn’t run because
    “Error: Gamma ramp size too small, 0
    Unable to set color temperature.”
    no matter what I set -g flag to. Maybe it doesn’t handle my video card (nvidia fx5200 with nvidia driver) well? Or is it for laptops only?

    Good idea though to provide something more customizable than xflux.

  2. Jon Lund Steffensen says:

    Thanks for the feedback, Martin. It’s probably the video driver. The program needs to be able to set the gamma ramps for the color temperature adjustment to work. There are two ways to set the gamma ramps, RANDR and VidMode. I’ve pushed out a new release of redshift that supports both extensions. There’s a good chance that the nvidia driver supports VidMode but not RANDR, since the RANDR extension is still quite new.

  3. soren121 says:

    Great work, Jon! I had the same error as you with xflux, and found your post about redshift on the Ubuntu Forums. Working perfectly here!

    Just one question: if I set GNOME to automatically launch Redshift (not in a terminal), will it continue to adjust the lumen value of the screen later, or must I keep it running in a terminal all day?

  4. Jon Lund Steffensen says:

    Hi soren121, I’m glad it works for you. Redshift doesn’t have to run in a terminal. You can just put it in Preferences > Startup Applications and it will run in the background and continuously adjust the colors.

  5. Martin says:

    Hi, I almost forgot to check on replies on my problem here, with the holidays and being away from my linux pc and all. The vidmode option works fine, thanks a lot! Keep up the good work.

  6. Martin says:

    Me again; how do I (temporarily) disable redshift? Killall redshift kills the process but doesn’t restore the colors. I’d like them normal when watching videos.

  7. Jon Lund Steffensen says:

    Hi Martin. Great to hear that it works with nVidia drivers now. I’m actally working on functionality that will restore the colors when the program is stopped. Some way to temporarily disable redshift is also on my todo list. I hope to have the next release out in a couple of days.

  8. Pete says:

    Hi, works like a charm! Many thanks, I’ve been struggling to get f:lux working and been hoping for a linux solution.

  9. John says:

    Nice work.

  10. Jon Lund Steffensen says:

    I’ve released 0.4 today. It will restore the colors when the program is terminated (after a short transition). Colors can always be restored with “xgamma -gamma 1″ if redshift, for some reason, fails to restore them properly. The next release will have a way to temporarily disable redshift. Enjoy.

  11. Jon Lund Steffensen says:

    Version 1.0 is out. Redshift can be temporarily disabled be sending the USR1 signal: “killall -USR1 redshift”. It is reenabled by sending the signal again. There are also prebuilt packages available for Ubuntu: http://launchpad.net/~jonls/+archive/redshift-ppa

  12. fer says:

    How about a package for Jaunty?

  13. Jon Lund Steffensen says:

    Hi fer. I tried to make a Jaunty package and failed. I just don’t seem to have the patience for the arcane tricks of the ubuntu (debian) packaging system. The karmic package should work though, so maybe you can download it manually and install it with “dpkg -i”? If somebody can provide a package for Jaunty I will be happy to upload it it to launchpad.

  14. Martin says:

    Hi, nice new release, working good. Thanks again. As a feature request maybe a tray icon from which to start/toggle/quit redshift is a good idea? I don’t know how to do that in C, but here is a little standalone python script that does it (in a gtk environment): http://pastebin.com/f2f12275a. Maybe someone is interested, so I thought I’d share it.

  15. Jon Lund Steffensen says:

    Hi Martin. Thanks for the script. I made a new release that includes a tray icon. Just run the program gtk-redshift instead of redshift.

  16. Ralgo says:

    Great aplication… hope you still working on this in the future. (better gui and configuration for mi gf :D )

  17. Ralgo says:

    Last thing… for the gentoo user, redshift had just enter to the Sunrise Overlay.

    # emerge -av layman
    # layman -a sunrise
    # emerge -av redshift

  18. Jon Lund Steffensen says:

    Released redshift 1.2 today with native language support: Danish and russian translations included. Thanks to Gregory Petrosyan for the russian translation.

  19. max stirner says:

    Thanks very much, this is hugely enjoyable.

  20. Aviator says:

    A better integration with Ubuntu would be that the program automatically figures out latitude and longitude from clock location settings. Thanks for saving me hours of sleepless nights BTW.

  21. nick says:

    Thanks so much for taking the time to create and support this program!

    I think it is a great idea!

  22. Anonymous says:

    I’m not sure if this is correct, but based on http://www.srrb.noaa.gov/highlights/sunrise/azel.html it seems that the redshift program inverts the sign of the LON parameter, ie. -l 49:22 is interpreted as 49:-22.

  23. foo says:

    Please add GeoClue support to redshift for automatically getting the location.

  24. Jon Lund Steffensen says:

    @Anonymous: From wikipedia: “For calculations, the West/East suffix is replaced by a negative sign in the western hemisphere. Confusingly, the convention of negative for East is also sometimes seen.”

  25. gwern says:

    Oh, I needed a -? That is a bug, I think… I was wondering why it was so red during the day.

    Anyway, I recently flipped my monitor on its side, which apparently disables randr. I found that redshift segfaults because it tries randr! (Manually telling it -m vidmode makes it work.)

    Even if redshift can’t be made to fallback to vidmode, I think it ought not to segfault but print a helpful error.

  26. Jon Lund Steffensen says:

    @foo: I will consider geoclue support for a future version.

    @gwern: Can you explain what you mean when you say you needed a -?. I’m not sure I understand. Redshift certainly shouldn’t segfault; I will look into that.

  27. mo says:

    Please add this as installation instructions:

    sudo add-apt-repository ppa:jonls/redshift-ppa
    sudo apt-get update && sudo apt-get install redshift

    or make this GUI-based such as in the adobe flash plugin’s “APT for Ubuntu 9.04+”.

  28. puccio says:

    Ehi, great tool, a GUI would definetely be appreciated and also I’d suggest to “share” some settings (I basically copied your color settings..) !

  29. Tom says:

    Just installed this, it’s a great application – my eyes thank you very much. While a more fully-featured GUI would be nice it functions very well as is, since I can just set the command to start when GNOME does.

  30. max says:

    this is hugely enjoyable.. i would be ever so pleased if it told me more about the colour temp etc, perhaps upon mouseover on the taskbar icon? ;)

    thanks for your attention

  31. Draak says:

    Ubuntu 9.10 user here :P
    After playing around with redshift I managed to build some scripts for it in Linux. As it does not have ANY Gui and the location thing is dependent on where you are you have to mess around with it to get it to work. Also it seems as though there is a bug where it inverts the gps locations but you simply switch the brightness level around and its the same thing.

    Alright install the Redlight as per instructions.
    Then right click create file and edit with gedit.

    Paste the following code in:
    #!/bin/bash
    gtk-redshift -l 43.39:79.23 -t 4600:5600 -g 0.8 -m vidmode -v

    -l stands for lat long, google your location. xx.xx:xx.xx = lat:long
    -t stands for brightness levels, i dint like the default 3600 but 4600 is good for my eyes. I had to invert it for it to work properly as for some reason Redlight thinks my location is during the day at night and vice versa. Mess around with it until you like the results.

    Anyway save it. Right click and edit file Properties, go to Permissions and check-box Allow executing file as program.

    Then simply dble click and your good!

    If you want to autostart it in ubuntu then go to System>Preference> Startup Applications and drag the script in. Should work.

    Happy night-surfing

  32. Jon Lund Steffensen says:

    @Draak: Your location should be 43.39:-79.23. (see this comment: http://jonls.dk/redshift/comment-page-1/#comment-35). That’s why you had to invert the color temperatures.

  33. t3ddy says:

    on kde I can’t see the icon in systray, there a “?”

  34. Jon Lund Steffensen says:

    @gwern: Bug: https://bugs.launchpad.net/redshift/+bug/528330

    @t3ddy: Bug: https://bugs.launchpad.net/redshift/+bug/539952

    @puccio, Tom: I plan on improving the user interface in the future. What specific user interface features would you consider most important?

  35. max says:

    lovely stuff! using this 24/7 now, squinting at screen without!

    suggestions for interface:
    information re: current colour setting / perhaps even curve as with the original winapp upon mouseover
    ideally derive location from freedesktop location settings

    thanks for your work on this.

  36. t3ddy says:

    today I see the icon, that’s weird, it never shown up before :S

  37. Jared says:

    Help me please, I’m a gentoo noobie and can’t seem to use the sunrise overlay to install redshift. I’m running x86_64 – could this be why?

    (Pastebin in case it gets muddled http://pastebin.com/efXrs5rD)

    jared-ws ~ # layman -f -a sunrise
    * Failed to add overlay “sunrise”.
    * Error was: Overlay “sunrise” already in the local list!
    jared-ws ~ # layman -S
    * Running command “/usr/bin/svn up “/var/lib/layman/sunrise@”"…
    At revision 10350.
    *
    * Success:
    * ——
    *
    * Successfully synchronized overlay “sunrise”.
    jared-ws ~ # emerge -av redshift

    These are the packages that would be merged, in order:

    Calculating dependencies… done!

    emerge: there are no ebuilds to satisfy “redshift”.

    jared-ws ~ # locate redshift
    /var/lib/layman/sunrise/x11-misc/redshift
    /var/lib/layman/sunrise/x11-misc/redshift/metadata.xml
    /var/lib/layman/sunrise/x11-misc/redshift/Manifest
    /var/lib/layman/sunrise/x11-misc/redshift/.svn
    /var/lib/layman/sunrise/x11-misc/redshift/.svn/props
    /var/lib/layman/sunrise/x11-misc/redshift/.svn/entries
    /var/lib/layman/sunrise/x11-misc/redshift/.svn/tmp
    /var/lib/layman/sunrise/x11-misc/redshift/.svn/tmp/props
    /var/lib/layman/sunrise/x11-misc/redshift/.svn/tmp/text-base
    /var/lib/layman/sunrise/x11-misc/redshift/.svn/tmp/prop-base
    /var/lib/layman/sunrise/x11-misc/redshift/.svn/text-base
    /var/lib/layman/sunrise/x11-misc/redshift/.svn/text-base/metadata.xml.svn-base
    /var/lib/layman/sunrise/x11-misc/redshift/.svn/text-base/ChangeLog.svn-base
    /var/lib/layman/sunrise/x11-misc/redshift/.svn/text-base/Manifest.svn-base
    /var/lib/layman/sunrise/x11-misc/redshift/.svn/prop-base
    /var/lib/layman/sunrise/x11-misc/redshift/ChangeLog

  38. Jon Lund Steffensen says:

    @Jared: Ask at the gentoo forums, maybe? I don’t know enough about layman to help you out…

  39. Ralgo says:

    @Jared: Did you add these lines to the make.conf?

    source /usr/local/portage/layman/make.conf
    PORTDIR_OVERLAY=”${PORTDIR_OVERLAY} /usr/local/portage/”

  40. Ralgo says:

    @Jon Lund Steffensen: Have you considered to put a forum? =)

  41. Joe says:

    I seem to have an issue: on Arch Linux, I run ./config, make, and make install. Make install says I lack permissions, so I use sudo make install and it installs, but the redshift command is not recognized. Any ideas?

    Thanks for making such a useful program (= hope I can get to enjoy it!

  42. Jon Lund Steffensen says:

    @Joe: It should install as /usr/local/bin/redshift by default. Maybe /usr/local/bin is not in your PATH?? You can also run redshift directly from the build directory without installing.

  43. Muhs says:

    Thank you so much! It works perfectly!

  44. Nigel says:

    Wow!! What an awesome tool! I got it set perfectly with gtk-redshift -l 43.39:-79.23 -t 6200:5600 -g 0.9 -m randr -v

    However, it is an overcast day and the temperature is being set at 6200k. How can I make sure my LAT:LON are lining up with whatever weather service redshift is using to fine-tune i.e. weather?

  45. Jon Lund Steffensen says:

    Redshift does not adjust the color temperature according to weather reports. There’s a script (not mine, I haven’t tested it) that changes the color temperature based on cloud coverage: http://www.reddit.com/r/linux/comments/anwlg/redshift_opensource_xfluxflux_replacement/c0il56p

  46. Nigel says:

    @Jon

    Perfect! Thank you!

  47. Josh Patton says:

    How about a Mac port?

  48. Jon Lund Steffensen says:

    @Josh: There’s f.lux for mac.

  49. Ozan says:

    Nice software and great job!
    I guess you could develop it further for better gui support (many people will find it a lot easier to enter the coordinates through the gui. you can even modify it so that people just need to enter the name of the city and the land, and the application finds the coordinate itself. that’s what many wheater applications do) but it works perfect on my ubuntu 9.10.
    Oh, and it would be very nice if the application could remember the coordinates so that the user does not have to type it everytime.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>