Overview
Checks the current day/night theme status of the device. This determines whether dark mode is enabled or disabled. Available on Android 9+ (API level 28).Method Signature
Parameters
Callback function that receives the current theme statusCallback Parameters:
theme(string): Either'light'or'dark'
Returns
Returns the current theme mode:
'light'- Light/day theme is active'dark'- Dark/night theme is active
Example
Use Cases
Apply Theme-Specific Styles
Listen for Theme Changes
Implementation Details
- Platform Support: Android 9+ (API level 28)
- Native Implementation: Checks
Configuration.UI_MODE_NIGHT_MASKflag - Source Reference:
plugin.js:160-165,DynamicColor.java:89-105
This method is independent of Dynamic Color availability and works on Android 9+, while Dynamic Color requires Android 12+.
Related Methods
- Use with
colors()to get the appropriate color set based on theme - Listen to
dynamicColorChangeevent to detect theme changes