-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrgba-test.js
64 lines (54 loc) · 1.39 KB
/
rgba-test.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
60
61
62
63
64
/*
Using classes and id's
@version:2.4.2
Snippet url:
- http://
References:
- https://tabrisjs.com/documentation/latest/selector.html
*/
const { Button, ui } = require('tabris')
ui.background = 'red'
// this only colors top ???
let btnOK = new Button({
layoutData: { centerX: 0, top: 'prev() 10', width: 100 },
class: 'main',
text: 'OK'
}).appendTo(ui.contentView)
let btnCancel = new Button({
class: 'main',
centerX: 0,
top: 'prev() 10',
width: 100,
text: 'Cancel'
}).appendTo(ui.contentView)
let btnReset = new Button({
id: 'reset',
centerX: 0,
top: 'prev() 10',
width: 100,
text: 'Reset'
}).appendTo(ui.contentView)
// event outsite create new declaration
btnReset.on('select', () => {
// using classes
ui.find('.main').set('textColor', 'red')
ui.apply({
// end .apply
'*': { background: '#ccc', width: 130 }
})
// apply using wildcards and multiple properties
// using id
ui.find('#reset').set('textColor', rgba(255, 0, 0, 0))
ui.find('#reset').set('background', '#f00')
// ui.find('#reset').set('textColor', 'white');
console.log('you pressed btnReset')
})
// end event btnReset on('select')
// event outsite create new declaration
btnOK.on('select', () => {
console.log(btnReset.background + ui.background)
})
// end event btnReset on('select')
function rgba (r, g, b, a) {
return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'
}