cordova-plugin-os-theme

1.0.1 • Public • Published

cordova-plugin-os-theme npm version

This plugin is designed to return information about the current os theme (android and iOS).

Installation

Through your terminal:

# Newest npm version
cordova plugin add cordova-plugin-os-theme
 
# Newest github version
cordova plugin add https://github.com/DavidBriglio/cordova-plugin-os-theme.git

Useage

This plugin has one method: cordova.plugins.osTheme.getTheme() that will return a promise that will in turn receive an object with the current os theme properties. Currently there is only one property being tracked: isDark. This will be set to true only if dark mode is confirmed active. If we do not know the state of the theme or it is in light mode, isDark will be false.

Example

cordova.plugins.osTheme.getTheme()
  .then(theme => { // { isDark: [boolean] }
    console.log('The current theme is: ' + (theme.isDark ? 'Dark' : 'Light'))
  })
  .catch(message => { // string error message
    console.log('Error getting theme: ' + message)
  })

Compatibility

This plugin can be used for android, and iOS version 13.0.0+!

License

MIT - Please see license file for full details.

Questions

Please feel free to open an issue!

Package Sidebar

Install

npm i cordova-plugin-os-theme

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

6.12 kB

Total Files

8

Last publish

Collaborators

  • davidbriglio