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. Anubeon says:

    Greetings,

    I’ve just this minute installed redshift and run it using the following command:

    $ redshift -l 51.8:0.19

    Unfortunately redshift does not appear to transition smoothly at all. Instead each refresh of the screen results in a momentary redshift (in the literal sense of the word) following be adjustment (I assume) to the prescribed colour temperature for my location. Any idea what is causing this and how I might rectify the error?

    P.S. Any chance of porting gtk-redshift to the new indicator-applet implementation in lucid?

  2. Alex says:

    Have you considered using geoclue instead of having the user input the location manually? That would be a swell feature!

  3. Lucho says:

    Seems like a very cool app, but I just installed redshift and tried to set my lat:lon without luck, here’s what I get:

    ~$ redshift -l -34.6113:-58.4859
    Segmentation fault

    Thanks!

  4. Dennis says:

    Whats wrong?

    $ redshift –l 51.9:5.9
    Latitude and longitude must be set.
    Try `-h’ for more information.

  5. Jon Lund Steffensen says:

    @Alex: Yes, it has been suggested before and I’m certainly open to the idea. Sadly, Geoclue is broken, at least in Ubuntu, so I haven’t been able to use it.

    @Matthew Fleming, Lucho: It’s probably the same bug. I can’t determine what is causing this from your reports. If one of you could compile redshift with debug information and provide a stack trace that would help immensely.

    @Anubeon: I haven’t heard of that kind of behavior from redshift. Does it happen with the initial transition (the one that can be disabled with -r) or is it the transition from daytime to night that is causing problems? Can you provide some output from running redshift with -v?

  6. Jon Lund Steffensen says:

    @Dennis: Looks odd. Is your system set up to use a language other than English? If that is the case, the problem may be that the numbers must be entered in the local number format e.g. 51,9:5,9 with a comma as the decimal separator.

  7. Bradford Mitchell says:

    How is this not a direct copy of the F.lux script for linux?

    http://www.stereopsis.com/flux/

    They already have Win and Mac ports, too.

  8. Jon Lund Steffensen says:

    @Dennis: I just noticed that it is not a dash in front of the “l” in your comment above (it is a different character that is slightly longer than a regular dash). Please check that you are using a regular dash when you run redshift.

  9. Anubeon says:

    @Jon: Thank you for responding Jon. I can confirm that running redshift with the -r parameter still produces this behaviour. There is one difference in that without the -r parameter specified, a rapid flickering can be observed initially followed by a regular pulsing of the display. Conversely, with the -r parameter that initial flickering is NOT observed (although the regular pulsing is).

    The terminal output resulting from the command ‘redshift -l 51.8:0.19 -v’ is as follows:

    ch2lah@SBCS625LHLT:~$ redshift -l 51.8:0.19 -v
    Location: 51.799999, 0.190000
    Gamma: 1.000, 1.000, 1.000
    Gamma ramp size too small: 0
    Initialization of RANDR failed.
    Trying other method…
    Period: Daytime
    Color temperature: 6500K
    Period: Daytime
    Color temperature: 6489K
    Period: Daytime
    Color temperature: 6479K
    Period: Daytime
    Color temperature: 6469K
    Period: Daytime
    Color temperature: 6459K
    Period: Daytime
    Color temperature: 6449K
    Period: Daytime
    Color temperature: 6439K
    Period: Daytime
    Color temperature: 6429K
    Period: Daytime
    Color temperature: 6419K
    Period: Daytime
    Color temperature: 6409K

    Period: Daytime
    Color temperature: 5508K
    Period: Daytime
    Color temperature: 5500K
    Period: Daytime
    Color temperature: 5500K
    Period: Daytime
    Color temperature: 5500K
    Period: Daytime
    Color temperature: 5500K

  10. Dzmitry says:

    Would it be possible to make it detect location automatically from what I’ve set as a home location in Ubuntu?

  11. ibart says:

    i think it is a little bit too much red at night … we need an empiric idea to set color based on screen :\

  12. Jon Lund Steffensen says:

    @Bradford Mitchell: xflux is broken and is lacking features that f.lux for windows has.

    @Dzimitry: That would be a pretty clever solution. I’ll investigate that.

    @ibart: You can use -o to test temperature settings quickly, if that’s what you mean.

  13. Hey there, i made some Monochrome Lucid Icons for your App and applied a small patch to the statusicon.py so the Icon toggles visually.

    You can find them here:

    http://dl.dropbox.com/u/1890515/RedshiftMonochrome/RedshiftMonochrome.tar.gz

  14. Brett Alton says:

    Can you explain the theory behind this? I really enjoy using your program…

  15. Boky says:

    Why not use data from Gnome to get Latitude and Longitude?

    I.e.

    gconftool-2 -g /apps/panel/applets/clock_screen0/prefs/cities

  16. Will says:

    F.lux will also do this, I’m not sure how the Linux version looks, but it’s also worth a try: http://www.stereopsis.com/flux/

  17. Russ says:

    Redshift is great – Thanks!

    Is there any way to query the current color temperature, or somehow feed it to an external program? I have heyu (and X10 control program) controlling the light in my room and I would love to be able to dim the lamp proportionately and corresponding to the action of redshift.

    Thanks again.

  18. Thomas says:

    I get this error when trying to configure redshift:
    checking for windows.h… no
    checking for a Python interpreter with version >= 2.6… python
    checking for python… /usr/bin/python
    checking for python version… 2.6
    checking for python platform… linux2
    checking for python script directory… ${prefix}/lib/python2.6/dist-packages
    checking for python extension module directory… ${exec_prefix}/lib/python2.6/dist-packages
    checking whether to enable RANDR method… missing dependencies
    checking whether to enable VidMode method… missing dependencies
    checking whether to enable WinGDI method… missing dependencies
    configure: error: either RANDR, VidMode or WinGDI must be enabled

    How do I enable one of these?

  19. Alex says:

    It’s great, but i’m having a pretty big bug: It occasionally brings my system to a grinding halt! It’s pretty strange. I’m using gtk-redshift, and everything just freezes (mouse, desktop, everything). The screen updates every few seconds while this is happening and if i disable it (by clicking the icon) my system goes back to running smoothly.

    Pretty strange – anyone else having this issue?

    I’m happy to do try stuff out to help resolve it if you are interested.

    Alex

  20. Jon Lund Steffensen says:

    @Anubeon: I have opened a bug report for your problem: https://bugs.launchpad.net/redshift/+bug/584572. Could you post what kind of graphics device you’re using, either here or in the bug report?

    @Joern Konopka: Looks awesome. Can I bundle those with next redshift release?

    @Brett Alton: This may be of interest to you: http://jonls.dk/redshift/comment-page-2/#comment-282

    @Boky: I’m working on that. I expect to able to include it in the next release (in a couple of weeks I hope).

    @Russ: No, not directly. If you run redshift with -v it will print the color temperature. I suppose you could write some kind of script to parse the output and feed it to your light control system. I’d like to include DBus support in redshift at some point in the future to allow easier querying and control of the program.

    @Thomas: You need dependencies for either RANDR of VidMode. In Ubuntu the packages are libxcb1-dev and libxcb-randr0-dev for RANDR; and libx11-dev, x11proto-xf86vidmode-dev, libxxf86vm-dev and libxext-dev for VidMode.

    @Alex: Does it happen when you run redshift (instead of gtk-redshift)? What gamma method are you using (RANDR or VidMode)?

  21. Slon says:

    Thanks, for this great piece of software. I’m using arch linux and have a problem at night that is very annoying. My mouse cursor is very bright, it’s color does not change. Please help me with that :)

  22. Hello, I have the same issue as Sion; my mouse cursor remains the ‘standard’ colour temperature (using Ubuntu Lucid).

    This is only a minor issue. If it could be fixed then great but if not, no problem.

    Otherwise, thank you for creating Redshift.

  23. Jon Lund Steffensen says:

    @Slon, Richard Corbin: Hi. Redshift can’t affect the color of the mouse cursor when “hardware cursor” is enabled (this is usually the default). Hardware cursors can be disabled on some graphics devices, but you’ll probably have to mess with xorg.conf.

  24. Alex says:

    @Jon Lund Steffensen:
    Problem occurs with both redshift and gtk-redshift. RANDR doesn’t work:
    “Gamma ramp size too small: 0
    Initialization of RANDR failed.”
    So i guess VidMode

  25. joe says:

    Hi
    I can not set my longitude or latitude :
    redshift -l 53.4

    i get ‘Malformed location argument’

    Any thoughts

    thanks !!

  26. Is there a forum or something for redshift? Having this all on one post seems a bit untidy. I’d be happy to set one up at my website (opensourceplayground.org) it’s not the quickest site in the world but “unlimited” bandwidth and storage so no biggie for me.

    Anyway, that’s not why I came here…

    first off, this program is AMAZING. I’m a bit bummed there’s not a Fedora package but compiling was super-easy.

    secondly, when I upgraded to Fedora 13 redshift quit working except on one monitor. I’m sure it’s a newer version of X, but aside from that I have no idea what could be going on. Thanks for the help!

  27. ethan says:

    hello!

    thank you much for this project! finally, we can save some of our eyesight! are you planning in integrating with system location in gnome, so location does not have to be set manually?

    it would be a huge help for people who travel across timezones a lot, if all they have to do is set their new location via the graphical interface, and RedShift catches that change on its next startup or something.

    Cheers!

    ethan

  28. alexd says:

    not working after suspend here (redshift 1.3 on ubuntu 10.04)

  29. Pingback: Redshift, para (casi) todos los ojos cansados en Linux | Seamos realistas…

  30. Jon Lund Steffensen says:

    @Alex: Ok. Can you be more specific about what is causing your system to freeze; I mean, is it some process that is eating up all the cpu time? And if so, what process?

    @joe: You need to supply both latitude and longitude separated by a colon. See redshift -h for help.

    @Doug Whitfield and Fedora users: Any Fedora users out there able to provide a package?

    I agree that this comment thread it is a bit of a mess but I really like that anyone can post here without being registered in a forum. If you don’t mind signing up somewhere I suggest you go to https://launchpad.net/redshift and post bug reports there. Questions, that are not necessarily bug reports, can be also posted in the “Answers” section.

    @ethan: There’s a location provider for the GNOME clock applet in my repository. It will be in the next release.

    @alexd: Not working at all, or is it working when you restart redshift?

  31. ethan says:

    thank you!

    so you are planning to add a “slick gui” to redshift like f.lux has for windows?

  32. jeffb says:

    I like the gtk-redshift icon. Could you make its appearance change to indicate whether redshift is on or off? Also, could you show the current colour temperature in the mouseover text?

  33. Jon Lund Steffensen says:

    Anyone up for a small python project? Implement support for the new application-indicator system in gtk-redshift. Then, integrate the patch (and icons) by Joern Konopka posted in a comment above, which allows the redshift status icon to change when the applet is toggled. Here’s the documentation for indicators (including python sample code): https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators

    Redshift 1.4 will be out on the 12th or 13th, and will include this improvement if somebody decides to complete it.

  34. norbs says:

    I’ve made a mono-tray icon for Redshift to be used with Radiance theme.
    You can find it here: http://gnome-look.org/content/show.php?content=125662

    Please email me if you like this work or if I can help you.
    I can’t do coding just some artwork.

    Oh, and I like Redshift! :D

  35. Great program! Really! Thanks very much!

  36. Jon Lund Steffensen says:

    @ethan, jeffb: The gui is being improved gradually. Eventually, it should be possible to control redshift without using the command line.

    Michael Speth is working on the application indicator project mentioned above (for better integration of gtk-redshift in Ubuntu). Hopefully, it’ll be ready for redshift 1.4 which is to be released on 2010-06-13.

  37. Oceanic says:

    at first i was reluctant to try this but it is beyond amazing, thank you.

  38. Ocelot says:

    Is possible a Mac (x86-64) version please?

  39. jony121 says:

    Nice work with this! I was utterly sick with how dead F.Lux is and how unusable it has been left on linux.

    Will there be an option to adjust transition speed?
    By which I mean F.Lux had an option for the transition from day to night. It was only a simple fast(20s) or slow(60m) but it came in handy.

  40. Jon Lund Steffensen says:

    @Ocelot: Unfortunately, nobody has volunteered to port it to OS X.

    @jony121: Redshift handles transitions a bit different compared to f.lux. The transition starts when the sun is at a certain angle above the horizon and ends at a certain angle below the horizon. It will be possible to set the angles in a future version of redshift, but you will probably not be able to set a specific time period like in f.lux.

  41. dan says:

    It seems to be confused about the time on my system (ubuntu lucid 64 bit):

    $ date
    Mon Jun 7 20:46:13 EDT 2010
    $ redshift -v -o -l 40.71667:74.01667
    Location: 40.716671, 74.016670
    Gamma: 1.000, 1.000, 1.000
    Gamma ramp size too small: 0
    Initialization of RANDR failed.
    Trying other method…
    Solar elevation: 11.677602
    Period: Daytime
    Color temperature: 5500K

    I am in NYC and it’s definitely not daytime.. This is w/version 1.3 installed from the ppa.

  42. _khAttAm_ says:

    Automatic Longitude/Latitude is essential feature… Plus, it should be more GUI based than command line..

    An app that when launched goes to Gnome Tray and we can access options from the right click menu, pretty much as we do now with gtk-redshift… but it should have option to set longitude latitude or determine automatically from location (default)…

    I’m sorry to ask but I don’t get the idea completely.. It has helped me in the past few days and screen looks a lot easy to stare at for long intervals of time.. But I don’t get the actual idea.. I have read this http://www.stereopsis.com/flux/, but didn’t quite get it.. please address these questions:
    Is the time really important or is the surrounding lighting?
    If it is the lighting, what about getting weather information online and changing it accordingly (optional) or even better just use the camera (if available) and actually determine the lighting(optional)?

  43. Jon Lund Steffensen says:

    @dan: Try 40.716671, -74.016670 as your location. Here’s the relevant quote 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.”

    @_khAttAm_: Hi. I will release redshift 1.4 on the 13th which will have an automatic location provider for GNOME. At the same time I will update this website, and I will try to address the questions that you have about lighting, weather and webcams. I should be noted that these questions have come up before so you can probably find some answers if you have the patience to browse through the comments. I will also provide a roadmap for redshift to let you know in what direction the development is going.

  44. punkmexic says:

    how can i neable the icon in the task bar *system tray in arch linux?? so i can toogle turning it on or off.

  45. jony121 says:

    @_khAttAm_: It’s to do with your body’s “internal clock.” As the day grows later your body expects less light (or at least less of the spectrum.) Thus being exposed to much of the light spectrum at night can screw with your body’s internal clock affecting your sleep because the light makes your body adjust as if it is daytime. Our eyes are directly affected by this in that as the day grows later our eyes expect less of the light spectrum so they relax. As night approaches our body wants to sleep and seeing light which has much of the spectrum make our eyes strain and thus sore.

    In case this makes no sense to you research “redshift.”

    This is accurate to my knowledge unless someone would care to correct me. Hope this helps.

  46. Marcel says:

    After using redshift for a few weeks now instead of F.lux, I am a very happy user :-) . Works a lot better and smoother on day/night transitions then F.lux. Thanks for your initiative and keep up the good work!

  47. lordmax says:

    It’s better than f.lux.
    Great job.

    What we need now (we stay for stupid user ^__^) it’s a GUI

    Please.
    ^__^

  48. John B says:

    I absolutely love it at night, but for some reason it doesn’t shift color throughout the day for me- when I log on to my computer in the morning the color temp is the same shade of red (or very, very close as near as I can tell) as it is at night. I usually just toggle it off completely rather than trying to mess with different temperature values. Anyone got any ideas on what I might be able to try to get it to shift colors the way it’s supposed to? I’ve tried both randr and vidmode with the same results. I’m using Ubuntu Karmic.

  49. Christian Vincenot says:

    Hi everybody,

    I have the same issue as John B. I feel that redshift makes the screen too warm during the day. Here is an example:

    root@Shahine:/home/kashim/Desktop# date
    Sat Jun 12 10:26:39 JST 2010
    root@Shahine:/home/kashim/Desktop# redshift -l 34.58.21:135.48.49 -m vidmode -v -o
    Location: 34.580002, 135.479996
    Gamma: 1.000, 1.000, 1.000
    Solar elevation: 67.079240
    Period: Daytime
    Color temperature: 5500K

    Is this normal?

    Anyway, thanks a lot for the soft, it’s definitely a nice replacement for f.lux.

    Best regards,
    Chris

  50. bradley says:

    when my ubuntu 10.04 laptop with an AMD chip and nvidia graphics chipset wakes up from sleep mode, the entire OS is dragging. it barely catches keyboard IO and mouse IO. that is until i restart redshift, then it’s all good.

    so something with ubuntu’s sleep thing whacks up redshift which in turn whacks up everything.

    thanks!

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>