Anish Athalye

Lumen: Magic Auto Brightness Based on Screen Contents

I do most of my software development in my terminal, with my trusty tmux / zsh / vim setup. When coding, I frequently switch back and forth between my terminal, which has a dark background, and my web browser, where sites usually have light backgrounds.

One big problem with this setup is that my laptop’s backlight is either so dim that I can’t read the text in my terminal or so bright that I’m blinded by looking at websites. The problem is especially bad at night.

Many laptops support automatic brightness control, but it’s usually not very useful. Both macOS and Windows support setting screen brightness automatically based on ambient brightness, but the feature rarely comes in handy. It seems to cause more harm than good. I keep it disabled on my laptops.

A Better Way

What if laptops set screen brightness automatically, but based on screen contents rather than ambient brightness? I did some research, but I couldn’t find any software that does this, so I wrote my own tool.

This is how Lumen was born. Lumen is a tiny menu bar app for macOS that magically sets screen brightness based on screen contents.

Here’s what it looks like in action:

Lumen demo

Configuration

In an early prototype, I had hard-coded relationships between the lightness of screen contents and the backlight settings that I desired. This turned out to be somewhat annoying, because my preferences changed slightly depending on the environment that I was in and exactly what I was doing. I needed to make the settings customizable.

It’s annoying to have lots of explicit on-screen controls for something that should be simple, so I implemented something that I think is a pretty neat feature. As it’s running, Lumen monitors how you change your backlight settings using the keyboard. If you override anything that Lumen does, it takes note, automatically learning your preferences. The implementation is not too complicated, but I think it’s a neat UI paradigm.

Source Code and Downloads

Lumen is open source, released under GPLv3. There are binaries available for download too.