Changeset View
Changeset View
Standalone View
Standalone View
src/color_gtk2_theme
- This file was added.
Property | Old Value | New Value |
---|---|---|
File Mode | null | 100755 |
1 | #!/usr/bin/env python3 | ||||
---|---|---|---|---|---|
2 | import cairo | ||||
3 | import colorsys | ||||
4 | from math import pi | ||||
5 | import os | ||||
6 | import errno | ||||
7 | import sys | ||||
8 | import re | ||||
9 | import argparse | ||||
10 | from os.path import expanduser | ||||
11 | import pathlib | ||||
12 | import shutil | ||||
13 | | ||||
14 | def make_sure_path_exists(path): | ||||
15 | try: | ||||
16 | pathlib.Path(path).mkdir(parents=True, exist_ok=True) | ||||
17 | except FileExistsError as exception: | ||||
18 | pass | ||||
19 | pass | ||||
20 | | ||||
21 | | ||||
22 | class ReadKdeGlobals(): | ||||
23 | def __init__(self, base_file_name): | ||||
24 | self._colors = {} | ||||
25 | self._colors = self.read_globals(base_file_name) | ||||
26 | | ||||
27 | def read_globals(self, filename): | ||||
28 | with open(filename, 'r', encoding="utf-8") as _kde: | ||||
29 | for widget in ['Disabled', 'Inactive', 'Button', 'Selection', | ||||
30 | 'Tooltip', 'View', 'Window', 'WM']: | ||||
31 | for line in _kde: | ||||
32 | if line.strip().split(':')[-1].strip('[]') == widget: | ||||
33 | break | ||||
34 | for line in _kde: | ||||
35 | if line == '\n': | ||||
36 | break | ||||
37 | key = '{0}{1}'.format(widget, line.strip().split('=')[0]) | ||||
38 | value = line.strip().split('=')[1] | ||||
39 | if value == '': | ||||
40 | continue | ||||
41 | self._colors[key] = value | ||||
42 | return self._colors | ||||
43 | | ||||
44 | | ||||
45 | class Color(object): | ||||
46 | def __init__(self, colordict, name, name2=None, amount=0): | ||||
47 | color = colordict[name] | ||||
48 | self.colordict = colordict | ||||
49 | | ||||
50 | r = float(color.split(',')[0]) | ||||
51 | g = float(color.split(',')[1]) | ||||
52 | b = float(color.split(',')[2]) | ||||
53 | if name2 is not None: | ||||
54 | color2 = colordict[name2] | ||||
55 | r = r * amount + float(color2.split(',')[0]) * (1 - amount) | ||||
56 | g = g * amount + float(color2.split(',')[1]) * (1 - amount) | ||||
57 | b = b * amount + float(color2.split(',')[2]) * (1 - amount) | ||||
58 | | ||||
59 | self.rgb255 = (int(r), int(g), int(b)) | ||||
60 | self.rgb = (r/255, g/255, b/255) | ||||
61 | self.html = '#%02x%02x%02x' % self.rgb255 | ||||
62 | self.insensitive = self._color_effect( | ||||
63 | self._intensity_effect(self.rgb, 'Disabled'), 'Disabled') | ||||
64 | self.insensitive_alpha = self._contrast_effect(self.rgb, 'Disabled') | ||||
65 | | ||||
66 | if self.colordict['InactiveEnable'] == 'false': | ||||
67 | self.inactive = self.rgb | ||||
68 | self.inactive_alpha = 1.0 | ||||
69 | else: | ||||
70 | self.inactive = self._color_effect( | ||||
71 | self._intensity_effect(self.rgb, 'Inactive'), 'Inactive') | ||||
72 | self.inactive_alpha = self._contrast_effect(self.rgb, 'Inactive') | ||||
73 | self.inactive_insensitive = self._color_effect( | ||||
74 | self._intensity_effect(self.inactive, 'Disabled'), 'Disabled') | ||||
75 | self.inactive_insensitive_alpha = max( | ||||
76 | self.inactive_alpha - (1 - self.insensitive_alpha), 0) | ||||
77 | | ||||
78 | def _mix(self, color, mix_color, amount): | ||||
79 | r = color[0] * amount + mix_color[0] * (1 - amount) | ||||
80 | g = color[1] * amount + mix_color[1] * (1 - amount) | ||||
81 | b = color[2] * amount + mix_color[2] * (1 - amount) | ||||
82 | return (r, g, b) | ||||
83 | | ||||
84 | def _lighter(self, color, amount): | ||||
85 | h, s, v = colorsys.rgb_to_hsv(color[0], color[1], color[2]) | ||||
86 | v = min((1+amount)*v, 1) | ||||
87 | r, g, b = colorsys.hsv_to_rgb(h, s, v) | ||||
88 | return (r, g, b) | ||||
89 | | ||||
90 | def _darker(self, color, amount): | ||||
91 | h, s, v = colorsys.rgb_to_hsv(color[0], color[1], color[2]) | ||||
92 | if amount == -1: | ||||
93 | v = 1 | ||||
94 | else: | ||||
95 | v = min(v/(1+amount), 1) | ||||
96 | r, g, b = colorsys.hsv_to_rgb(h, s, v) | ||||
97 | return (r, g, b) | ||||
98 | | ||||
99 | def _desaturate(self, color, amount): | ||||
100 | h, s, v = colorsys.rgb_to_hsv(color[0], color[1], color[2]) | ||||
101 | s = min(s * (1 - amount), 1) | ||||
102 | r, g, b = colorsys.hsv_to_rgb(h, s, v) | ||||
103 | return (r, g, b) | ||||
104 | | ||||
105 | def _intensity_effect(self, color, state): | ||||
106 | effect = int(self.colordict[state + 'IntensityEffect']) | ||||
107 | amount = float(self.colordict[state + 'IntensityAmount']) | ||||
108 | if effect == 0: | ||||
109 | (r, g, b) = color | ||||
110 | elif effect == 1: | ||||
111 | if amount >= 0: | ||||
112 | (r, g, b) = self._mix((1.0, 1.0, 1.0), color, amount) | ||||
113 | else: | ||||
114 | (r, g, b) = self._mix((0.0, 0.0, 0.0), color, amount) | ||||
115 | elif effect == 2: | ||||
116 | (r, g, b) = self._darker(color, amount) | ||||
117 | elif effect == 3: | ||||
118 | (r, g, b) = self._lighter(color, amount) | ||||
119 | return (r, g, b) | ||||
120 | | ||||
121 | def _color_effect(self, color, state): | ||||
122 | effect = int(self.colordict[state + 'ColorEffect']) | ||||
123 | amount = float(self.colordict[state + 'ColorAmount']) | ||||
124 | effect_color = self.colordict[state + 'Color'] | ||||
125 | effect_color = (float(effect_color.split(',')[0])/255, | ||||
126 | float(effect_color.split(',')[1])/255, | ||||
127 | float(effect_color.split(',')[2])/255) | ||||
128 | if effect == 0: | ||||
129 | (r, g, b) = color | ||||
130 | elif effect == 1: | ||||
131 | (r, g, b) = self._desaturate(color, amount) | ||||
132 | else: | ||||
133 | (r, g, b) = self._mix(effect_color, color, amount) | ||||
134 | return (r, g, b) | ||||
135 | | ||||
136 | def _contrast_effect(self, color, state): | ||||
137 | effect = int(self.colordict[state + 'ContrastEffect']) | ||||
138 | amount = float(self.colordict[state + 'ContrastAmount']) | ||||
139 | if effect == 0: | ||||
140 | return 1.0 | ||||
141 | else: | ||||
142 | return 1.0 - amount | ||||
143 | | ||||
144 | def lighten_color(self, amount): | ||||
145 | h, s, v = colorsys.rgb_to_hsv(self.rgb[0], self.rgb[1], self.rgb[2]) | ||||
146 | v = (1+amount)*v | ||||
147 | r, g, b = colorsys.hsv_to_rgb(h, s, v) | ||||
148 | self.rgb = (r, g, b) | ||||
149 | self.rgb255 = (int(r*255), int(g*255), int(b*255)) | ||||
150 | | ||||
151 | def gradient(self, state='', alpha=1.0): | ||||
152 | if state == 'active': | ||||
153 | stop1 = self._lighter(self.rgb, 0.03) | ||||
154 | stop2 = self._darker(self.rgb, 0.10) | ||||
155 | linear = cairo.LinearGradient(1, 1, 1, 19) | ||||
156 | linear.add_color_stop_rgba( | ||||
157 | 0.0, stop1[0], stop1[1], stop1[2], alpha) | ||||
158 | linear.add_color_stop_rgba( | ||||
159 | 1.0, stop2[0], stop2[1], stop2[2], alpha) | ||||
160 | else: | ||||
161 | stop1 = self._lighter(self.rgb, 0.01) | ||||
162 | stop2 = self._darker(self.rgb, 0.03) | ||||
163 | linear = cairo.LinearGradient(1, 1, 1, 19) | ||||
164 | linear.add_color_stop_rgba( | ||||
165 | 0.0, stop1[0], stop1[1], stop1[2], alpha) | ||||
166 | linear.add_color_stop_rgba( | ||||
167 | 1.0, stop2[0], stop2[1], stop2[2], alpha) | ||||
168 | return linear | ||||
169 | | ||||
170 | | ||||
171 | class Assets(object): | ||||
172 | def __init__(self, width, height, scl=1, rotation=0, filename='png'): | ||||
173 | self.w = width | ||||
174 | self.h = height | ||||
175 | if filename == 'png': | ||||
176 | self.surface = cairo.ImageSurface( | ||||
177 | cairo.FORMAT_ARGB32, scl*width, scl*height) | ||||
178 | else: | ||||
179 | self.surface = cairo.SVGSurface(os.path.join( | ||||
180 | assets_path, filename), scl*width, scl*height) | ||||
181 | cr = self.cr = cairo.Context(self.surface) | ||||
182 | if rotation != 0: | ||||
183 | cr.translate(scl*width/2, scl*height/2) | ||||
184 | cr.rotate(rotation*pi/2) | ||||
185 | cr.translate(-scl*width/2, -scl*height/2) | ||||
186 | cr.scale(scl, scl) | ||||
187 | | ||||
188 | def background(self, color): | ||||
189 | self.cr.rectangle(0, 0, self.w, self.h) | ||||
190 | self.cr.set_source_rgb(color[0], color[1], color[2]) | ||||
191 | self.cr.fill() | ||||
192 | | ||||
193 | def line(self, color, x, y, width, height): | ||||
194 | self.cr.rectangle(x, y, width, height) | ||||
195 | self.cr.set_source_rgb(color[0], color[1], color[2]) | ||||
196 | self.cr.fill() | ||||
197 | | ||||
198 | def rounded_rectancle(self, color, width, height, x, y, radius, alpha=1.0, | ||||
199 | gradient=False): | ||||
200 | self.cr.new_sub_path() | ||||
201 | self.cr.arc(x + width - radius, y + radius, radius, -pi/2, 0) | ||||
202 | self.cr.arc(x + width - radius, y + height - radius, radius, 0, pi/2) | ||||
203 | self.cr.arc(x + radius, y + height - radius, radius, pi/2, pi) | ||||
204 | self.cr.arc(x + radius, y + radius, radius, pi, 3*pi/2) | ||||
205 | self.cr.close_path() | ||||
206 | if gradient: | ||||
207 | self.cr.set_source(color) | ||||
208 | elif color is None: | ||||
209 | self.cr.set_operator(cairo.OPERATOR_CLEAR) | ||||
210 | elif color == 'shadow': | ||||
211 | self.cr.set_source_rgba(0.0, 0.0, 0.0, 0.15) | ||||
212 | else: | ||||
213 | self.cr.set_source_rgba(color[0], color[1], color[2], alpha) | ||||
214 | self.cr.fill() | ||||
215 | | ||||
216 | def rounded_triangle(self, color, width, height, x, y, radius, alpha=1.0): | ||||
217 | self.cr.new_sub_path() | ||||
218 | self.cr.move_to(x + width, y) | ||||
219 | self.cr.line_to(x + width, y + height - radius) | ||||
220 | self.cr.arc(x + width - radius, y + height - radius, radius, 0, pi/2) | ||||
221 | self.cr.line_to(x, y + height) | ||||
222 | self.cr.close_path() | ||||
223 | self.cr.set_source_rgba(color[0], color[1], color[2], alpha) | ||||
224 | self.cr.fill() | ||||
225 | | ||||
226 | def circle(self, color, x, y, radius, alpha=1.0, gradient=False): | ||||
227 | self.cr.new_sub_path() | ||||
228 | self.cr.arc(x, y, radius, 0, 2*pi) | ||||
229 | self.cr.close_path() | ||||
230 | if gradient: | ||||
231 | self.cr.set_source(color) | ||||
232 | elif color is None: | ||||
233 | self.cr.set_operator(cairo.OPERATOR_CLEAR) | ||||
234 | elif color == 'shadow': | ||||
235 | self.cr.set_source_rgba(0.0, 0.0, 0.0, 0.15) | ||||
236 | else: | ||||
237 | self.cr.set_source_rgba(color[0], color[1], color[2], alpha) | ||||
238 | self.cr.fill() | ||||
239 | | ||||
240 | def half_circle(self, color, x, y, radius, alpha=1.0): | ||||
241 | self.cr.new_sub_path() | ||||
242 | self.cr.arc(x, y, radius, -pi/4, 3*pi/4) | ||||
243 | self.cr.close_path() | ||||
244 | self.cr.set_source_rgba(color[0], color[1], color[2], alpha) | ||||
245 | self.cr.fill() | ||||
246 | | ||||
247 | def arrow(self, color, alpha=1.0, shiftx=0, shifty=0): | ||||
248 | self.cr.new_sub_path() | ||||
249 | self.cr.move_to(shiftx + 1, shifty + 8) | ||||
250 | self.cr.line_to(shiftx + 6, shifty + 3) | ||||
251 | self.cr.line_to(shiftx + 11, shifty + 8) | ||||
252 | self.cr.set_source_rgba(color[0], color[1], color[2], alpha) | ||||
253 | self.cr.set_line_width(1.0) | ||||
254 | self.cr.stroke() | ||||
255 | | ||||
256 | def arrow_small(self, color, alpha=1.0): | ||||
257 | self.cr.new_sub_path() | ||||
258 | self.cr.move_to(1, 6) | ||||
259 | self.cr.line_to(4, 3) | ||||
260 | self.cr.line_to(7, 6) | ||||
261 | self.cr.set_source_rgba(color[0], color[1], color[2], alpha) | ||||
262 | self.cr.set_line_width(1.0) | ||||
263 | self.cr.stroke() | ||||
264 | | ||||
265 | def tab(self, color, width, height, x, y, radius, alpha=1.0): | ||||
266 | self.cr.move_to(width + x, y) | ||||
267 | self.cr.line_to(width + x, height - radius + y) | ||||
268 | self.cr.arc(width - radius + x, height - radius + y, radius, 0, pi/2) | ||||
269 | self.cr.line_to(radius + x, height + y) | ||||
270 | self.cr.arc(radius + x, height - radius + y, radius, pi/2, pi) | ||||
271 | self.cr.line_to(x, y) | ||||
272 | self.cr.close_path | ||||
273 | if color is None: | ||||
274 | self.cr.set_operator(cairo.OPERATOR_CLEAR) | ||||
275 | else: | ||||
276 | self.cr.set_source_rgba(color[0], color[1], color[2], alpha) | ||||
277 | self.cr.fill() | ||||
278 | | ||||
279 | def spinbutton(self, color, width, height, x, y, radius, alpha=1.0): | ||||
280 | self.cr.move_to(width + x, y) | ||||
281 | self.cr.line_to(width + x, height - radius + y) | ||||
282 | self.cr.arc(width - radius + x, height - radius + y, radius, 0, pi/2) | ||||
283 | self.cr.line_to(x, height + y) | ||||
284 | self.cr.line_to(x, y) | ||||
285 | self.cr.close_path() | ||||
286 | if color is None: | ||||
287 | self.cr.set_operator(cairo.OPERATOR_CLEAR) | ||||
288 | else: | ||||
289 | self.cr.set_source_rgba(color[0], color[1], color[2], alpha) | ||||
290 | self.cr.fill() | ||||
291 | | ||||
292 | def notebook(self, color, width, height, x, y, radius): | ||||
293 | self.cr.move_to(x, y) | ||||
294 | self.cr.line_to(x + width - radius, y) | ||||
295 | self.cr.arc(x + width - radius, y + radius, radius, -pi/2, 0) | ||||
296 | self.cr.line_to(x + width, y + height-radius) | ||||
297 | self.cr.arc(x + width - radius, y + height - radius, radius, 0, pi/2) | ||||
298 | self.cr.line_to(x + radius, y + height) | ||||
299 | self.cr.arc(x + radius, y + height - radius, radius, pi/2, pi) | ||||
300 | self.cr.close_path() | ||||
301 | self.cr.set_source_rgb(color[0], color[1], color[2]) | ||||
302 | self.cr.fill() | ||||
303 | | ||||
304 | def minimize(self, color=None): | ||||
305 | self.cr.move_to(4, 7) | ||||
306 | self.cr.line_to(9, 12) | ||||
307 | self.cr.line_to(14, 7) | ||||
308 | if color is None: | ||||
309 | self.cr.set_operator(cairo.OPERATOR_CLEAR) | ||||
310 | else: | ||||
311 | self.cr.set_source_rgb(color[0], color[1], color[2]) | ||||
312 | self.cr.set_line_width(1.0) | ||||
313 | self.cr.stroke() | ||||
314 | | ||||
315 | def maximize(self, color=None): | ||||
316 | self.cr.move_to(4, 11) | ||||
317 | self.cr.line_to(9, 6) | ||||
318 | self.cr.line_to(14, 11) | ||||
319 | if color is None: | ||||
320 | self.cr.set_operator(cairo.OPERATOR_CLEAR) | ||||
321 | else: | ||||
322 | self.cr.set_source_rgb(color[0], color[1], color[2]) | ||||
323 | self.cr.set_line_width(1.0) | ||||
324 | self.cr.stroke() | ||||
325 | | ||||
326 | def maximize_maximized(self, color=None): | ||||
327 | self.cr.move_to(4.5, 9) | ||||
328 | self.cr.line_to(9, 4.5) | ||||
329 | self.cr.line_to(13.5, 9) | ||||
330 | self.cr.line_to(9, 13.5) | ||||
331 | self.cr.close_path() | ||||
332 | if color is None: | ||||
333 | self.cr.set_operator(cairo.OPERATOR_CLEAR) | ||||
334 | else: | ||||
335 | self.cr.set_source_rgb(color[0], color[1], color[2]) | ||||
336 | self.cr.set_line_width(1.0) | ||||
337 | self.cr.stroke() | ||||
338 | | ||||
339 | def close(self, color=None): | ||||
340 | self.cr.move_to(5, 5) | ||||
341 | self.cr.line_to(13, 13) | ||||
342 | self.cr.move_to(13, 5) | ||||
343 | self.cr.line_to(5, 13) | ||||
344 | if color is None: | ||||
345 | self.cr.set_operator(cairo.OPERATOR_CLEAR) | ||||
346 | else: | ||||
347 | self.cr.set_source_rgb(color[0], color[1], color[2]) | ||||
348 | self.cr.set_line_width(1.0) | ||||
349 | self.cr.stroke() | ||||
350 | | ||||
351 | def save(self, filename): | ||||
352 | self.surface.write_to_png(os.path.join(assets_path, filename)) | ||||
353 | | ||||
354 | | ||||
355 | def check_items(color1, color2, state, alpha=1.0): | ||||
356 | for scl in [1, 2]: | ||||
357 | if scl == 2: | ||||
358 | ending = '@2.png' | ||||
359 | else: | ||||
360 | ending = '.png' | ||||
361 | # checkboxes | ||||
362 | box = Assets(20, 20, scl) | ||||
363 | box.rounded_rectancle('shadow', 18, 18, 2, 2, 3) | ||||
364 | box.rounded_rectancle(color2, 18, 18, 1, 1, 3) | ||||
365 | box.rounded_rectancle(color1, 18, 18, 1, 1, 3, alpha=alpha) | ||||
366 | box.rounded_rectancle(color2, 16, 16, 2, 2, 2) | ||||
367 | box.save('check-unchecked' + state + ending) | ||||
368 | if state != '': | ||||
369 | box.rounded_rectancle(color1, 12, 12, 4, 4, 1, alpha=alpha) | ||||
370 | box.save('check-checked' + state + ending) | ||||
371 | box.rounded_triangle(color2, 8, 8, 6, 6, 1, alpha=alpha) | ||||
372 | box.save('check-mixed' + state + ending) | ||||
373 | | ||||
374 | # radio | ||||
375 | radio = Assets(20, 20, scl) | ||||
376 | radio.circle('shadow', 11, 11, 9) | ||||
377 | radio.circle(color2, 10, 10, 9) | ||||
378 | radio.circle(color1, 10, 10, 9, alpha=alpha) | ||||
379 | radio.circle(color2, 10, 10, 8) | ||||
380 | radio.save('radio-unchecked' + state + ending) | ||||
381 | if state != '': | ||||
382 | radio.circle(color1, 10, 10, 6, alpha=alpha) | ||||
383 | radio.save('radio-checked' + state + ending) | ||||
384 | radio.half_circle(color2, 10, 10, 4, alpha=alpha) | ||||
385 | radio.save('radio-mixed' + state + ending) | ||||
386 | | ||||
387 | # selectionmode | ||||
388 | selectionmode = Assets(40, 40, scl) | ||||
389 | selectionmode.rounded_rectancle('shadow', 18, 18, 12, 12, 3) | ||||
390 | selectionmode.rounded_rectancle(color2, 18, 18, 11, 11, 3) | ||||
391 | selectionmode.rounded_rectancle(color1, 18, 18, 11, 11, 3, alpha=alpha) | ||||
392 | selectionmode.rounded_rectancle(color2, 16, 16, 12, 12, 2) | ||||
393 | selectionmode.save('check-selectionmode-unchecked' + state + ending) | ||||
394 | if state != '': | ||||
395 | selectionmode.rounded_rectancle( | ||||
396 | color1, 12, 12, 14, 14, 1, alpha=alpha) | ||||
397 | selectionmode.save('check-selectionmode-checked' + state + ending) | ||||
398 | | ||||
399 | | ||||
400 | def buttons(color1, color2, color3, state, alpha=1.0): | ||||
401 | button = Assets(20, 20) | ||||
402 | button.rounded_rectancle('shadow', 18, 18, 2, 2, 3) | ||||
403 | button.rounded_rectancle(color1, 18, 18, 1, 1, 3) | ||||
404 | button.rounded_rectancle(color2, 18, 18, 1, 1, 3, alpha=alpha) | ||||
405 | if state == '-active': | ||||
406 | button.rounded_rectancle(color3, 18, 18, 1, 1, 3, gradient=True) | ||||
407 | else: | ||||
408 | button.rounded_rectancle(color1, 16, 16, 2, 2, 2) | ||||
409 | button.rounded_rectancle(color3, 16, 16, 2, 2, 2, gradient=True) | ||||
410 | button.save('button' + state + '.png') | ||||
411 | | ||||
412 | | ||||
413 | def togglebuttons(color1, color2, color3, state, alpha=1.0): | ||||
414 | button = Assets(20, 20) | ||||
415 | button.rounded_rectancle(color1, 18, 18, 1, 1, 3) | ||||
416 | button.rounded_rectancle(color2, 18, 18, 1, 1, 3, alpha=alpha) | ||||
417 | if state == '-active': | ||||
418 | button.rounded_rectancle(color3, 18, 18, 1, 1, 3, gradient=True) | ||||
419 | else: | ||||
420 | button.rounded_rectancle(color1, 16, 16, 2, 2, 2) | ||||
421 | button.rounded_rectancle(color3, 16, 16, 2, 2, 2, gradient=True) | ||||
422 | button.save('togglebutton' + state + '.png') | ||||
423 | | ||||
424 | | ||||
425 | def scale_slider(color1, color2, color3, state, alpha=1.0): | ||||
426 | scale = Assets(20, 20) | ||||
427 | scale.circle(color1, 10, 10, 10) | ||||
428 | scale.circle(color2, 10, 10, 10, alpha=alpha) | ||||
429 | scale.circle(color1, 10, 10, 9) | ||||
430 | scale.circle(color3, 10, 10, 9, gradient=True) | ||||
431 | scale.save('scale-slider' + state + '.png') | ||||
432 | | ||||
433 | | ||||
434 | def scale_trough(color): | ||||
435 | trough_h = Assets(20, 20) | ||||
436 | trough_h.rounded_rectancle(color, 20, 6, 0, 7, 3) | ||||
437 | trough_h.save('scale-trough-horizontal.png') | ||||
438 | | ||||
439 | trough_h = Assets(20, 20) | ||||
440 | trough_h.rounded_rectancle(color, 6, 20, 7, 0, 3) | ||||
441 | trough_h.save('scale-trough-vertical.png') | ||||
442 | | ||||
443 | | ||||
444 | def tabs(color1, color2, state): | ||||
445 | if state == '-inactive': | ||||
446 | alpha = 0.2 | ||||
447 | else: | ||||
448 | alpha = 1.0 | ||||
449 | direction = ['-bottom', '-left', '-top', '-right'] | ||||
450 | for i in range(0, 4): | ||||
451 | tab = Assets(20, 20, rotation=i) | ||||
452 | tab.tab(color1, 20, 20, 0, 0, 3, alpha) | ||||
453 | if state == '-active': | ||||
454 | tab.tab(color2, 18, 19, 1, 0, 2) | ||||
455 | tab.save('tab' + direction[i] + state + '.png') | ||||
456 | | ||||
457 | | ||||
458 | def arrows(color, state, alpha=1.0): | ||||
459 | direction = ['-up', '-right', '-down', '-left'] | ||||
460 | for i in range(0, 4): | ||||
461 | arw = Assets(12, 12, rotation=i) | ||||
462 | arw.arrow(color, alpha) | ||||
463 | arw.save('arrow' + direction[i] + state + '.png') | ||||
464 | | ||||
465 | arw = Assets(8, 8, rotation=i) | ||||
466 | arw.arrow_small(color, alpha) | ||||
467 | arw.save('arrow-small' + direction[i] + state + '.png') | ||||
468 | | ||||
469 | | ||||
470 | def menu_arrow(color, state, alpha=1.0): | ||||
471 | arrow = Assets(12, 12, rotation=1) | ||||
472 | arrow.arrow(color, alpha) | ||||
473 | arrow.save('menu-arrow' + state + '.png') | ||||
474 | | ||||
475 | | ||||
476 | def scrollbar_slider(color1, color2, color3): | ||||
477 | for scl in [1, 2]: | ||||
478 | if scl == 2: | ||||
479 | ending = '@2.png' | ||||
480 | else: | ||||
481 | ending = '.png' | ||||
482 | slider = Assets(30, 20, scl) | ||||
483 | slider.rounded_rectancle(color1, 30, 10, 0, 5, 5, 1) | ||||
484 | slider.save('scrollbar-slider-horizontal-active' + ending) | ||||
485 | | ||||
486 | slider = Assets(30, 20, scl) | ||||
487 | slider.rounded_rectancle(color2, 30, 6, 0, 7, 3, 1) | ||||
488 | slider.save('scrollbar-slider-horizontal-hover' + ending) | ||||
489 | | ||||
490 | slider = Assets(30, 20, scl) | ||||
491 | slider.rounded_rectancle(color3, 30, 6, 0, 7, 3, 1) | ||||
492 | slider.save('scrollbar-slider-horizontal' + ending) | ||||
493 | | ||||
494 | slider = Assets(20, 30, scl) | ||||
495 | slider.rounded_rectancle(color1, 10, 30, 5, 0, 5, 1) | ||||
496 | slider.save('scrollbar-slider-vertical-active' + ending) | ||||
497 | | ||||
498 | slider = Assets(20, 30, scl) | ||||
499 | slider.rounded_rectancle(color2, 6, 30, 7, 0, 3, 1) | ||||
500 | slider.save('scrollbar-slider-vertical-hover' + ending) | ||||
501 | | ||||
502 | slider = Assets(20, 30, scl) | ||||
503 | slider.rounded_rectancle(color3, 6, 30, 7, 0, 3, 1) | ||||
504 | slider.save('scrollbar-slider-vertical' + ending) | ||||
505 | | ||||
506 | | ||||
507 | def scrollbar_trough(color): | ||||
508 | for scl in [1, 2]: | ||||
509 | if scl == 2: | ||||
510 | ending = '@2.png' | ||||
511 | else: | ||||
512 | ending = '.png' | ||||
513 | trough = Assets(56, 20, scl) | ||||
514 | trough.rounded_rectancle(color, 49, 6, 3.5, 7, 3, 0.3) | ||||
515 | trough.save('scrollbar-trough-horizontal' + ending) | ||||
516 | | ||||
517 | trough = Assets(20, 56, scl) | ||||
518 | trough.rounded_rectancle(color, 6, 49, 7, 3.5, 3, 0.3) | ||||
519 | trough.save('scrollbar-trough-vertical' + ending) | ||||
520 | | ||||
521 | | ||||
522 | def titlebuttons(color1, color2, state): | ||||
523 | for scl in [1, 2]: | ||||
524 | if scl == 2: | ||||
525 | ending = '@2.png' | ||||
526 | else: | ||||
527 | ending = '.png' | ||||
528 | title_minimize = Assets(18, 18, scl) | ||||
529 | title_maximize = Assets(18, 18, scl) | ||||
530 | title_maximized = Assets(18, 18, scl) | ||||
531 | if state == '' or state == '-backdrop': | ||||
532 | title_minimize.minimize(color1) | ||||
533 | title_maximize.maximize(color1) | ||||
534 | title_maximized.maximize_maximized(color1) | ||||
535 | else: | ||||
536 | title_minimize.circle(color1, 9, 9, 9) | ||||
537 | title_maximize.circle(color1, 9, 9, 9) | ||||
538 | title_maximized.circle(color1, 9, 9, 9) | ||||
539 | title_minimize.minimize() | ||||
540 | title_maximize.maximize() | ||||
541 | title_maximized.maximize_maximized() | ||||
542 | title_minimize.save('titlebutton-minimize' + state + ending) | ||||
543 | title_maximize.save('titlebutton-maximize' + state + ending) | ||||
544 | title_maximized.save('titlebutton-maximize-maximized' + state + ending) | ||||
545 | | ||||
546 | title_close = Assets(18, 18, scl) | ||||
547 | title_close.circle(color2, 9, 9, 9) | ||||
548 | title_close.close() | ||||
549 | title_close.save('titlebutton-close' + state + ending) | ||||
550 | | ||||
551 | | ||||
552 | def entry(color1, color2, color3, state, alpha=1.0): | ||||
553 | entry = Assets(20, 20) | ||||
554 | entry.background(color1) | ||||
555 | entry.rounded_rectancle(color2, 18, 18, 1, 1, 3, alpha=alpha) | ||||
556 | entry.rounded_rectancle(color3, 16, 16, 2, 2, 2) | ||||
557 | entry.rounded_rectancle(color3, 16, 16, 2, 2, 2) | ||||
558 | entry.save('entry' + state + '.png') | ||||
559 | | ||||
560 | entry = Assets(20, 20, rotation=1) | ||||
561 | entry.background(color1) | ||||
562 | entry.tab(color2, 18, 19, 1, 0, 3, alpha=alpha) | ||||
563 | entry.tab(color3, 16, 18, 2, 0, 2) | ||||
564 | entry.save('combo-entry' + state + '.png') | ||||
565 | | ||||
566 | entry_button = Assets(20, 20, rotation=3) | ||||
567 | entry_button.background(color1) | ||||
568 | entry_button.tab(color2, 18, 19, 1, 0, 3, alpha=alpha) | ||||
569 | entry_button.tab(color3, 16, 18, 2, 0, 2) | ||||
570 | entry_button.save('combo-entry-button' + state + '.png') | ||||
571 | | ||||
572 | if state != '-active': | ||||
573 | direction = ['-down', '-down-rtl', '-up-rtl', '-up'] | ||||
574 | for i in range(0, 4): | ||||
575 | spin = Assets(20, 20, rotation=i) | ||||
576 | spin.background(color1) | ||||
577 | spin.spinbutton(color2, 19, 19, 0, 0, 3, alpha=alpha) | ||||
578 | spin.spinbutton(color3, 18, 18, 0, 0, 2) | ||||
579 | spin.save('spinbutton' + direction[i] + state + '.png') | ||||
580 | | ||||
581 | | ||||
582 | def mixed(color1, color2, color3): | ||||
583 | nll = Assets(20, 20) | ||||
584 | nll.save('null.png') | ||||
585 | | ||||
586 | # Frame | ||||
587 | frame = Assets(20, 20) | ||||
588 | frame.rounded_rectancle(color1, 20, 20, 0, 0, 3) | ||||
589 | frame.rounded_rectancle(color2, 18, 18, 1, 1, 2) | ||||
590 | frame.save('frame.png') | ||||
591 | | ||||
592 | # Tree header | ||||
593 | header = Assets(20, 20) | ||||
594 | header.background(color2) | ||||
595 | header.line(color1, 0, 19, 20, 1) | ||||
596 | header.line(color1, 19, 0, 1, 20) | ||||
597 | header.save('tree-header.png') | ||||
598 | | ||||
599 | # Notebook gap | ||||
600 | notebook_gap = Assets(4, 2) | ||||
601 | notebook_gap.line(color2, 1, 0, 2, 2) | ||||
602 | notebook_gap.save('notebook-gap-horizontal.png') | ||||
603 | | ||||
604 | notebook_gap = Assets(2, 4) | ||||
605 | notebook_gap.line(color2, 0, 1, 2, 2) | ||||
606 | notebook_gap.save('notebook-gap-vertical.png') | ||||
607 | | ||||
608 | # Notebook frame | ||||
609 | direction = ['-top', '-right', '-bottom', '-bottom'] | ||||
610 | for i in range(0, 4): | ||||
611 | notebook_frame = Assets(20, 20, rotation=i) | ||||
612 | notebook_frame.notebook(color1, 20, 20, 0, 0, 3) | ||||
613 | notebook_frame.notebook(color2, 18, 18, 1, 1, 2) | ||||
614 | notebook_frame.save('notebook-frame' + direction[i] + '.png') | ||||
615 | | ||||
616 | # Frame gap | ||||
617 | frame_gap = Assets(2, 1) | ||||
618 | frame_gap.line(color1, 1, 0, 1, 1) | ||||
619 | frame_gap.save('frame-gap-start.png') | ||||
620 | | ||||
621 | frame_gap = Assets(2, 1) | ||||
622 | frame_gap.line(color1, 0, 0, 1, 1) | ||||
623 | frame_gap.save('frame-gap-end.png') | ||||
624 | | ||||
625 | # Lines | ||||
626 | lines = Assets(20, 1) | ||||
627 | lines.line(color1, 0, 0, 20, 1) | ||||
628 | lines.save('line-h.png') | ||||
629 | | ||||
630 | lines = Assets(1, 20) | ||||
631 | lines.line(color1, 0, 0, 1, 20) | ||||
632 | lines.save('line-v.png') | ||||
633 | | ||||
634 | lines = Assets(20, 1) | ||||
635 | lines.line(color2, 0, 0, 20, 1) | ||||
636 | lines.save('handle-h.png') | ||||
637 | | ||||
638 | lines = Assets(1, 20) | ||||
639 | lines.line(color2, 0, 0, 1, 20) | ||||
640 | lines.save('handle-v.png') | ||||
641 | | ||||
642 | menubar = Assets(20, 20) | ||||
643 | menubar.line(color3, 1, 1, 18, 18) | ||||
644 | menubar.save('menubar-button.png') | ||||
645 | | ||||
646 | | ||||
647 | def toolbar(color1, color2, color3): | ||||
648 | # Toolbar background | ||||
649 | bar = Assets(20, 20) | ||||
650 | bar.background(color2) | ||||
651 | bar.save('toolbar-background.png') | ||||
652 | | ||||
653 | # Toolbutton toggled | ||||
654 | toolbutton = Assets(20, 20) | ||||
655 | toolbutton.rounded_rectancle(color1, 18, 18, 1, 1, 3) | ||||
656 | toolbutton.save('toolbutton-toggled.png') | ||||
657 | | ||||
658 | # Toolbutton hover | ||||
659 | toolbutton = Assets(20, 20) | ||||
660 | toolbutton.rounded_rectancle(color3, 18, 18, 1, 1, 3) | ||||
661 | toolbutton.rounded_rectancle(color2, 16, 16, 2, 2, 2) | ||||
662 | toolbutton.save('toolbutton-hover.png') | ||||
663 | | ||||
664 | # Toolbutton active | ||||
665 | toolbutton = Assets(20, 20) | ||||
666 | toolbutton.rounded_rectancle(color3, 18, 18, 1, 1, 3) | ||||
667 | toolbutton.save('toolbutton-active.png') | ||||
668 | | ||||
669 | | ||||
670 | def progressbar(color1, color2, state=''): | ||||
671 | bar = Assets(10, 10) | ||||
672 | bar.rounded_rectancle(color1, 10, 10, 0, 0, 3) | ||||
673 | bar.save('progressbar-bar' + state + '.png') | ||||
674 | | ||||
675 | trough = Assets(10, 10) | ||||
676 | trough.rounded_rectancle(color2, 10, 10, 0, 0, 3) | ||||
677 | trough.save('progressbar-trough' + state + '.png') | ||||
678 | | ||||
679 | | ||||
680 | def html(color): | ||||
681 | return '#%02x%02x%02x' % (int(color[0]*255), | ||||
682 | int(color[1]*255), | ||||
683 | int(color[2]*255)) | ||||
684 | | ||||
685 | | ||||
686 | def mix(color, mix_color, amount): | ||||
687 | r = color[0] * amount + mix_color[0] * (1 - amount) | ||||
688 | g = color[1] * amount + mix_color[1] * (1 - amount) | ||||
689 | b = color[2] * amount + mix_color[2] * (1 - amount) | ||||
690 | return (r, g, b) | ||||
691 | # ___________________________________________________________________________________ | ||||
692 | | ||||
693 | | ||||
694 | parser = argparse.ArgumentParser( | ||||
695 | description='Generates Breeze assets according to the specified color ' | ||||
696 | 'scheme.') | ||||
697 | parser.add_argument('--colorscheme', '-c', action='store', | ||||
698 | default=expanduser("~/.config/kdeglobals"), | ||||
699 | help='color scheme to use') | ||||
700 | parser.add_argument('--basecolorscheme', '-b', action='store', | ||||
701 | default='/usr/share/color-schemes/Breeze.colors', | ||||
702 | help='base color scheme') | ||||
703 | parser.add_argument('--colorschemename', '-n', action='store', | ||||
704 | default='Breeze', help='Display name of colourscheme.') | ||||
705 | parser.add_argument('--assets-dir', '-a', action='store', | ||||
706 | default=expanduser("~/.local/share/themes/Breeze 🎨/assets"), | ||||
707 | help='location of the directory to place assets') | ||||
708 | parser.add_argument('--gtk2-dir', '-g', action='store', default=expanduser("~/.local/share/themes/Breeze 🎨/gtk-2.0"), | ||||
709 | help='location of gtk2 directory to define the color ' | ||||
710 | 'scheme variables') | ||||
711 | parser.add_argument('--gtk3-scss-dir', '-G', action='store', default='.', | ||||
712 | help='location of global.scss to define the color ' | ||||
713 | 'scheme variables') | ||||
714 | | ||||
715 | args = parser.parse_args() | ||||
716 | | ||||
717 | assets_path = args.assets_dir | ||||
718 | if assets_path == expanduser("~/.local/share/themes/Breeze 🎨/assets"): | ||||
719 | assets_path = expanduser("~/.local/share/themes/Breeze (Colourscheme: {})/assets".format(args.colorschemename)) | ||||
720 | | ||||
721 | gtk2_dir = args.gtk2_dir | ||||
722 | if gtk2_dir == expanduser("~/.local/share/themes/Breeze 🎨/gtk-2.0"): | ||||
723 | gtk2_dir = expanduser("~/.local/share/themes/Breeze (Colourscheme: {})/gtk-2.0".format(args.colorschemename)) | ||||
724 | | ||||
725 | make_sure_path_exists(assets_path) | ||||
726 | make_sure_path_exists(gtk2_dir) | ||||
727 | | ||||
728 | _colors = ReadKdeGlobals(args.basecolorscheme).read_globals(args.colorscheme) | ||||
729 | | ||||
730 | border_color = Color(_colors, 'WindowBackgroundNormal', | ||||
731 | 'WindowForegroundNormal', 0.75) | ||||
732 | window_bg = Color(_colors, 'WindowBackgroundNormal') | ||||
733 | window_fg = Color(_colors, 'WindowForegroundNormal') | ||||
734 | check_color = Color(_colors, 'WindowBackgroundNormal', | ||||
735 | 'WindowForegroundNormal', 0.5) | ||||
736 | button_bg = Color(_colors, 'ButtonBackgroundNormal') | ||||
737 | button_fg = Color(_colors, 'ButtonForegroundNormal') | ||||
738 | button_hover = Color(_colors, 'ButtonDecorationHover') | ||||
739 | button_active = Color(_colors, 'ButtonDecorationFocus') | ||||
740 | selection_bg = Color(_colors, 'SelectionBackgroundNormal') | ||||
741 | selection_fg = Color(_colors, 'SelectionForegroundNormal') | ||||
742 | view_bg = Color(_colors, 'ViewBackgroundNormal') | ||||
743 | view_fg = Color(_colors, 'ViewForegroundNormal') | ||||
744 | view_hover = Color(_colors, 'ViewDecorationHover') | ||||
745 | view_active = Color(_colors, 'ViewDecorationFocus') | ||||
746 | titlebutton = Color(_colors, 'WMactiveForeground') | ||||
747 | titlebutton_active = Color(_colors, 'WMactiveForeground') | ||||
748 | closebutton_hover = Color(_colors, 'ViewForegroundNegative') | ||||
749 | closebutton_hover.lighten_color(0.5) | ||||
750 | closebutton_active = Color(_colors, 'ViewForegroundNegative') | ||||
751 | titlebutton_inactive = Color(_colors, 'WMinactiveForeground') | ||||
752 | titlebutton_inactive_active = Color(_colors, 'WMinactiveForeground') | ||||
753 | tooltip_fg = Color(_colors, 'TooltipForegroundNormal') | ||||
754 | tooltip_bg = Color(_colors, 'TooltipBackgroundNormal') | ||||
755 | | ||||
756 | check_items(check_color.rgb, window_bg.rgb, '') | ||||
757 | check_items(button_hover.rgb, window_bg.rgb, '-hover') | ||||
758 | check_items(button_active.rgb, window_bg.rgb, '-active') | ||||
759 | check_items(check_color.insensitive, window_bg.rgb, | ||||
760 | '-insensitive', border_color.insensitive_alpha) | ||||
761 | check_items(check_color.inactive, window_bg.rgb, | ||||
762 | '-backdrop', border_color.inactive_alpha) | ||||
763 | check_items(check_color.inactive_insensitive, window_bg.rgb, | ||||
764 | '-backdrop-insensitive', border_color.inactive_insensitive_alpha) | ||||
765 | | ||||
766 | buttons(window_bg.rgb, border_color.rgb, button_bg.gradient(), '') | ||||
767 | buttons(window_bg.rgb, button_hover.rgb, button_bg.gradient(), '-hover') | ||||
768 | buttons(window_bg.rgb, button_hover.rgb, | ||||
769 | button_hover.gradient('active'), '-active') | ||||
770 | buttons(window_bg.rgb, border_color.rgb, | ||||
771 | button_bg.gradient(alpha=button_bg.insensitive_alpha), '-insensitive', | ||||
772 | border_color.insensitive_alpha) | ||||
773 | | ||||
774 | togglebuttons(window_bg.rgb, border_color.rgb, button_bg.gradient(), '') | ||||
775 | togglebuttons(window_bg.rgb, button_hover.rgb, button_bg.gradient(), '-hover') | ||||
776 | togglebuttons(window_bg.rgb, button_hover.rgb, | ||||
777 | button_hover.gradient('active'), '-active') | ||||
778 | togglebuttons(window_bg.rgb, border_color.rgb, | ||||
779 | button_bg.gradient(alpha=button_bg.insensitive_alpha), | ||||
780 | '-insensitive', border_color.insensitive_alpha) | ||||
781 | | ||||
782 | scale_slider(window_bg.rgb, border_color.rgb, button_bg.gradient(), '') | ||||
783 | scale_slider(window_bg.rgb, button_hover.rgb, button_bg.gradient(), '-hover') | ||||
784 | scale_slider(window_bg.rgb, button_active.rgb, button_bg.gradient(), '-active') | ||||
785 | scale_slider(window_bg.rgb, border_color.rgb, | ||||
786 | button_bg.gradient(alpha=button_bg.insensitive_alpha), | ||||
787 | '-insensitive', border_color.insensitive_alpha) | ||||
788 | scale_trough(border_color.rgb) | ||||
789 | | ||||
790 | tabs(border_color.rgb, window_bg.rgb, '-active') | ||||
791 | tabs(window_fg.rgb, window_bg.rgb, '-inactive') | ||||
792 | | ||||
793 | arrows(button_fg.rgb, '') | ||||
794 | arrows(button_hover.rgb, '-hover') | ||||
795 | arrows(button_active.rgb, '-active') | ||||
796 | arrows(button_fg.insensitive, '-insensitive', button_fg.insensitive_alpha) | ||||
797 | menu_arrow(window_fg.rgb, '') | ||||
798 | menu_arrow(selection_fg.rgb, '-selected') | ||||
799 | menu_arrow(window_fg.insensitive, '-insensitive', window_fg.insensitive_alpha) | ||||
800 | | ||||
801 | scrollbar_slider(button_active.rgb, button_hover.rgb, button_active.rgb) | ||||
802 | scrollbar_trough(window_fg.rgb) | ||||
803 | | ||||
804 | titlebuttons(titlebutton.rgb, titlebutton.rgb, '') | ||||
805 | titlebuttons(titlebutton.rgb, closebutton_hover.rgb, '-hover') | ||||
806 | titlebuttons(titlebutton_active.rgb, closebutton_active.rgb, '-active') | ||||
807 | titlebuttons(titlebutton_inactive.rgb, titlebutton_inactive.rgb, '-backdrop') | ||||
808 | titlebuttons(titlebutton_inactive.rgb, | ||||
809 | closebutton_hover.rgb, '-hover-backdrop') | ||||
810 | titlebuttons(titlebutton_inactive_active.rgb, | ||||
811 | closebutton_active.rgb, '-active-backdrop') | ||||
812 | | ||||
813 | entry(window_bg.rgb, border_color.rgb, view_bg.rgb, '') | ||||
814 | entry(window_bg.rgb, view_active.rgb, view_bg.rgb, '-active') | ||||
815 | entry(window_bg.rgb, border_color.insensitive, None, | ||||
816 | '-insensitive', border_color.insensitive_alpha) | ||||
817 | | ||||
818 | progressbar(selection_bg.rgb, mix(window_fg.rgb, window_bg.rgb, 0.3)) | ||||
819 | | ||||
820 | mixed(border_color.rgb, window_bg.rgb, button_active.rgb) | ||||
821 | | ||||
822 | toolbar(border_color.rgb, window_bg.rgb, button_hover.rgb) | ||||
823 | | ||||
824 | gtk2 = open(os.path.join(gtk2_dir, 'gtkrc'), 'w') | ||||
825 | gtk2.write( | ||||
826 | '# Theme: Breeze-gtk\n' | ||||
827 | '# Description: Breeze theme for GTK+2.0\n' | ||||
828 | '\n' | ||||
829 | 'gtk-color-scheme = "text_color:' + html(window_fg.rgb) + '"\n' | ||||
830 | 'gtk-color-scheme = "base_color:' + html(view_bg.rgb) + '"\n' | ||||
831 | 'gtk-color-scheme = "insensitive_base_color:' + | ||||
832 | html(view_bg.insensitive) + '"\n' | ||||
833 | 'gtk-color-scheme = "fg_color:' + html(window_fg.rgb) + '"\n' | ||||
834 | 'gtk-color-scheme = "bg_color:' + html(window_bg.rgb) + '"\n' | ||||
835 | 'gtk-color-scheme = "selected_fg_color:' + html(selection_fg.rgb) + '"\n' | ||||
836 | 'gtk-color-scheme = "selected_bg_color:' + html(selection_bg.rgb) + '"\n' | ||||
837 | 'gtk-color-scheme = "button_fg_color:' + html(button_fg.rgb) + '"\n' | ||||
838 | 'gtk-color-scheme = "tooltip_fg_color:' + html(tooltip_fg.rgb) + '"\n' | ||||
839 | 'gtk-color-scheme = "tooltip_bg_color:' + html(tooltip_bg.rgb) + '"\n' | ||||
840 | 'gtk-color-scheme = "insensitive_fg_color:' + | ||||
841 | html(mix(window_fg.insensitive, window_bg.rgb, | ||||
842 | window_fg.insensitive_alpha)) + '"\n' | ||||
843 | 'gtk-color-scheme = "insensitive_text_color:' + | ||||
844 | html(mix(view_fg.insensitive, view_bg.rgb, | ||||
845 | view_fg.insensitive_alpha)) + '"\n' | ||||
846 | 'gtk-color-scheme = "button_insensitive_fg_color:' + | ||||
847 | html(mix(button_fg.insensitive, button_bg.rgb, | ||||
848 | button_fg.insensitive_alpha)) + '"\n' | ||||
849 | 'gtk-color-scheme = "button_active:' + html(button_active.rgb) + '"\n' | ||||
850 | 'gtk-color-scheme = "border_color:' + html(border_color.rgb) + '"\n' | ||||
851 | '\n' | ||||
852 | 'include "widgets/default"\n' | ||||
853 | 'include "widgets/buttons"\n' | ||||
854 | 'include "widgets/menu"\n' | ||||
855 | 'include "widgets/entry"\n' | ||||
856 | 'include "widgets/notebook"\n' | ||||
857 | 'include "widgets/range"\n' | ||||
858 | 'include "widgets/scrollbar"\n' | ||||
859 | 'include "widgets/toolbar"\n' | ||||
860 | 'include "widgets/progressbar"\n' | ||||
861 | 'include "widgets/misc"\n' | ||||
862 | 'include "widgets/styles"\n' | ||||
863 | ) | ||||
864 | gtk2.close() | ||||
865 | | ||||
866 | try: | ||||
867 | with open(expanduser("~/.config/breeze-gtk2-last-location"), "r") as file: | ||||
868 | for line in file: | ||||
869 | shutil.rmtree(pathlib.Path(line)) | ||||
870 | except: | ||||
871 | pass | ||||
872 | | ||||
873 | shutil.copytree("/usr/share/themes/Breeze/gtk-2.0/widgets", expanduser("~/.local/share/themes/Breeze (Colourscheme: {})/gtk-2.0/widgets".format(args.colorschemename))) | ||||
874 | | ||||
875 | with open(expanduser("~/.config/breeze-gtk2-last-location"), "w+") as file: | ||||
876 | file.write(expanduser("~/.local/share/themes/Breeze (Colourscheme: {})/".format(args.colorschemename))) | ||||
877 | No newline at end of file |