Search code examples
nativescriptnativescript-vue

NativeScript How to set a global tint color?


Hello I'm trying to set a global tint Color for my Nativescript App. Especially for iOS. I have been trying to set the appearance() without success. Basically I need to have a global tint color that will tint the Back button of a navigationBar.


Solution

  • I found out that this solution is working on iOS but should be called from within a Page so that KeyWindow has had the time to be instantiated.

    const Color = require("tns-core-modules/color").Color
    const mainColor = new Color("#ed1c24")
    UIApplication.sharedApplication.keyWindow.tintColor = mainColor.ios