All Projects → hansemannn → titanium-dark-mode

hansemannn / titanium-dark-mode

Licence: MIT license
Full support for iOS 13+ / Android 10+ dark mode (semantic colors and images) in Appcelerator Titanium

Programming Languages

javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
java
68154 projects - #9 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to titanium-dark-mode

titanium-arkit
Use the iOS 11 ARKit API in Axway Titanium
Stars: ✭ 28 (+7.69%)
Mutual labels:  titanium, appcelerator, axway
titanium-apple-sign-in
Use the iOS 13+ Apple Sign In API with Titanium
Stars: ✭ 29 (+11.54%)
Mutual labels:  titanium, appcelerator, ios13
titanium-firebase-analytics
Use the Firebase Analytics SDK in Axway Titanium 🚀
Stars: ✭ 33 (+26.92%)
Mutual labels:  titanium, appcelerator, axway
ti.exoplayer
A native control for playing videos for Titanium. Based on Google ExoPlayer, using Titanium.Media.VideoPlayer API.
Stars: ✭ 17 (-34.62%)
Mutual labels:  titanium, appcelerator, axway
nl.fokkezb.loading
The widget provides a simple loading mask that can be easily styled and configured.
Stars: ✭ 96 (+269.23%)
Mutual labels:  titanium, appcelerator, axway
ti.playservices
Titanium module for Google Play Services
Stars: ✭ 19 (-26.92%)
Mutual labels:  titanium, appcelerator, axway
griffin-app-opensource
The Axway Griffin App goes open source!
Stars: ✭ 19 (-26.92%)
Mutual labels:  titanium, appcelerator, axway
titanium-turbo
Axway Amplify module that adds some enhancements for Appcelerator Titanium Alloy
Stars: ✭ 15 (-42.31%)
Mutual labels:  titanium, appcelerator, axway
To.BounceView
A bouncing view widget for Titanium
Stars: ✭ 49 (+88.46%)
Mutual labels:  titanium, appcelerator
ti.paint
Touch-based painting with the Titanium SDK.
Stars: ✭ 27 (+3.85%)
Mutual labels:  titanium, appcelerator
Titanium mobile
🚀 Native iOS- and Android- Apps with JavaScript
Stars: ✭ 2,553 (+9719.23%)
Mutual labels:  titanium, appcelerator
titanium-alternate-icons
Leverage the ability to change the app icon in iOS 10.3+
Stars: ✭ 24 (-7.69%)
Mutual labels:  titanium, appcelerator
ti.moddevguide
Appcelerator Titanium native Module Guide
Stars: ✭ 39 (+50%)
Mutual labels:  titanium, appcelerator
ti.admob
Use the Google AdMob SDK on iOS and Android with Titanium
Stars: ✭ 51 (+96.15%)
Mutual labels:  titanium, appcelerator
nl.fokkezb.button
Bootstrap Button widget for Appcelerator (Titanium)
Stars: ✭ 72 (+176.92%)
Mutual labels:  titanium, appcelerator
titanium-material
Use the native Material UI/UX framework (https://github.com/CosmicMind/Material) in Titanium!
Stars: ✭ 14 (-46.15%)
Mutual labels:  titanium, appcelerator
av.imageview
Titanium native ImageView module that extends the default Titanium ImageView with more capabilities and a different caching system.
Stars: ✭ 97 (+273.08%)
Mutual labels:  titanium, appcelerator
staballoy
Reactive UI framework for Titanium Alloy
Stars: ✭ 18 (-30.77%)
Mutual labels:  titanium, appcelerator
vscode-appcelerator-titanium
Appcelerator development tools and UI package for Visual Studio Code.
Stars: ✭ 35 (+34.62%)
Mutual labels:  titanium, appcelerator
ti.map
Use native Apple Maps & Google Maps in iOS and Android with Axway Titanium
Stars: ✭ 49 (+88.46%)
Mutual labels:  titanium, appcelerator

iOS 13+ Dark Mode in Titanium

Full support for iOS 13+ dark mode in Titanium. Works for both semantic colors and images.

Example

⚠️ Note

You should only use this plugin if you want to support dark mode with a Titanium version < 8.2.0. Titanium 8.2.0 and later added support for dark mode based on this plugin internally, so this plugin isn't needed anymore.

The Magic

This project includes a CLI hook that generates semantic colors and images for the iOS Asset Catalog based on a JSON file of colors that can even be used cross-platform and backwards compatible. It hooks into the SDK process between generating the asset catalog and compiling the app, so you can even change colors between builds without the need of clean-building the app again.

Requirements

The following project- and OS-requirements are necessary:

  • Xcode 11+
  • Asset Catalog enabled
  • iOS 13+ (will fallback to #000000 if called from older devices)
  • Titanium SDK 8.0.0+
  • A CLI plugin to hook into the asset catalog to generate the semantic colors
  • A JSON file to curate the color styles

Installation

  • Copy the contents of the plugin/ directory (colors) to <project>/plugins
  • Link the colors plugin in your tiapp.xml:
<ti:app>
  <!-- ... -->
  <plugins>
    <!-- ... -->
    <plugin version="1.0">colors</plugin>
  </plugins>
</ti:app>
  • Link the native ti.darkmode module to your project like any other native module
  • Alloy: Copy your color JSON file to <project>/app/assets/json/colors.json
  • Classic: Copy your color JSON file to <project>/Resources/json/colors.json
  • For semantic images, make sure they are following the following scheme (-dark suffix):
# Default (Light)
image.png
[email protected]
[email protected]

# Dark
image-dark.png
[email protected]
[email protected]
  • Map the colors on runtime for older devices or Android (this is just an example of how this could look like):
function initializeColors() {
  const colors = Alloy.Globals.colors = JSON.parse(Ti.Filesystem.getFile('json/colors.json').read());
  const darkmode = OS_ANDROID ? undefined : require('ti.darkmode');

  for (const color of Object.keys(colors)) {
    Alloy.CFG.styles[color] = Utils.isiOSVersionOrGreater(13) ? darkmode.fetch(color) : colors[color].light;
  }

  // Use your colors like the following
  myLabel.backgroundColor = Alloy.CFG.styles.backgroundColor
}

ToDos

  • Support sub-folders
  • This currently breaks incremental builds, because the Xcode project is changed after it's hash is stored

License

MIT

Author

Hans Knöchel

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].