Skip to content

Add adaptive theme based on ambient light sensor#416

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
Michvista:feat/adaptive-theme
May 27, 2026
Merged

Add adaptive theme based on ambient light sensor#416
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
Michvista:feat/adaptive-theme

Conversation

@Michvista
Copy link
Copy Markdown
Contributor

Closes #408
Automatically switch light/dark mode from Android lux readings with hysteresis and debounced consecutive readings, plus a Settings toggle and manual override when the user picks a theme.

Added an Adaptive Theme option that automatically switches between light and dark mode using the device ambient light sensor (Android via expo-sensors).

  • New Adaptive Theme toggle under Settings → App
  • Hysteresis thresholds: dark below 25 lux, light above 75 lux
  • Debounced transitions: 3 consecutive readings, 1s apart, to avoid flicker
  • Sensor subscription pauses when the app is backgrounded
  • Manual override: picking a theme in the theme picker disables adaptive theme
  • Unit tests for settings store and hook debounce/subscription lifecycle
  • Documentation in docs/adaptive-theme.md

Test plan

  • Run npm run test -- tests/store/settingsStore.test.ts tests/hooks/useAdaptiveTheme.test.ts
  • On Android: enable Adaptive Theme, move between bright/dim light; confirm smooth theme changes without flicker
  • Change Theme manually while adaptive is on; confirm adaptive toggle turns off
  • Background and foreground the app; confirm no crashes and adaptive behavior resumes when enabled

Notes

LightSensor is Android-only. On iOS/web, the toggle is stored but has no sensor effect.

Automatically switch light/dark mode from Android lux readings with hysteresis and debounced consecutive readings, plus a Settings toggle and manual override when the user picks a theme.

Co-authored-by: Cursor <cursoragent@cursor.com>
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@Michvista Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER RUKAYAT-CODER merged commit 27e3861 into rinafcode:main May 27, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement adaptive color scheme based on ambient light

2 participants