-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy paththeme.js
59 lines (52 loc) · 1.43 KB
/
theme.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const { Picker, TextView, ui } = require('tabris')
const THEMES = [ 'default', 'light', 'dark' ]
const DISPLAY_MODES = [ 'default', 'float', 'hide' ]
const BACKGROUNDS = [
ui.statusBar.background,
'rgba(0, 0, 0, 0.25)',
'red',
'green',
'blue'
]
createTextView('Theme', 'theme')
createTextView('Display mode', 'displayMode')
createTextView('Background', 'background')
createTextView('Height', 'height')
new Picker({
left: '#displayMode 16',
baseline: '#theme',
right: 16,
itemCount: THEMES.length,
itemText: index => THEMES[index]
})
.on('select', ({ index }) => ui.statusBar.theme = THEMES[index])
.appendTo(ui.contentView)
new Picker({
left: '#displayMode 16',
baseline: '#displayMode',
right: 16,
itemCount: DISPLAY_MODES.length,
itemText: index => DISPLAY_MODES[index]
})
.on('select', ({ index }) => (ui.statusBar.displayMode = DISPLAY_MODES[index]))
.appendTo(ui.contentView)
new Picker({
left: '#displayMode 16',
baseline: '#background',
right: 16,
itemCount: BACKGROUNDS.length,
itemText: index => BACKGROUNDS[index]
})
.on('select', ({ index }) => (ui.statusBar.background = BACKGROUNDS[index]))
.appendTo(ui.contentView)
new TextView({
left: '#displayMode 16',
baseline: '#height',
right: 16,
text: ui.statusBar.height
}).appendTo(ui.contentView)
function createTextView (text, id) {
new TextView({ id: id, left: 16, top: 'prev() 16', text: text }).appendTo(
ui.contentView
)
}