forked from xzhhbx/jsbox_script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
icon_gen.js
89 lines (87 loc) · 2.71 KB
/
icon_gen.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
$app.autoKeyboardEnabled = true
$app.tips("点击图标即可预览")
$ui.render({
props: {
title: "JSBox图标生成"
},
views: [{
type: "view",
props: {
id: ""
},
layout: $layout.fill,
events: {
},
views: [{
type: "view",
props: {
id: "icon_view",
bgcolor: $color("#505050"),
radius: 30
},
layout: (make, view) => {
make.height.equalTo(220)
make.width.equalTo(200)
make.centerX.equalTo(view.super)
make.top.equalTo(20)
},
views: [{
type: "label",
props: {
id: "icon_font_view",
text: "{}",
font: $font("CourierNewPS-BoldMT", 125), // Courier
textColor: $color("#fff"),
},
layout: $layout.center
}],
events: {
tapped: sender => {
$quicklook.open({
image: $("icon_view").snapshot
})
}
}
}, {
type: "input",
props: {
text: "#",
placeholder: "背景色 #xxxxxx",
id: "color_input",
align: $align.center
},
layout: (make, view) => {
make.width.equalTo($("icon_view").width)
make.height.equalTo(40)
make.top.equalTo($("icon_view").bottom).inset(30)
make.centerX.equalTo(view.super)
},
events: {
returned: sender => {
$("icon_view").bgcolor = $color($("color_input").text)
$("color_input").blur()
}
}
}, {
type: "input",
props: {
text: "#",
id: "font_color_input",
placeholder: "前景色 #yyyyyy",
align: $align.center
},
layout: (make, view) => {
make.width.equalTo($("icon_view").width)
make.height.equalTo(40)
make.top.equalTo($("color_input").bottom).inset(10)
make.centerX.equalTo(view.super)
},
events: {
returned: sender => {
$("icon_font_view").textColor = $color($("font_color_input").text)
$("font_color_input").blur()
}
}
}]
}]
})