Update, August 2026: Adaptive Theme now includes Wallpaper Theme Sync and an optional blurred lock-screen wallpaper.
Android’s built-in automatic dark mode is usually based on a schedule or sunset. That is often a poor proxy for the actual lighting around you: a bright room at night may call for light mode, while a dark room during the day may not.
I built Adaptive Theme, a free and open-source Android app that switches the system-wide light and dark theme based on the device’s physical ambient light sensor.
This is an Android app, not a Flutter theming library. Its package name is dev.lexip.hecate.
The design goal
The app should react to real-world light conditions without continuously monitoring the sensor or switching the theme while someone is actively using their phone.
The solution is an event-driven screen-on flow:
- The screen turns on.
- Adaptive Theme briefly samples the ambient light sensor.
- It checks whether the sensor is likely obstructed, for example by a hand or pocket.
- The measured value is compared with a configurable lux threshold.
- If required, the Android system theme is changed before the user starts interacting.
The sensor is not continuously polled. After the short screen-on measurement, it stops.
This also means the app deliberately does not change the system theme in the middle of a session. Some apps handle a live theme change poorly, so screen-on is a predictable and less disruptive moment for it.
Features
- Automatic system-wide light and dark mode based on ambient light
- Custom lux threshold and presets
- Night Lock for keeping dark mode enabled during a chosen time window
- Wallpaper Theme Sync with separate wallpapers for light and dark mode
- Optional blur effect for the lock-screen wallpaper
- Quick Settings tile
- Material You interface
- Android 14+ smartphones
- Free, open source, and ad-free
The Android permission problem
Changing the Android system theme requires WRITE_SECURE_SETTINGS, which regular apps cannot grant to themselves through the usual Android permission dialog.
Adaptive Theme has a guided setup for the one-time grant:
- WebADB: use another device through the browser-based setup tool
- Shizuku: grant the permission on-device
- Root: grant it through the app on a rooted device
- Manual ADB: run the displayed command from a computer
Once granted, the permission persists across reboots. Shizuku, root, or an ADB connection is not required for normal operation afterwards.
Android 14 is the minimum supported version because this screen-on sensor architecture depends on APIs that are not available on older Android releases.
Tech stack
The app is built with:
- Kotlin
- Jetpack Compose and Material 3
- MVVM
- Kotlin Coroutines and Flow
- DataStore
Links
- Google Play: https://play.google.com/store/apps/details?id=dev.lexip.hecate
- FOSS APK / releases: https://github.com/xLexip/Adaptive-Theme/releases
- Source code: https://github.com/xLexip/Adaptive-Theme
- Feature video: https://www.youtube.com/watch?v=8zCZFw_wx-Y
Feedback, bug reports, feature ideas, and contributions are welcome.
Top comments (0)