I built an open-source Android app that switches dark mode based on ambient light – Adaptive Theme

Published: (January 3, 2026 at 06:56 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for I built an open-source Android app that switches dark mode based on ambient light – Adaptive Theme

Howdy and happy new year!

I wanted to share an open‑source project of mine that I’ve been working on in my free time.

Adaptive Theme

Adaptive Theme automatically switches between Light and Dark mode using the ambient light sensor—not a fixed schedule. This optimizes readability, eye comfort, and possibly battery life. It’s free, ad‑free, and open‑source.

  • Play Store:
  • GitHub Repo:

Battery Efficiency

To avoid battery drain from constant sensor polling, the app is entirely passive. It uses an event‑driven architecture that checks the light sensor for a split second immediately after the screen turns on. There is no background polling; it only reacts to system broadcasts.

Note: This event‑driven approach works on Android 14 and above. On lower versions, the sensors cannot be properly read in the receiver.

Setup & Permissions

The biggest challenge is that the app requires WRITE_SECURE_SETTINGS to change the system theme. Granting this permission isn’t straightforward, so a wizard‑based setup flow is provided with several methods:

  • Web Tool (Recommended) – A browser‑based setup tool that works from another device without installing code or ADB (WebADB). Visit .
  • Shizuku – If you have Shizuku installed and configured, you can grant the permission directly within the Adaptive Theme app.
  • Root – On rooted devices, the permission can be granted with a single tap inside the app.
  • Manual ADB – If you have ADB installed on your computer, you can run the required ADB command manually.

Tech Stack & Architecture

  • UI: Jetpack Compose with Material 3 / Material You, mimicking the system settings look (stock/Pixel).
  • Architecture: MVVM with a Single‑Activity pattern.
  • Concurrency & Streams: Kotlin Coroutines and Flows for reactive state management.
  • Persistence: Jetpack DataStore for type‑safe settings storage.

Build Flavors

Two distinct build flavors keep the core app FOSS‑compliant:

  • Play Store: Includes Firebase (proprietary crash logs, etc.).
  • FOSS (GitHub Releases, etc.): Clean build with no proprietary blobs or trackers.

I’m curious to hear your thoughts and opinions! Let me know if you encounter any bugs or have ideas for new features. I’ll be around to answer questions.

Back to Blog

Related posts

Read more »

RxJava Fundamentals - Reactive Programming on Android

RxJava의 기본 개념과 안드로이드에서의 활용법을 알아봅니다. RxJava란? RxJava는 Reactive + Functional Programming을 결합한 라이브러리입니다. 핵심 개념 - 데이터와 처리를 분리하고, 데이터는 처리에 푸시만 합니다. - Threading을 라이브러...