A light theme during the day, a dark theme at night, and you never have to think about it again.
Lightshift switches your VS Code theme automatically, either at sunrise/sunset for wherever you are, or at times you pick yourself. That's the whole pitch.
- By default, Lightshift switches at sunrise and sunset. It figures out roughly where you are with a quick IP lookup (more on that below), so you don't have to hunt down your own coordinates. If that lookup fails for whatever reason, it just falls back to a plain 7 AM / 7 PM schedule until you set a location yourself.
- The first time it runs, it doesn't touch your current theme. Whatever you're already using gets adopted as your light or dark default (whichever bucket it belongs in), and the other slot gets filled in with a normal built-in VS Code theme. You won't open your editor to some theme you've never seen before.
- It only flips the theme when the time period actually changes, so if you manually switch themes mid-afternoon, Lightshift won't fight you over it. It'll just pick back up at the next sunrise or sunset.
Click Lightshift in the status bar (bottom right) to pop open the menu, or use any of these from the Command Palette:
| Command | What it does |
|---|---|
Lightshift: Open Menu |
Everything, in one place |
Lightshift: Toggle Automatic Switching |
Turns Lightshift on/off without touching your settings |
Lightshift: Set Light Theme |
Pick the theme for daytime |
Lightshift: Set Dark Theme |
Pick the theme for nighttime |
Lightshift: Set Schedule Mode |
Sunrise/Sunset or Fixed Times |
Lightshift: Set Location (Latitude/Longitude) |
Detect it automatically, or type it in yourself |
Lightshift: Apply Theme For Current Time Now |
Force a check right this second |
| Setting | Default | What it does |
|---|---|---|
lightshift.enabled |
true |
The master on/off switch |
lightshift.lightTheme |
(your current theme, if it's light) | Theme used during the day |
lightshift.darkTheme |
(your current theme, if it's dark) | Theme used at night |
lightshift.scheduleMode |
sunsetSunrise |
sunsetSunrise or fixedTime |
lightshift.lightTime |
07:00 |
Fixed switch-to-light time (24h HH:mm), also used as a fallback when there's no location set |
lightshift.darkTime |
19:00 |
Fixed switch-to-dark time (24h HH:mm), also used as a fallback when there's no location set |
lightshift.latitude |
null |
Your latitude, in decimal degrees |
lightshift.longitude |
null |
Your longitude, in decimal degrees |
All of these are also just regular entries in settings.json, if you'd rather edit them by hand.
VS Code extensions can't ask the operating system for your location, so there are only two ways to get your coordinates: you type them in, or we ask a third party to guess based on your IP address. Lightshift uses ipwho.is for that guess.
That lookup only happens once, and only if you're using sunrise/sunset mode and haven't already set a location. Once it's set (automatically or by hand), or if you switch to Fixed Times mode, Lightshift doesn't make any more network requests. That's the only network call in the whole extension.
npm install
npm run watchThen hit F5 in VS Code to launch an Extension Development Host and try it out.
npm run lint # lint
npm run compile # type-check + buildPull requests welcome. It's a small extension on purpose, so let's try to keep it that way.