AI Prompt
Add dynamic status bar text color control to your application using the Despia SDK from: https://www.npmjs.com/package/despia-native\\
First, install the package:Then import it:Control status bar text color using:
First, install the package:
despia('statusbartextcolor://black')for black text (use on light backgrounds)despia('statusbartextcolor://white')for white text (use on dark backgrounds)
- Go to Despia settings and enable fullscreen mode to disable the status bar background color
- Use
var(--safe-area-top)CSS variable to accommodate the status bar space - Detect system dark mode preference using
window.matchMedia('(prefers-color-scheme: dark)') - Dynamically update status bar text color based on your app’s current theme
This feature requires the despia-native npm package. Follow the installation instructions closely and do not modify the implementation.
statusbartextcolor://{white||black} command. When combined with fullscreen mode in Despia settings, you can create fully immersive experiences where your app controls the entire screen, including custom animations, transitions, and full-bleed imagery, with only the status bar text visible on top, styled to match your design.
Installation
Usage
1. Basic Status Bar Text Color Control
2. Dark Mode Detection and Auto-Switching
3. Theme-Aware Component Example
Safe Area Integration
When controlling the status bar text color with fullscreen mode enabled, always accommodate the safe area space using CSS variables. The Despia native runtime automatically providesvar(--safe-area-top) and var(--safe-area-bottom) CSS variables.
Resources
- NPM Package: despia-native
- CSS Variables:
var(--safe-area-top)andvar(--safe-area-bottom)automatically provided by Despia runtime