Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Counter app with dark/light mode toggle using Titanium UI.
var win = Ti.UI.createWindow({backgroundColor:'white'});
var count = 0;
var isDark = false;
var label = Ti.UI.createLabel({text:'Counter: 0', top:50, font:{fontSize:24}});
var incButton = Ti.UI.createButton({title:'+', top:100});
var decButton = Ti.UI.createButton({title:'-', top:150});
var resetButton = Ti.UI.createButton({title:'Reset', top:200});
var themeButton = Ti.UI.createButton({title:'Toggle Theme', top:250});
incButton.addEventListener('click', function(){
count++;
label.text = 'Counter: ' + count;
});
decButton.addEventListener('click', function(){
count--;
label.text = 'Counter: ' + count;
});
resetButton.addEventListener('click', function(){
count=0;
label.text='Counter: ' + count;
});
themeButton.addEventListener('click', function(){
isDark = !isDark;
win.backgroundColor = isDark ? 'black' : 'white';
label.color = isDark ? 'white' : 'black';
});
win.add(label);
win.add(incButton);
win.add(decButton);
win.add(resetButton);
win.add(themeButton);
win.open();Titanium Appcelerator is an open-source mobile development framework that allows developers to build native iOS and Android apps using JavaScript, providing a single codebase for multiple platforms.
Origin & Creator
Created by Appcelerator, Inc. in 2008 to simplify cross-platform native mobile development using JavaScript.
Industrial Note
Titanium is widely used in enterprise mobile applications where native performance and device API access are required, particularly in banking, healthcare, and logistics apps.