- Download the source and add it either as a local package via the Package Manager or drop the source right into your project
- Use OpenUPM to install it
- Unity version 2020.1 or newer (last tested with 2020.3.1f1)
Api Compatibility Level
needs to be.NET 4.x
or.NET Core 2.0
- Automatically toggles between the light and dark editor themes based on your current local time using
- ... either a custom sunrise and sunset time you entered
- ... or a automatically fetched sunrise and sunset time based on the longitude & latitude you entered
Head over to your Preferences window and go to Project/Auto Dark Mode
, here you can configure the following options:
Enable Auto Dark Mode
: If this is checked, the plugin will compare your local time* to theSunrise
andSunset
options (see below) and turn on the respective theme.Auto Fetch
: If checked, the plugin will try to fetch and auto fill theSunrise
,Sunset
,Longitude
andLatitude
options (see below) using http://ip-api.com/json/ and sunrise-sunset.org API once a day.Fetch now
andFetch Timeout
: Force a fetch of theSunrise
andSunset
options (see below) now.Rough Location
andLongitude/Latitude
(only shown ifAuto Fetch
is enabled): Fill in the longitude and latitude of your location (e.g. 52.52 and 13.4050 for Berlin, Germany). Does not need to be super accurate. This usually filled in automatically.
Sunrise
andSunset
: The times* when sunrise and sunset occur/when Auto Dark Mode should switch the editor theme. IfAuto Fetch
is enabled, these fields should be populated for you automatically, otherwise you have to enter them manually*.Show Extra Logs
: Show some logs to know what's going on behind the scenes.
* All times are in UTC.
- Besides the actual plugin code it will create a config file (
Assets/AutoDarkModeSettings.asset
) to store the users settings when opening the settings for the first time. It is recommended to add this to your.gitignore
as this plugin is supposed to be configurable on a per-user level so each user needs to have their own copy. - The plugin will hook into the
InitializeOnLoadMethod
andEditorApplication.projectChanged
flow and try to decide if a switch of the editor theme is required and do so if needed.
- Editor Theme is not applied on a per-project level: This is something Unity has to change, unfortunately the Editor theme is a global setting and can't be changed on a per-project level.
If you notice anything else that might be wrong, file an issue.
- ✅
A way to automatically detect the user's location (long/lat). A rough estimate should be just fine to get good-enough approximations for the sunrise & sunset times. - ✅
Provide sensible default values forSunset
andSunrise
so the plugin works out of the box. - ✅
InitializeOnLoadMethod
mostly occurs when scripts change or the project launched, for non-programmers this might not happen often enough - maybe hook into Asset Database Reload somehow or something alike? - ✅
Automatically open Project Settings when plugin is added for the first time or provide a button in the welcome popup to go there. - Add option to invert the theme (light during the night, dark during the day). Not sure if this is something someone actually wants?
PRs are welcome!