Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NativePHP Appearance

Forces a NativePHP Mobile app into light or dark mode independent of the OS setting, or releases it back to following the system automatically.

bg-theme-*/text-theme-* classes already resolve their dark companion natively based on the OS color scheme — there is no PHP-facing API to override that, only to read it (Native\Mobile\Facades\System::appearance()). This plugin adds the missing write side.

Requirements

  • nativephp/mobile ^3.0 or ^4.0
  • iOS 15.0+ — fully supported via UIWindow.overrideUserInterfaceStyle.
  • Android — requires API 31+ (UiModeManager.setApplicationNightMode, the only per-app override Android exposes outside of AppCompatActivity). Below API 31, setMode() silently no-ops rather than partially applying.

Installation

composer require smronju/nativephp-appearance
php artisan vendor:publish --tag=nativephp-plugins-provider
php artisan native:plugin:register smronju/nativephp-appearance

Then rebuild: php artisan native:run.

Usage

use Smronju\NativephpAppearance\Facades\NativephpAppearance;

NativephpAppearance::setMode('dark');   // force dark
NativephpAppearance::setMode('light');  // force light
NativephpAppearance::setMode('system'); // follow the OS again

Fire-and-forget: there's no event to listen for, and no result to branch on — either the override applies (iOS always; Android on API 31+) or the call is a safe no-op (Android below API 31).

License

MIT

About

Forces a NativePHP Mobile app into light or dark mode independent of the OS setting, or releases it back to following the system automatically.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages