by farfromrefuge | v2.0.2
A NativeScript plugin to deal with Themes in the Declarative UI.
npm i --save nativescript-akylas-themes

npm npm npm


A NativeScript plugin to deal with dynamically loading UI Themes


NativeScript 2.x

tns plugin add [email protected]

NativeScript 5.x

tns plugin add nativescript-themes


This plugin works in NativeScript 2.x and 5.x. It does NOT work in v3 or v4.


This is released under the MIT License, meaning you are free to include this in any type of program

Sample Snapshot



To use the module you just require() it:

var themes = require('nativescript-themes');

Setup in App

Modify your startup app.js

var themes = require('nativescript-themes');

This will automatically apply the "red-theme.css" theme if no other theme has ever been chosen as the default theme.

You can also load a theme bundled by webpack using applyThemeCss:

var themes = require('nativescript-themes');
var cssText = require('~/assets/themes/dark.scss');
themes.applyThemeCss(cssText, 'dark.scss');

You ask, how exactly does this help?

This allows you to dynamically theme an application just by calling the theme system. Your master app.css file is applied first, then the theme file and finally your page.css


button {
background-color: red;


button {
background-color: green;


Demo shows three sample themes, and shows how to load the last chosen theme at startup.

Why use this?

This allows you to apply a specific theme file globally so all pages get it.

themes.applyTheme('cssFile', options);

options.noSave = true, this will cause it not to save this info for the getAppliedTheme to retrieve, this would typically used if you needed temporarily apply a theme.

var themes = require('nativescript-themes');


This returns the last theme applied; if no theme has been applied it will use the default_theme.

var themes = require('nativescript-themes');
var currentTheme = themes.getAppliedTheme('red-theme.css');
if (currentTheme === 'red-theme.css') {
console.log('We are using the default red-theme!');
} else {
console.log('We are using', currentTheme);

themes.applyThemeCss('textCss', 'filename');

This function receives a string containing CSS and applies it. The filename is only for reference (no file will be actually loaded).

var themes = require('nativescript-themes');
themes.applyThemeCss('page {background-color: black;}', 'default-theme.css');


Need some extra help getting started? Check out these tutorials for dealing with NativeScript UI themes in an iOS and Android application.


  • Brad Martin
  • Tiago Alves