-
Notifications
You must be signed in to change notification settings - Fork 9
/
XiiLangColors.sc
153 lines (121 loc) · 5.72 KB
/
XiiLangColors.sc
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
XiiLangColors {
*new { arg projectnamearg;
^super.new.initXiiLangColors(projectnamearg);
}
initXiiLangColors { arg projectname;
var doc, win;
var doccolor, oncolor, activecolor, offcolor, deadcolor;
[\projectnameCOL, projectname].postln;
try{ // check if the color file exists
#doccolor, oncolor, activecolor, offcolor, deadcolor = Object.readArchive("ixilang/"++projectname++"/colors.ixi")
};
if(doccolor.isNil, {
doccolor = Color.black;
oncolor = Color.white;
activecolor = Color.yellow;
offcolor = Color.green;
deadcolor = Color.red;
});
doc = Document.new;
doc.background_(doccolor);
doc.stringColor_(oncolor);
doc.font_(Font("Monaco",20));
doc.promptToSave_(false);
doc.bounds_(Rect(100, 500, 700, 600));
doc.string_("
// string color
jimi -> string[1 3 2 3 ] +12 <123488>
// active color (when agent is changing)
jimi -> string[1 3 2 3 ] +12 <123488>
// dozing color (when agent is dozing)
jimi -> string[1 3 2 3 ] +12 <123488>
// dead color (when agent is dead)
jimi -> string[1 3 2 3 ] +12 <123488>
");
doc.stringColor_(oncolor, 0, 68);
doc.stringColor_(activecolor, 68, 88);
doc.stringColor_(offcolor, 156, 86);
doc.stringColor_(deadcolor, 244, 86);
doc.editable_(false);
win = Window.new("ixi lang Doc Color Scheme", Rect(810, 500, 300, 580), resizable:false).front;
// document
StaticText(win, Rect(100, 20, 100, 16)).string_("document color");
EZSlider(win, Rect(0, 40, 280, 15), "red ", [0, 255].asSpec).action_({arg sl;
doccolor = Color.new255(sl.value, doccolor.green*255, doccolor.blue*255);
doc.background_(doccolor);
}).value_(doccolor.red*255);
EZSlider(win, Rect(0, 60, 280, 15), "green ", [0, 255].asSpec).action_({arg sl;
doccolor = Color.new255(doccolor.red*255, sl.value, doccolor.blue*255);
doc.background_(doccolor);
}).value_(doccolor.green*255);
EZSlider(win, Rect(0, 80, 280, 15), "blue ", [0, 255].asSpec).action_({arg sl;
doccolor = Color.new255(doccolor.red*255, doccolor.green*255, sl.value);
doc.background_(doccolor);
}).value_(doccolor.blue*255);
// string
StaticText(win, Rect(100, 120, 100, 16)).string_("text color");
EZSlider(win, Rect(0, 140, 280, 15), "red ", [0, 255].asSpec).action_({arg sl;
oncolor = Color.new255(sl.value, oncolor.green*255, oncolor.blue*255);
doc.stringColor_(oncolor, 0, 68);
}).value_(oncolor.red*255);
EZSlider(win, Rect(0, 160, 280, 15), "green ", [0, 255].asSpec).action_({arg sl;
oncolor = Color.new255(oncolor.red*255, sl.value, oncolor.blue*255);
doc.stringColor_(oncolor, 0, 68);
}).value_(oncolor.green*255);
EZSlider(win, Rect(0, 180, 280, 15), "blue ", [0, 255].asSpec).action_({arg sl;
oncolor = Color.new255(oncolor.red*255, oncolor.green*255, sl.value);
doc.stringColor_(oncolor, 0, 68);
}).value_(oncolor.blue*255);
// active
StaticText(win, Rect(100, 220, 100, 16)).string_("active string color");
EZSlider(win, Rect(0, 240, 280, 15), "red ", [0, 255].asSpec).action_({arg sl;
activecolor = Color.new255(sl.value, activecolor.green*255, activecolor.blue*255);
doc.stringColor_(activecolor, 68, 88);
}).value_(activecolor.red*255);
EZSlider(win, Rect(0, 260, 280, 15), "green ", [0, 255].asSpec).action_({arg sl;
activecolor = Color.new255(activecolor.red*255, sl.value, activecolor.blue*255);
doc.stringColor_(activecolor, 68, 88);
}).value_(activecolor.green*255);
EZSlider(win, Rect(0, 280, 280, 15), "blue ", [0, 255].asSpec).action_({arg sl;
activecolor = Color.new255(activecolor.red*255, activecolor.green*255, sl.value);
doc.stringColor_(activecolor, 68, 88);
}).value_(activecolor.blue*255);
// dozing
StaticText(win, Rect(100, 320, 100, 16)).string_("dozing string color");
EZSlider(win, Rect(0, 340, 280, 15), "red ", [0, 255].asSpec).action_({arg sl;
offcolor = Color.new255(sl.value, offcolor.green*255, offcolor.blue*255);
doc.stringColor_(offcolor, 156, 86);
}).value_(offcolor.red*255);
EZSlider(win, Rect(0, 360, 280, 15), "green ", [0, 255].asSpec).action_({arg sl;
offcolor = Color.new255(offcolor.red*255, sl.value, offcolor.blue*255);
doc.stringColor_(offcolor, 156, 86);
}).value_(offcolor.green*255);
EZSlider(win, Rect(0, 380, 280, 15), "blue ", [0, 255].asSpec).action_({arg sl;
offcolor = Color.new255(offcolor.red*255, offcolor.green*255, sl.value);
doc.stringColor_(offcolor, 156, 86);
}).value_(offcolor.blue*255);
// dead
StaticText(win, Rect(100, 420, 100, 16)).string_("dead string color");
EZSlider(win, Rect(0, 440, 280, 15), "red ", [0, 255].asSpec).action_({arg sl;
deadcolor = Color.new255(sl.value, deadcolor.green*255, deadcolor.blue*255);
doc.stringColor_(deadcolor, 244, 86);
}).value_(deadcolor.red*255);
EZSlider(win, Rect(0, 460, 280, 15), "green ", [0, 255].asSpec).action_({arg sl;
deadcolor = Color.new255(deadcolor.red*255, sl.value, deadcolor.blue*255);
doc.stringColor_(deadcolor, 244, 86);
}).value_(deadcolor.green*255);
EZSlider(win, Rect(0, 480, 280, 15), "blue ", [0, 255].asSpec).action_({arg sl;
deadcolor = Color.new255(deadcolor.red*255, deadcolor.green*255, sl.value);
doc.stringColor_(deadcolor, 244, 86);
}).value_(deadcolor.blue*255);
Button(win, Rect(20, 530, 260, 30))
.states_([["save color file", Color.black, Color.green.alpha_(0.2)]])
.action_({
[doccolor, oncolor, activecolor, offcolor, deadcolor].writeArchive("ixilang/"++projectname++"/colors.ixi");
" ---> ixi lang NOTE: You need to restart your session for the new mapping to take function (Press the green 'Start session' button".postln;
})
.font_(Font("Helvetica", 11));
doc.onClose_({win.close});
win.onClose_({doc.close});
}
}