Skip to content
Changes your VS Code theme based on your sunset and sunrise
TypeScript JavaScript
Branch: master
Clone or download
muuvmuuv feat: added new commands
possible to disable extension now
possible to "disable" extension until next circle
refactored logic

fixes: #44
Latest commit 8876fc8 Feb 19, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Updated issue templates Dec 2, 2019
.vscode feat: update vscode settings Feb 10, 2020
assets feat: changed af to sketch Feb 10, 2020
src feat: added new commands Feb 19, 2020
testProject feat: update core Feb 10, 2020
.editorconfig feat: update core Feb 10, 2020
.env.tmpl feat: add release-it command and env Feb 11, 2020
.eslintrc.json feat: update core Feb 10, 2020
.gitignore feat: update core Feb 10, 2020
.prettierignore feat: update core Feb 10, 2020
.prettierrc.json feat: added new commands Feb 19, 2020
.release-it.json Release 2.1.0 Feb 11, 2020
.vscodeignore feat: update core Feb 10, 2020
CHANGELOG.md docs: update changelog Feb 11, 2020
LICENSE Create LICENSE Oct 2, 2018
README.md feat: added new commands Feb 19, 2020
commitlint.config.js feat: add lefthook and release-it Feb 11, 2020
lefthook.yml feat: add lefthook and release-it Feb 11, 2020
package-lock.json feat: added new commands Feb 19, 2020
package.json feat: added new commands Feb 19, 2020
tsconfig.json feat: update core Feb 10, 2020
webpack.config.js feat: update core Feb 10, 2020

README.md

☀️ Sundial ☀️

Change your VS Code theme/settings based on your sunset, sunrise, system appearance or other preferences!

Visual Studio Marketplace Visual Studio Marketplace Visual Studio Marketplace Maintainability Total alerts Language grade: JavaScript

Sundial changes your theme and VS Code settings (if needed) based on your day and night cycle or other options, you choose. It is inspired by the OSX Mojave dynamic backgrounds and Night Owl for Mac. It should reduce eye pain when working in the night or on the day. Humans should not strain their eyes too much, it's not recommended to have a light theme in the night and vice versa.

Whenever you have ideas for this project, things you would like to add or you found a bug, feel free to create an issue or start contributing! 😇

Buy me a Gluten-free Bread

VSCode Sundial

Installation

You can simply install any VS Code extension via the VS Code Marketplace. Just click the banner below:

Install VS Code extension Sundial

⚠️ IMPORTANT: Since VS Code 1.42.0 automatically changing the theme based on OS appearance is build in, if you want to use this plugin anyway you must disable this options with "window.autoDetectColorScheme": false

Keybindings

Sundial contributes the following keybindings:

Platform Keybinding Description
Windows ctrl+alt+t Toggles between your day/night theme.
Mac ctrl+cmd+t Toggles between your day/night theme.

Note: Whenever you use one of these keybindings, Sundial will be disabled.

Commands

Sundial contributes the following commands:

Command Description
Sundial: Switch to night theme 🌑 Switches to your night theme.
Sundial: Switch to day theme 🌕 Switches to your day theme.
Sundial: Toggle Day/Night Theme Toggles between your day/night theme.
Sundial: Enable extension Continues automation and enables extension.
Sundial: Disable extension Disables extension.
Sundial: Pause until next circle Pause until next day/night circle.

Note: Whenever you use one of the first three commands, Sundial will be disabled.

Settings

Sundial contributes the following settings:

Setting Default Description
workbench.preferredLightColorTheme Default Light+ Name of the theme of choice for your day work.
workbench.preferredDarkColorTheme Default Dark+ Name of the theme of choice for your night work.
sundial.sunrise 07:00 Set a time when your day starts in 24 hours format.
sundial.sunset 19:00 Set a time when your night starts in 24 hours format.
sundial.dayVariable 0 Set a variable to change the theme X minutes before or after sunrise.
sundial.nightVariable 0 Set a variable to change the theme X minutes before or after sunset.
sundial.daySettings {} An object of VSCode settings applied on the day.
sundial.nightSettings {} An object of VSCode settings applied on the night.
sundial.interval 5 Set a interval in which sundial should check the time in minutes.

⚠️ Don't forget to set "window.autoDetectColorScheme": false

If you set the interval to zero (0) sundial will not periodically check the time but still when VS Code triggers some editor events.

On both daySettings and nightSettings they will override your Workbench VSCode settings. Please make sure both have the same properties otherwise they will not change since Sundial is not remembering the settings you have set before!

Automatically set by current location

Sundial will get your geolocation from Free IP Geolocation API and check your internet connection via Cloudflares 1.1.1.1 DNS-Server.

Setting Default Description
sundial.autoLocale false Updates your location based on your geolocation.

Automatically set by latitude and longitude

You can get your geolocation here: Free IP Geolocation API

Setting Default Description
sundial.latitude e.g. "50.110924"
sundial.longitude e.g. "8.682127"

Automatically set by OS appearance

Since VS Code version 1.42.0 it is now build in so you don't need this extension for this options.

{
  "window.autoDetectColorScheme": true
}

Read more about the implementation here:

Execution order

Sundial will check your settings in the following order and if one setting is present the next coming will be ignored.

  1. sundial.latitude and sundial.longitude
  2. sundial.autoLocale
  3. sundial.sunrise and sundial.sunset

Examples

{
  "window.autoDetectColorScheme": false, // required!
  "workbench.preferredLightColorTheme": "Default Light+",
  "workbench.preferredDarkColorTheme": "Default Dark+",
  "sundial.interval": 20,
  "sundial.autoLocale": true
}
{
  "window.autoDetectColorScheme": false, // required!
  "workbench.preferredLightColorTheme": "Default Light+",
  "workbench.preferredDarkColorTheme": "Default Dark+",
  "sundial.sunrise": "05:12"
}
{
  "window.autoDetectColorScheme": false, // required!
  "workbench.preferredLightColorTheme": "Default Light+",
  "workbench.preferredDarkColorTheme": "Default Dark+",
  "sundial.dayVariable": 43,
  "sundial.latitude": "50.110924",
  "sundial.longitude": "8.682127",
  "sundial.daySettings": {
    "editor.fontSize": 13
  },
  "sundial.nightSettings": {
    "editor.fontSize": 15
  }
}

Development

We are working with webpack to bundle Sundial to the smallest possible size to increase the load time in VSCode.

  1. Install packages via (your preferred package manager) pnpm install
  2. Set sundial.debug to 2
  3. Run debugger => Launch Extension
    • View the Extension Host and adjust settings to test or
    • Change a file and save it, let webpack compile
  4. Commit your changes with a detailed explanation
  5. Create a pull request

Commits

Sundial follows this spec:

Releases

Run the below to create a new release. This will increase the version based on your changes and create a new CHANGELOG.md section.

pnpm run release
You can’t perform that action at this time.