Skip to content

Instantly share code, notes, and snippets.

Created July 2, 2015 13:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpost/715f3f28ad9703dedd27 to your computer and use it in GitHub Desktop.
Save mpost/715f3f28ad9703dedd27 to your computer and use it in GitHub Desktop.
The gist demonstrates how to create a custom Tabris.js Android theme.
<?xml version='1.0' encoding='utf-8'?>
<name>Tabris.js Android Theming Sandbox</name>
<hook type="after_platform_add" src="scripts/android/afterPlatformAdd.js" />
<platform name="android">
<preference name="Theme" value="" />
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="">
<style name="Theme.Sandbox" parent="@style/Theme.Tabris.Light.DarkActionBar">
<item name="colorPrimary">#3F51B5</item>
<item name="colorPrimaryDark">#303F9F</item>
<item name="colorAccent">#FF4081</item>
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
module.exports = function(context) {
var androidPlatformDir = path.join(context.opts.projectRoot, "platforms/android");
if (fs.existsSync(androidPlatformDir)) {
var srcDir = path.join(context.opts.projectRoot, "resources/android/res");
var targetDir = path.join(context.opts.projectRoot, "platforms/android/res");
copyRecursiveSync(srcDir, targetDir);
var copyRecursiveSync = function(src, dest) {
var exists = fs.existsSync(src);
var stats = exists && fs.statSync(src);
var isDirectory = exists && stats.isDirectory();
if (exists && isDirectory) {
if (!fs.existsSync(dest)) {
fs.readdirSync(src).forEach(function(childItemName) {
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
} else {
fs.linkSync(src, dest);
"title": "Tabris.js Android Theming Sandbox",
"main": "src/app.js",
"dependencies": {
"tabris": "^1.0.0"
var page = tabris.create("Page", {
title: "Tabris.js Theming",
topLevel: true
tabris.create("CheckBox", {
text: "Custom Theme",
layoutData: {left: 16, top: 16}
Copy link

Hi. On which folder i need to place the 'cordova_resources_android_res_values_themes.xml' with reference to package.json ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment