├── README.md
└── Workflow
├── DBDC800C-892D-4517-833A-8ABC465E948E.png
├── F29DB020-E6BD-4876-8E0C-26A9877DD1C2.png
├── add_swatch.png
├── add_swatch.py
├── back.png
├── defaults
├── swatch.json
└── swatch_icons
│ ├── 1E1F29.png
│ ├── 343648.png
│ ├── 50FA7B.png
│ ├── BD93F9.png
│ ├── E2E2E2.png
│ ├── FC5DBA.png
│ ├── FFB86C.png
│ ├── background.png
│ └── foreground.png
├── delete_swatch.py
├── done.png
├── emoji_to_png.py
├── icon.png
├── info.plist
├── mask.png
├── mask_high.png
├── mask_low.png
├── mask_medium.png
├── options_menu.py
├── prefs.plist
├── swatch_picker.py
├── use_bg_no.png
└── use_bg_yes.png
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # Alfred Icon Generator
4 | Icon Generator will quickly convert an SF Symbol or Emoji to .png for use in workflows.
5 | It has some nice options for adjusting appearance including a configurable colour palette.
6 |
7 | Download: [GitHub](https://github.com/NeighNeighNeigh/Alfred_IconGenerator/releases/latest) | [Alfred Gallery](https://alfred.app/workflows/floatingpoint/icon-generator/)
8 |
9 |
10 | ## Dependencies:
11 | - SF Symbols - https://developer.apple.com/sf-symbols/
12 | - ImageMagick (available via Homebrew)
13 | - Pillow for Python (available via Homebrew)
14 |
15 | (Note: the latter two dependencies can be handled by Alfred if you are installing through the [Alfred Gallery](https://alfred.app/workflows/floatingpoint/icon-generator/))
16 |
17 | ## Usage
18 | Start by copying an emoji, or an icon in the SF Symbols app.
19 |
20 |
21 |
22 | Convert it to PNG with the icon generator keyword. The result will be in your clipboard.
23 |
24 |
25 |
26 | Alternatively, select the emoji or icon and use the [Universal Action](https://www.alfredapp.com/help/features/universal-actions/).
27 |
28 |
29 |
30 | You can then paste directly into Alfred.
31 |
32 |
33 |
34 | Hold option when running Icon Generator to configure the icon's appearance
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | ## Acknowledgements
45 |
46 | The SF Symbols portion of this workflow was originally adapted from work by Mark Gavin - https://labs.appligent.com/pdfblog/convert-sf-symbols-to-images/
47 |
48 | This wouldn't be possible without the help of user Vitor from the Alfred forum.
49 |
--------------------------------------------------------------------------------
/Workflow/DBDC800C-892D-4517-833A-8ABC465E948E.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/DBDC800C-892D-4517-833A-8ABC465E948E.png
--------------------------------------------------------------------------------
/Workflow/F29DB020-E6BD-4876-8E0C-26A9877DD1C2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/F29DB020-E6BD-4876-8E0C-26A9877DD1C2.png
--------------------------------------------------------------------------------
/Workflow/add_swatch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/add_swatch.png
--------------------------------------------------------------------------------
/Workflow/add_swatch.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 |
3 | import json
4 | import os
5 | import sys
6 |
7 |
8 | # Set input path
9 | json_path = os.path.join(os.getenv("alfred_workflow_data"), "swatch.json")
10 |
11 | # Strip trailing line from input hex color value
12 | new_colour = sys.argv[1].rstrip()
13 |
14 | # Read the JSON data from the file
15 | with open(json_path) as json_file:
16 | data = json.load(json_file)
17 |
18 | # New entry to be added
19 | new_entry = {
20 | "title": "#" + new_colour,
21 | "arg": "#" + new_colour,
22 | "icon": {
23 | "path": new_colour + ".png"
24 | }
25 | }
26 |
27 | # Check for duplicate entry
28 | for item in data["items"]:
29 | if item["title"] == new_entry["title"] or item["arg"] == new_entry["arg"]:
30 | raise ValueError("Duplicate entry found")
31 |
32 | # Append the new entry to the beginning of the list of items
33 | data["items"].insert(0, new_entry)
34 |
35 | # Convert the updated data back to JSON string
36 | json_data = json.dumps(data, indent=4)
37 |
38 | # Print the updated JSON string
39 | # print(json_data)
40 |
41 | # Save the updated data back to the file
42 | with open(json_path, 'w') as json_file:
43 | json_file.write(json_data)
44 |
45 | #output the hex value
46 | sys.stdout.write(new_colour)
47 |
--------------------------------------------------------------------------------
/Workflow/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/back.png
--------------------------------------------------------------------------------
/Workflow/defaults/swatch.json:
--------------------------------------------------------------------------------
1 | {"items": [{"title": "#FC5DBA", "arg": "#FC5DBA", "icon": {"path": "FC5DBA.png"}}, {"title": "#50FA7B", "arg": "#50FA7B", "icon": {"path": "50FA7B.png"}}, {"title": "#BD93F9", "arg": "#BD93F9", "icon": {"path": "BD93F9.png"}}, {"title": "#FFB86C", "arg": "#FFB86C", "icon": {"path": "FFB86C.png"}}, {"title": "#E2E2E2", "arg": "#E2E2E2", "icon": {"path": "E2E2E2.png"}}, {"title": "#343648", "arg": "#343648", "icon": {"path": "343648.png"}}, {"title": "#1E1F29", "arg": "#1E1F29", "icon": {"path": "1E1F29.png"}}]}
--------------------------------------------------------------------------------
/Workflow/defaults/swatch_icons/1E1F29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/defaults/swatch_icons/1E1F29.png
--------------------------------------------------------------------------------
/Workflow/defaults/swatch_icons/343648.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/defaults/swatch_icons/343648.png
--------------------------------------------------------------------------------
/Workflow/defaults/swatch_icons/50FA7B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/defaults/swatch_icons/50FA7B.png
--------------------------------------------------------------------------------
/Workflow/defaults/swatch_icons/BD93F9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/defaults/swatch_icons/BD93F9.png
--------------------------------------------------------------------------------
/Workflow/defaults/swatch_icons/E2E2E2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/defaults/swatch_icons/E2E2E2.png
--------------------------------------------------------------------------------
/Workflow/defaults/swatch_icons/FC5DBA.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/defaults/swatch_icons/FC5DBA.png
--------------------------------------------------------------------------------
/Workflow/defaults/swatch_icons/FFB86C.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/defaults/swatch_icons/FFB86C.png
--------------------------------------------------------------------------------
/Workflow/defaults/swatch_icons/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/defaults/swatch_icons/background.png
--------------------------------------------------------------------------------
/Workflow/defaults/swatch_icons/foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/defaults/swatch_icons/foreground.png
--------------------------------------------------------------------------------
/Workflow/delete_swatch.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 |
3 | import json
4 | import sys
5 | import os
6 |
7 | def delete_entry_by_title(json_data, title):
8 | # Load the JSON data
9 | data = json.loads(json_data)
10 |
11 | # Iterate over the list of items and remove the matching entry
12 | for idx, item in enumerate(data['items']):
13 | if item['title'] == title:
14 | data['items'].pop(idx)
15 | break
16 |
17 | # Serialize the modified JSON data back to a string
18 | modified_json_data = json.dumps(data)
19 |
20 | return modified_json_data
21 |
22 | # Define the path to the source JSON file as a variable
23 | source_json_file = os.path.join(os.getenv("alfred_workflow_data"), "swatch.json")
24 |
25 | # Read JSON data from the file
26 | with open(source_json_file, 'r') as file:
27 | json_data = file.read()
28 |
29 | title_to_delete = sys.argv[1]
30 |
31 | modified_json_data = delete_entry_by_title(json_data, title_to_delete)
32 |
33 | # Save the modified JSON data back to the file
34 | with open(source_json_file, 'w') as file:
35 | file.write(modified_json_data)
36 |
37 | # Now lets delete the .pngs
38 |
39 |
40 | hex_code = title_to_delete.lstrip("#")
41 | folder_path = os.path.join(os.getenv("alfred_workflow_data"), "swatch_icons")
42 |
43 | files = os.listdir(folder_path)
44 | files_to_delete = [file for file in files if file.startswith(hex_code) and file.lower().endswith(".png")]
45 |
46 | for file in files_to_delete:
47 | file_path = os.path.join(folder_path, file)
48 | os.remove(file_path)
49 |
--------------------------------------------------------------------------------
/Workflow/done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/done.png
--------------------------------------------------------------------------------
/Workflow/emoji_to_png.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 |
3 | import os
4 | import sys
5 | from PIL import Image, ImageDraw, ImageFont
6 |
7 | glyph = os.getenv("glyph")
8 | output = os.getenv("output")
9 |
10 | back_ground_color = (50, 50, 50, 0)
11 | width, height = 160,160
12 | im = Image.new("RGBA", (width, height), back_ground_color)
13 | draw = ImageDraw.Draw(im)
14 |
15 | draw.text((width/2, height/2+25), glyph, font=ImageFont.truetype('/System/Library/Fonts/Apple Color Emoji.ttc', 160), anchor="mm", embedded_color=True)
16 |
17 | im.save(output, 'PNG')
--------------------------------------------------------------------------------
/Workflow/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/icon.png
--------------------------------------------------------------------------------
/Workflow/info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | bundleid
6 | neigh.alfred.icon_generator
7 | connections
8 |
9 | 029F3070-B55D-4A1D-A2B3-8EF75B13421F
10 |
11 |
12 | destinationuid
13 | 14A5240F-C023-445D-A08B-211F7D92121F
14 | modifiers
15 | 0
16 | modifiersubtext
17 |
18 | sourceoutputuid
19 | 4CF711AD-8D76-44E8-9102-28E91CD3CD0B
20 | vitoclose
21 |
22 |
23 |
24 | destinationuid
25 | ADD1A137-8B4B-4EFB-AF24-2899F98A95D2
26 | modifiers
27 | 0
28 | modifiersubtext
29 |
30 | vitoclose
31 |
32 |
33 |
34 | 0F112DB8-4F31-4419-B64F-4D2F22C5CE9E
35 |
36 |
37 | destinationuid
38 | DBDC800C-892D-4517-833A-8ABC465E948E
39 | modifiers
40 | 0
41 | modifiersubtext
42 |
43 | vitoclose
44 |
45 |
46 |
47 | 14A5240F-C023-445D-A08B-211F7D92121F
48 |
49 |
50 | destinationuid
51 | 396BF2BF-6D79-4B0E-8811-012F443313AA
52 | modifiers
53 | 0
54 | modifiersubtext
55 |
56 | vitoclose
57 |
58 |
59 |
60 | 28436EEC-BCBE-420A-9366-B327D94A1814
61 |
62 |
63 | destinationuid
64 | 7AEC5654-124E-4EA5-9B6C-AA1AB9BC2F44
65 | modifiers
66 | 0
67 | modifiersubtext
68 |
69 | vitoclose
70 |
71 |
72 |
73 | 2AF6EB83-6A8A-488B-AB9D-12360650E4F6
74 |
75 |
76 | destinationuid
77 | 35D5B2B4-CF89-4A0C-8B33-6DA5CC4DF20F
78 | modifiers
79 | 0
80 | modifiersubtext
81 |
82 | vitoclose
83 |
84 |
85 |
86 | 2B4E492B-764C-4C73-8A11-328F6C462371
87 |
88 |
89 | destinationuid
90 | 060CD21A-B296-472F-8FA8-F84CE56AB574
91 | modifiers
92 | 0
93 | modifiersubtext
94 |
95 | vitoclose
96 |
97 |
98 |
99 | 2CDF706A-DA6A-4E59-BCD2-9C2556317289
100 |
101 |
102 | destinationuid
103 | 3B30AC28-EEEA-488E-9D0D-5F425B15548B
104 | modifiers
105 | 0
106 | modifiersubtext
107 |
108 | sourceoutputuid
109 | DEA52482-40E6-4E85-8B9C-B96806A95F16
110 | vitoclose
111 |
112 |
113 |
114 | 306B2655-B8A6-48EA-A6E6-1E2204F46CB7
115 |
116 |
117 | destinationuid
118 | 2AF6EB83-6A8A-488B-AB9D-12360650E4F6
119 | modifiers
120 | 0
121 | modifiersubtext
122 |
123 | vitoclose
124 |
125 |
126 |
127 | 3A3F894D-00E7-4283-8996-3B119ABC6E3D
128 |
129 |
130 | destinationuid
131 | 28436EEC-BCBE-420A-9366-B327D94A1814
132 | modifiers
133 | 0
134 | modifiersubtext
135 |
136 | vitoclose
137 |
138 |
139 |
140 | 4D7F6811-5901-44B6-A4B1-C56E98CC0C99
141 |
142 |
143 | destinationuid
144 | 76557CB6-CADE-4EFD-97EE-C519C1511CED
145 | modifiers
146 | 0
147 | modifiersubtext
148 |
149 | vitoclose
150 |
151 |
152 |
153 | 4E50EE8A-A0B7-4FEE-93FE-5F0EF7532709
154 |
155 |
156 | destinationuid
157 | 6381E717-93A3-4FC4-92D8-35E161FA7714
158 | modifiers
159 | 524288
160 | modifiersubtext
161 | Configure appearance of icons
162 | vitoclose
163 |
164 |
165 |
166 | destinationuid
167 | A6E73533-57E0-4781-8F3C-E21CB458E4C5
168 | modifiers
169 | 0
170 | modifiersubtext
171 |
172 | vitoclose
173 |
174 |
175 |
176 | 53C7CA30-87EE-4107-99AB-61C2E4B0A93B
177 |
178 |
179 | destinationuid
180 | AC87F7F8-4F37-4551-9E7C-C0B78DEE104B
181 | modifiers
182 | 0
183 | modifiersubtext
184 |
185 | vitoclose
186 |
187 |
188 |
189 | 59FFA607-2846-4AA2-A124-9F64C28235C5
190 |
191 |
192 | destinationuid
193 | 5C5DFAFA-B4E7-4A90-990D-B9DB9703F9B8
194 | modifiers
195 | 0
196 | modifiersubtext
197 |
198 | vitoclose
199 |
200 |
201 |
202 | 5B12AB9D-AA76-4239-9AC3-3E23B5FFFE24
203 |
204 |
205 | destinationuid
206 | C39C186A-9E22-4B02-A8E7-795B3D83F82D
207 | modifiers
208 | 0
209 | modifiersubtext
210 |
211 | vitoclose
212 |
213 |
214 |
215 | 5C5DFAFA-B4E7-4A90-990D-B9DB9703F9B8
216 |
217 |
218 | destinationuid
219 | 029F3070-B55D-4A1D-A2B3-8EF75B13421F
220 | modifiers
221 | 0
222 | modifiersubtext
223 |
224 | vitoclose
225 |
226 |
227 |
228 | 6381E717-93A3-4FC4-92D8-35E161FA7714
229 |
230 |
231 | destinationuid
232 | A6E73533-57E0-4781-8F3C-E21CB458E4C5
233 | modifiers
234 | 0
235 | modifiersubtext
236 |
237 | vitoclose
238 |
239 |
240 |
241 | 7176BEA1-7AF6-481A-B04F-D1F0854D6BC7
242 |
243 |
244 | destinationuid
245 | 2AF6EB83-6A8A-488B-AB9D-12360650E4F6
246 | modifiers
247 | 0
248 | modifiersubtext
249 |
250 | vitoclose
251 |
252 |
253 |
254 | 73352DE3-1237-455E-86DD-10F058887148
255 |
256 |
257 | destinationuid
258 | 59FFA607-2846-4AA2-A124-9F64C28235C5
259 | modifiers
260 | 524288
261 | modifiersubtext
262 | Configure appearance of icons
263 | vitoclose
264 |
265 |
266 |
267 | destinationuid
268 | 5C5DFAFA-B4E7-4A90-990D-B9DB9703F9B8
269 | modifiers
270 | 0
271 | modifiersubtext
272 |
273 | vitoclose
274 |
275 |
276 |
277 | 76557CB6-CADE-4EFD-97EE-C519C1511CED
278 |
279 |
280 | destinationuid
281 | 0F112DB8-4F31-4419-B64F-4D2F22C5CE9E
282 | modifiers
283 | 0
284 | modifiersubtext
285 |
286 | vitoclose
287 |
288 |
289 |
290 | 79248429-2E61-4DBF-B5C8-D92DBFE16586
291 |
292 |
293 | destinationuid
294 | F29DB020-E6BD-4876-8E0C-26A9877DD1C2
295 | modifiers
296 | 0
297 | modifiersubtext
298 |
299 | vitoclose
300 |
301 |
302 |
303 | 7AEC5654-124E-4EA5-9B6C-AA1AB9BC2F44
304 |
305 |
306 | destinationuid
307 | 00F10721-43D4-40FD-9314-A3EB924BCFE0
308 | modifiers
309 | 0
310 | modifiersubtext
311 |
312 | sourceoutputuid
313 | 98D8E2E6-7A14-44F1-992C-274620F8E258
314 | vitoclose
315 |
316 |
317 |
318 | destinationuid
319 | EFA6895F-9D07-484D-BF29-75EE2B9873B3
320 | modifiers
321 | 0
322 | modifiersubtext
323 |
324 | vitoclose
325 |
326 |
327 |
328 | 7E62E27C-8A4A-456E-8991-E85D30917869
329 |
330 |
331 | destinationuid
332 | 060CD21A-B296-472F-8FA8-F84CE56AB574
333 | modifiers
334 | 0
335 | modifiersubtext
336 |
337 | vitoclose
338 |
339 |
340 |
341 | 83240BF3-7852-428A-81DA-A62F65211658
342 |
343 |
344 | destinationuid
345 | 2CDF706A-DA6A-4E59-BCD2-9C2556317289
346 | modifiers
347 | 0
348 | modifiersubtext
349 |
350 | sourceoutputuid
351 | C1A96D94-AF93-433A-B218-B353BA33E1BF
352 | vitoclose
353 |
354 |
355 |
356 | destinationuid
357 | 7176BEA1-7AF6-481A-B04F-D1F0854D6BC7
358 | modifiers
359 | 0
360 | modifiersubtext
361 |
362 | sourceoutputuid
363 | 4D902882-9E61-4EC8-896A-26E163E03D01
364 | vitoclose
365 |
366 |
367 |
368 | destinationuid
369 | 306B2655-B8A6-48EA-A6E6-1E2204F46CB7
370 | modifiers
371 | 0
372 | modifiersubtext
373 |
374 | sourceoutputuid
375 | F1C36AFD-EABB-43C4-9C57-7B2D5FB5067D
376 | vitoclose
377 |
378 |
379 |
380 | destinationuid
381 | 79248429-2E61-4DBF-B5C8-D92DBFE16586
382 | modifiers
383 | 0
384 | modifiersubtext
385 |
386 | sourceoutputuid
387 | 17779AC3-102E-43C0-ABBC-ABF16C0430D3
388 | vitoclose
389 |
390 |
391 |
392 | destinationuid
393 | E4E00064-6141-4E70-B0CD-F8FE19C44ACB
394 | modifiers
395 | 0
396 | modifiersubtext
397 |
398 | sourceoutputuid
399 | 0569A037-B4DA-4972-B2BA-D6D9C14806F2
400 | vitoclose
401 |
402 |
403 |
404 | 85CB9C50-C573-4740-91E9-A1CE2E113117
405 |
406 |
407 | destinationuid
408 | DA61D3A2-976B-407E-B752-DBA5447F6274
409 | modifiers
410 | 0
411 | modifiersubtext
412 |
413 | vitoclose
414 |
415 |
416 |
417 | 99745CA9-3E6B-4D75-95CE-9F51AF1E6CBF
418 |
419 |
420 | destinationuid
421 | F856ED1E-689A-4536-A5A0-35E8EAAA5EE5
422 | modifiers
423 | 0
424 | modifiersubtext
425 |
426 | vitoclose
427 |
428 |
429 |
430 | A0F7228F-3AF9-471C-947A-EBAE7C94420C
431 |
432 |
433 | destinationuid
434 | F856ED1E-689A-4536-A5A0-35E8EAAA5EE5
435 | modifiers
436 | 0
437 | modifiersubtext
438 |
439 | vitoclose
440 |
441 |
442 |
443 | A6E73533-57E0-4781-8F3C-E21CB458E4C5
444 |
445 |
446 | destinationuid
447 | 029F3070-B55D-4A1D-A2B3-8EF75B13421F
448 | modifiers
449 | 0
450 | modifiersubtext
451 |
452 | vitoclose
453 |
454 |
455 |
456 | AC87F7F8-4F37-4551-9E7C-C0B78DEE104B
457 |
458 |
459 | destinationuid
460 | 314177DC-6BA0-4510-92BE-451C74FC6496
461 | modifiers
462 | 0
463 | modifiersubtext
464 |
465 | vitoclose
466 |
467 |
468 |
469 | ADD1A137-8B4B-4EFB-AF24-2899F98A95D2
470 |
471 |
472 | destinationuid
473 | A0F7228F-3AF9-471C-947A-EBAE7C94420C
474 | modifiers
475 | 0
476 | modifiersubtext
477 |
478 | sourceoutputuid
479 | 69C95243-FAD3-4554-A02E-E3E11D3C02B7
480 | vitoclose
481 |
482 |
483 |
484 | destinationuid
485 | 99745CA9-3E6B-4D75-95CE-9F51AF1E6CBF
486 | modifiers
487 | 0
488 | modifiersubtext
489 |
490 | vitoclose
491 |
492 |
493 |
494 | C2858A82-B228-464A-9D5B-9C692F769CDC
495 |
496 |
497 | destinationuid
498 | AC87F7F8-4F37-4551-9E7C-C0B78DEE104B
499 | modifiers
500 | 0
501 | modifiersubtext
502 |
503 | vitoclose
504 |
505 |
506 |
507 | C39C186A-9E22-4B02-A8E7-795B3D83F82D
508 |
509 |
510 | destinationuid
511 | F2CED950-18E4-4714-8B51-C280012DF8BD
512 | modifiers
513 | 0
514 | modifiersubtext
515 |
516 | sourceoutputuid
517 | 82BD228E-72A0-49EC-AB14-43C5422F3CE7
518 | vitoclose
519 |
520 |
521 |
522 | destinationuid
523 | 3A3F894D-00E7-4283-8996-3B119ABC6E3D
524 | modifiers
525 | 0
526 | modifiersubtext
527 |
528 | sourceoutputuid
529 | C77CF866-5BB7-4F45-8022-8B4E27B234CC
530 | vitoclose
531 |
532 |
533 |
534 | destinationuid
535 | EDE2383D-B36D-4BA9-A7FA-0D3BB869D8BD
536 | modifiers
537 | 0
538 | modifiersubtext
539 |
540 | vitoclose
541 |
542 |
543 |
544 | D6BF1098-3169-4D5B-BBA9-DBD7F6A4D138
545 |
546 |
547 | destinationuid
548 | DF5EB554-E73F-410A-83FE-59C299493C6D
549 | modifiers
550 | 0
551 | modifiersubtext
552 |
553 | vitoclose
554 |
555 |
556 |
557 | DA61D3A2-976B-407E-B752-DBA5447F6274
558 |
559 |
560 | destinationuid
561 | 53C7CA30-87EE-4107-99AB-61C2E4B0A93B
562 | modifiers
563 | 0
564 | modifiersubtext
565 |
566 | vitoclose
567 |
568 |
569 |
570 | DBDC800C-892D-4517-833A-8ABC465E948E
571 |
572 |
573 | destinationuid
574 | 83240BF3-7852-428A-81DA-A62F65211658
575 | modifiers
576 | 0
577 | modifiersubtext
578 |
579 | vitoclose
580 |
581 |
582 |
583 | DE724F31-C36C-4B2E-A900-A39D4B1E3F02
584 |
585 |
586 | destinationuid
587 | D6BF1098-3169-4D5B-BBA9-DBD7F6A4D138
588 | modifiers
589 | 0
590 | modifiersubtext
591 |
592 | vitoclose
593 |
594 |
595 |
596 | DF5EB554-E73F-410A-83FE-59C299493C6D
597 |
598 |
599 | destinationuid
600 | C2858A82-B228-464A-9D5B-9C692F769CDC
601 | modifiers
602 | 0
603 | modifiersubtext
604 |
605 | vitoclose
606 |
607 |
608 |
609 | E4E00064-6141-4E70-B0CD-F8FE19C44ACB
610 |
611 |
612 | destinationuid
613 | F29DB020-E6BD-4876-8E0C-26A9877DD1C2
614 | modifiers
615 | 0
616 | modifiersubtext
617 |
618 | vitoclose
619 |
620 |
621 |
622 | E8E25D44-5E74-4492-8C4A-51A4573F8BFB
623 |
624 |
625 | destinationuid
626 | 85CB9C50-C573-4740-91E9-A1CE2E113117
627 | modifiers
628 | 0
629 | modifiersubtext
630 |
631 | vitoclose
632 |
633 |
634 |
635 | EDE2383D-B36D-4BA9-A7FA-0D3BB869D8BD
636 |
637 |
638 | destinationuid
639 | E8E25D44-5E74-4492-8C4A-51A4573F8BFB
640 | modifiers
641 | 0
642 | modifiersubtext
643 |
644 | sourceoutputuid
645 | EB6CDBC1-7955-407E-B460-94F8E9A7DD25
646 | vitoclose
647 |
648 |
649 |
650 | destinationuid
651 | DE724F31-C36C-4B2E-A900-A39D4B1E3F02
652 | modifiers
653 | 0
654 | modifiersubtext
655 |
656 | sourceoutputuid
657 | F4AAADF4-0B3F-4B49-AD11-7FB5557A8A97
658 | vitoclose
659 |
660 |
661 |
662 | EFA6895F-9D07-484D-BF29-75EE2B9873B3
663 |
664 |
665 | destinationuid
666 | 7E62E27C-8A4A-456E-8991-E85D30917869
667 | modifiers
668 | 0
669 | modifiersubtext
670 |
671 | vitoclose
672 |
673 |
674 |
675 | F29DB020-E6BD-4876-8E0C-26A9877DD1C2
676 |
677 |
678 | destinationuid
679 | 2B4E492B-764C-4C73-8A11-328F6C462371
680 | modifiers
681 | 524288
682 | modifiersubtext
683 | Remove Swatch
684 | vitoclose
685 |
686 |
687 |
688 | destinationuid
689 | 5B12AB9D-AA76-4239-9AC3-3E23B5FFFE24
690 | modifiers
691 | 0
692 | modifiersubtext
693 |
694 | vitoclose
695 |
696 |
697 |
698 | F462E9D8-4B2B-4A3A-BBFA-ECCBEEE96B14
699 |
700 |
701 | destinationuid
702 | ADD1A137-8B4B-4EFB-AF24-2899F98A95D2
703 | modifiers
704 | 0
705 | modifiersubtext
706 |
707 | vitoclose
708 |
709 |
710 |
711 | F856ED1E-689A-4536-A5A0-35E8EAAA5EE5
712 |
713 |
714 | destinationuid
715 | 93CA6DBA-4A5E-4411-B779-A0B18FF2EB4C
716 | modifiers
717 | 0
718 | modifiersubtext
719 |
720 | vitoclose
721 |
722 |
723 |
724 |
725 | createdby
726 | Nathan
727 | description
728 | Generate icons from emoji or SF Symbols
729 | disabled
730 |
731 | name
732 | Icon Generator
733 | objects
734 |
735 |
736 | config
737 |
738 | externaltriggerid
739 | Swatch Picker
740 | passinputasargument
741 |
742 | passvariables
743 |
744 | workflowbundleid
745 | self
746 |
747 | type
748 | alfred.workflow.output.callexternaltrigger
749 | uid
750 | 060CD21A-B296-472F-8FA8-F84CE56AB574
751 | version
752 | 1
753 |
754 |
755 | config
756 |
757 | concurrently
758 |
759 | escaping
760 | 0
761 | script
762 |
763 | scriptargtype
764 | 1
765 | scriptfile
766 | delete_swatch.py
767 | type
768 | 8
769 |
770 | type
771 | alfred.workflow.action.script
772 | uid
773 | 2B4E492B-764C-4C73-8A11-328F6C462371
774 | version
775 | 2
776 |
777 |
778 | config
779 |
780 | externaltriggerid
781 | Return to icon generation
782 | passinputasargument
783 |
784 | passvariables
785 |
786 | workflowbundleid
787 | self
788 |
789 | type
790 | alfred.workflow.output.callexternaltrigger
791 | uid
792 | 3B30AC28-EEEA-488E-9D0D-5F425B15548B
793 | version
794 | 1
795 |
796 |
797 | config
798 |
799 | conditions
800 |
801 |
802 | inputstring
803 | {var:creating_icon}
804 | matchcasesensitive
805 |
806 | matchmode
807 | 5
808 | matchstring
809 |
810 | outputlabel
811 | return to icon creation
812 | uid
813 | DEA52482-40E6-4E85-8B9C-B96806A95F16
814 |
815 |
816 | elselabel
817 | finished
818 | hideelse
819 |
820 |
821 | type
822 | alfred.workflow.utility.conditional
823 | uid
824 | 2CDF706A-DA6A-4E59-BCD2-9C2556317289
825 | version
826 | 1
827 |
828 |
829 | config
830 |
831 | externaltriggerid
832 | Options Menu
833 | passinputasargument
834 |
835 | passvariables
836 |
837 | workflowbundleid
838 | self
839 |
840 | type
841 | alfred.workflow.output.callexternaltrigger
842 | uid
843 | F2CED950-18E4-4714-8B51-C280012DF8BD
844 | version
845 | 1
846 |
847 |
848 | config
849 |
850 | externaltriggerid
851 | Options Menu
852 | passinputasargument
853 |
854 | passvariables
855 |
856 | workflowbundleid
857 | self
858 |
859 | type
860 | alfred.workflow.output.callexternaltrigger
861 | uid
862 | 00F10721-43D4-40FD-9314-A3EB924BCFE0
863 | version
864 | 1
865 |
866 |
867 | config
868 |
869 | externaltriggerid
870 | Generate Preview
871 | passinputasargument
872 |
873 | passvariables
874 |
875 | workflowbundleid
876 | self
877 |
878 | type
879 | alfred.workflow.output.callexternaltrigger
880 | uid
881 | 35D5B2B4-CF89-4A0C-8B33-6DA5CC4DF20F
882 | version
883 | 1
884 |
885 |
886 | config
887 |
888 | concurrently
889 |
890 | escaping
891 | 68
892 | script
893 | // Set the main variable in Configuration Sheet
894 |
895 | ObjC.import('stdlib');
896 | Application('com.runningwithcrayons.Alfred').setConfiguration('useBg', {
897 | toValue: $.getenv("useBg"),
898 | inWorkflow: $.getenv('alfred_workflow_bundleid'),
899 | exportable: true
900 | });
901 | scriptargtype
902 | 1
903 | scriptfile
904 |
905 | type
906 | 7
907 |
908 | type
909 | alfred.workflow.action.script
910 | uid
911 | 2AF6EB83-6A8A-488B-AB9D-12360650E4F6
912 | version
913 | 2
914 |
915 |
916 | config
917 |
918 | argument
919 | 1
920 | passthroughargument
921 |
922 | variables
923 |
924 | useBg
925 | 1
926 |
927 |
928 | type
929 | alfred.workflow.utility.argument
930 | uid
931 | 7176BEA1-7AF6-481A-B04F-D1F0854D6BC7
932 | version
933 | 1
934 |
935 |
936 | config
937 |
938 | argument
939 | 0
940 | passthroughargument
941 |
942 | variables
943 |
944 | useBg
945 | 0
946 |
947 |
948 | type
949 | alfred.workflow.utility.argument
950 | uid
951 | 306B2655-B8A6-48EA-A6E6-1E2204F46CB7
952 | version
953 | 1
954 |
955 |
956 | config
957 |
958 | conditions
959 |
960 |
961 | inputstring
962 |
963 | matchcasesensitive
964 |
965 | matchmode
966 | 0
967 | matchstring
968 | done
969 | outputlabel
970 | Done
971 | uid
972 | C1A96D94-AF93-433A-B218-B353BA33E1BF
973 |
974 |
975 | inputstring
976 |
977 | matchcasesensitive
978 |
979 | matchmode
980 | 0
981 | matchstring
982 | bg_no
983 | outputlabel
984 | Toggle BG on
985 | uid
986 | 4D902882-9E61-4EC8-896A-26E163E03D01
987 |
988 |
989 | inputstring
990 |
991 | matchcasesensitive
992 |
993 | matchmode
994 | 0
995 | matchstring
996 | bg_yes
997 | outputlabel
998 | Toggle BG off
999 | uid
1000 | F1C36AFD-EABB-43C4-9C57-7B2D5FB5067D
1001 |
1002 |
1003 | inputstring
1004 |
1005 | matchcasesensitive
1006 |
1007 | matchmode
1008 | 0
1009 | matchstring
1010 | choose_fg
1011 | outputlabel
1012 | Choose FG Colour
1013 | uid
1014 | 17779AC3-102E-43C0-ABBC-ABF16C0430D3
1015 |
1016 |
1017 | inputstring
1018 |
1019 | matchcasesensitive
1020 |
1021 | matchmode
1022 | 0
1023 | matchstring
1024 | choose_bg
1025 | outputlabel
1026 | Choose BG Colour
1027 | uid
1028 | 0569A037-B4DA-4972-B2BA-D6D9C14806F2
1029 |
1030 |
1031 | elselabel
1032 | else
1033 | hideelse
1034 |
1035 |
1036 | type
1037 | alfred.workflow.utility.conditional
1038 | uid
1039 | 83240BF3-7852-428A-81DA-A62F65211658
1040 | version
1041 | 1
1042 |
1043 |
1044 | config
1045 |
1046 | alfredfiltersresults
1047 |
1048 | alfredfiltersresultsmatchmode
1049 | 0
1050 | argumenttreatemptyqueryasnil
1051 |
1052 | argumenttrimmode
1053 | 0
1054 | argumenttype
1055 | 2
1056 | escaping
1057 | 127
1058 | queuedelaycustom
1059 | 1
1060 | queuedelayimmediatelyinitially
1061 |
1062 | queuedelaymode
1063 | 0
1064 | queuemode
1065 | 1
1066 | runningsubtext
1067 |
1068 | script
1069 | import json
1070 | import os
1071 |
1072 | json_data = '''
1073 | {
1074 | "items": [
1075 | {
1076 | "title": "Done",
1077 | "arg": "done",
1078 | "icon": {
1079 | "path": "icons/bg_colour.png"
1080 | }
1081 | },
1082 | {
1083 | "title": "Foreground Colour",
1084 | "arg": "choose_fg",
1085 | "icon": {
1086 | "path": "icons/fg_colour.png"
1087 | }
1088 | },
1089 | {
1090 | "title": "Background Colour",
1091 | "arg": "choose_bg",
1092 | "icon": {
1093 | "path": "icons/bg_colour.png"
1094 | }
1095 | },
1096 | {
1097 | "title": "Enable Background",
1098 | "arg": "choose_bg",
1099 | "icon": {
1100 | "path": "icons/bg_colour.png"
1101 | }
1102 | }
1103 | ]
1104 | }
1105 | '''
1106 |
1107 | icon_paths = {
1108 | "Foreground Colour": os.path.join(os.getenv("alfred_workflow_data"), "swatch_icons/foreground.png"),
1109 | "Background Colour": os.path.join(os.getenv("alfred_workflow_data"), "swatch_icons/background.png"),
1110 | "Done": "done.png"
1111 | }
1112 |
1113 | data = json.loads(json_data)
1114 |
1115 | for item in data['items']:
1116 | title = item['title']
1117 | if title in icon_paths:
1118 | item['icon']['path'] = icon_paths[title]
1119 |
1120 | new_json_data = json.dumps(data, indent=4)
1121 |
1122 | print(new_json_data)
1123 |
1124 | scriptargtype
1125 | 1
1126 | scriptfile
1127 | options_menu.py
1128 | subtext
1129 |
1130 | title
1131 |
1132 | type
1133 | 8
1134 | withspace
1135 |
1136 |
1137 | inboundconfig
1138 |
1139 | externalid
1140 | Options Menu
1141 |
1142 | type
1143 | alfred.workflow.input.scriptfilter
1144 | uid
1145 | DBDC800C-892D-4517-833A-8ABC465E948E
1146 | version
1147 | 3
1148 |
1149 |
1150 | config
1151 |
1152 | argumenttype
1153 | 2
1154 | keyword
1155 | Icon Generator Config
1156 | subtext
1157 | Configure appearance settings
1158 | text
1159 | Icon Generator Config
1160 | withspace
1161 |
1162 |
1163 | type
1164 | alfred.workflow.input.keyword
1165 | uid
1166 | 4D7F6811-5901-44B6-A4B1-C56E98CC0C99
1167 | version
1168 | 1
1169 |
1170 |
1171 | config
1172 |
1173 | concurrently
1174 |
1175 | escaping
1176 | 102
1177 | script
1178 | # Check if the file or the folder does not exist
1179 |
1180 |
1181 |
1182 | if [ "$useBg" = 1 ]; then
1183 | convert -background $bg_colour -font /Library/Fonts/$fontWeight -fill $fg_colour -gravity "center" -size "256x256" caption:"$glyph" +repage -depth 8 "DBDC800C-892D-4517-833A-8ABC465E948E.png"
1184 | convert "DBDC800C-892D-4517-833A-8ABC465E948E.png" -bordercolor $bg_colour -border 5% -resize "256x256" "DBDC800C-892D-4517-833A-8ABC465E948E.png"
1185 | convert "DBDC800C-892D-4517-833A-8ABC465E948E.png" -matte $bgRoundness -compose DstIn -composite "DBDC800C-892D-4517-833A-8ABC465E948E.png"
1186 | convert "DBDC800C-892D-4517-833A-8ABC465E948E.png" -matte -bordercolor none -border "$margin_percent"% "DBDC800C-892D-4517-833A-8ABC465E948E.png"
1187 | else
1188 | convert -background none -font /Library/Fonts/$fontWeight -fill $fg_colour -gravity "center" -size "256x256" caption:"$glyph" +repage -depth 8 "DBDC800C-892D-4517-833A-8ABC465E948E.png"
1189 | convert "DBDC800C-892D-4517-833A-8ABC465E948E.png" -matte -bordercolor none -border "$margin_percent"% "DBDC800C-892D-4517-833A-8ABC465E948E.png"
1190 | fi
1191 |
1192 | cp -f DBDC800C-892D-4517-833A-8ABC465E948E.png F29DB020-E6BD-4876-8E0C-26A9877DD1C2.png
1193 | scriptargtype
1194 | 1
1195 | scriptfile
1196 |
1197 | type
1198 | 5
1199 |
1200 | inboundconfig
1201 |
1202 | externalid
1203 | Options First Run
1204 |
1205 | type
1206 | alfred.workflow.action.script
1207 | uid
1208 | 0F112DB8-4F31-4419-B64F-4D2F22C5CE9E
1209 | version
1210 | 2
1211 |
1212 |
1213 | config
1214 |
1215 | concurrently
1216 |
1217 | escaping
1218 | 68
1219 | script
1220 | function chooseColor() {
1221 | try {
1222 | let app = Application.currentApplication();
1223 | app.includeStandardAdditions = true;
1224 |
1225 | // Open the color picker with a default color of red
1226 | let color = app.chooseColor({defaultColor: [1, 0, 0]});
1227 |
1228 | // Convert the normalized color values (0-1) to 8-bit RGB values (0-255)
1229 | let r = Math.round(color[0] * 255);
1230 | let g = Math.round(color[1] * 255);
1231 | let b = Math.round(color[2] * 255);
1232 |
1233 | // Convert RGB values to HEX
1234 | return rgbToHex(r, g, b);
1235 | } catch (error) {
1236 | return "no_swatch";
1237 | }
1238 | }
1239 |
1240 | function rgbToHex(r, g, b) {
1241 | return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase();
1242 | }
1243 |
1244 | chooseColor();
1245 | scriptargtype
1246 | 1
1247 | scriptfile
1248 |
1249 | type
1250 | 7
1251 |
1252 | type
1253 | alfred.workflow.action.script
1254 | uid
1255 | 3A3F894D-00E7-4283-8996-3B119ABC6E3D
1256 | version
1257 | 2
1258 |
1259 |
1260 | config
1261 |
1262 | concurrently
1263 |
1264 | escaping
1265 | 0
1266 | script
1267 |
1268 | scriptargtype
1269 | 1
1270 | scriptfile
1271 | add_swatch.py
1272 | type
1273 | 8
1274 |
1275 | type
1276 | alfred.workflow.action.script
1277 | uid
1278 | EFA6895F-9D07-484D-BF29-75EE2B9873B3
1279 | version
1280 | 2
1281 |
1282 |
1283 | config
1284 |
1285 | concurrently
1286 |
1287 | escaping
1288 | 102
1289 | script
1290 | colour=$1
1291 | hex_colour="#$colour"
1292 | save_path="${alfred_workflow_data}/swatch_icons/$1.png"
1293 |
1294 | convert -size 256x256 xc:$hex_colour "$save_path"
1295 |
1296 | # use an existing image to cut out the alpha
1297 | convert $save_path -matte $bgRoundness \
1298 | -compose DstIn -composite "$save_path"
1299 |
1300 | # add some margin around the whole icon
1301 | convert $save_path -matte -bordercolor none -border "$margin_percent"% "$save_path"
1302 | scriptargtype
1303 | 1
1304 | scriptfile
1305 |
1306 | type
1307 | 5
1308 |
1309 | type
1310 | alfred.workflow.action.script
1311 | uid
1312 | 7E62E27C-8A4A-456E-8991-E85D30917869
1313 | version
1314 | 2
1315 |
1316 |
1317 | config
1318 |
1319 | conditions
1320 |
1321 |
1322 | inputstring
1323 |
1324 | matchcasesensitive
1325 |
1326 | matchmode
1327 | 0
1328 | matchstring
1329 | no_swatch
1330 | outputlabel
1331 | cancelled
1332 | uid
1333 | 98D8E2E6-7A14-44F1-992C-274620F8E258
1334 |
1335 |
1336 | elselabel
1337 | continue
1338 | hideelse
1339 |
1340 |
1341 | type
1342 | alfred.workflow.utility.conditional
1343 | uid
1344 | 7AEC5654-124E-4EA5-9B6C-AA1AB9BC2F44
1345 | version
1346 | 1
1347 |
1348 |
1349 | config
1350 |
1351 | argument
1352 |
1353 | passthroughargument
1354 |
1355 | variables
1356 |
1357 | glyph
1358 |
1359 |
1360 |
1361 | type
1362 | alfred.workflow.utility.argument
1363 | uid
1364 | 76557CB6-CADE-4EFD-97EE-C519C1511CED
1365 | version
1366 | 1
1367 |
1368 |
1369 | config
1370 |
1371 | type
1372 | 0
1373 |
1374 | type
1375 | alfred.workflow.utility.transform
1376 | uid
1377 | 28436EEC-BCBE-420A-9366-B327D94A1814
1378 | version
1379 | 1
1380 |
1381 |
1382 | config
1383 |
1384 | argument
1385 |
1386 | passthroughargument
1387 |
1388 | variables
1389 |
1390 | adjusting_bg
1391 | false
1392 | adjusting_fg
1393 | true
1394 |
1395 |
1396 | type
1397 | alfred.workflow.utility.argument
1398 | uid
1399 | 79248429-2E61-4DBF-B5C8-D92DBFE16586
1400 | version
1401 | 1
1402 |
1403 |
1404 | config
1405 |
1406 | alfredfiltersresults
1407 |
1408 | alfredfiltersresultsmatchmode
1409 | 0
1410 | argumenttreatemptyqueryasnil
1411 |
1412 | argumenttrimmode
1413 | 0
1414 | argumenttype
1415 | 2
1416 | escaping
1417 | 102
1418 | queuedelaycustom
1419 | 3
1420 | queuedelayimmediatelyinitially
1421 |
1422 | queuedelaymode
1423 | 0
1424 | queuemode
1425 | 1
1426 | runningsubtext
1427 |
1428 | script
1429 | import json
1430 | import os
1431 |
1432 | alfred_workflow_data = os.getenv("alfred_workflow_data")
1433 | alfred_preferences = os.getenv("alfred_preferences")
1434 | alfred_workflow_uid = os.getenv("alfred_workflow_uid")
1435 | filename = "swatch.json"
1436 |
1437 | # Set defaults path
1438 | defaults_path = os.path.join(alfred_preferences, "workflows", alfred_workflow_uid, "defaults")
1439 |
1440 | # Set input path
1441 | input_path = os.path.join(alfred_workflow_data, filename)
1442 |
1443 | # Read the JSON file
1444 | with open(input_path) as file:
1445 | input_json = json.load(file)
1446 |
1447 | # Add workflow data path to the beginning of every icon path
1448 | for item in input_json["items"]:
1449 | item["icon"]["path"] = alfred_workflow_data + "/swatch_icons/" + item["icon"]["path"]
1450 |
1451 | json_data = json.dumps(input_json, indent=4)
1452 |
1453 | print(json_data)
1454 |
1455 | scriptargtype
1456 | 1
1457 | scriptfile
1458 | swatch_picker.py
1459 | subtext
1460 |
1461 | title
1462 |
1463 | type
1464 | 8
1465 | withspace
1466 |
1467 |
1468 | inboundconfig
1469 |
1470 | externalid
1471 | Swatch Picker
1472 |
1473 | type
1474 | alfred.workflow.input.scriptfilter
1475 | uid
1476 | F29DB020-E6BD-4876-8E0C-26A9877DD1C2
1477 | version
1478 | 3
1479 |
1480 |
1481 | config
1482 |
1483 | conditions
1484 |
1485 |
1486 | inputstring
1487 |
1488 | matchcasesensitive
1489 |
1490 | matchmode
1491 | 0
1492 | matchstring
1493 | back
1494 | outputlabel
1495 | Back
1496 | uid
1497 | 82BD228E-72A0-49EC-AB14-43C5422F3CE7
1498 |
1499 |
1500 | inputstring
1501 |
1502 | matchcasesensitive
1503 |
1504 | matchmode
1505 | 0
1506 | matchstring
1507 | new_swatch
1508 | outputlabel
1509 | Add swatch
1510 | uid
1511 | C77CF866-5BB7-4F45-8022-8B4E27B234CC
1512 |
1513 |
1514 | elselabel
1515 | Set Colour
1516 | hideelse
1517 |
1518 |
1519 | type
1520 | alfred.workflow.utility.conditional
1521 | uid
1522 | C39C186A-9E22-4B02-A8E7-795B3D83F82D
1523 | version
1524 | 1
1525 |
1526 |
1527 | config
1528 |
1529 | argument
1530 |
1531 | passthroughargument
1532 |
1533 | variables
1534 |
1535 | adjusting_bg
1536 | true
1537 | adjusting_fg
1538 | false
1539 |
1540 |
1541 | type
1542 | alfred.workflow.utility.argument
1543 | uid
1544 | E4E00064-6141-4E70-B0CD-F8FE19C44ACB
1545 | version
1546 | 1
1547 |
1548 |
1549 | config
1550 |
1551 | argument
1552 |
1553 | passthroughargument
1554 |
1555 | variables
1556 |
1557 | selected_colour
1558 | {query}
1559 |
1560 |
1561 | type
1562 | alfred.workflow.utility.argument
1563 | uid
1564 | 5B12AB9D-AA76-4239-9AC3-3E23B5FFFE24
1565 | version
1566 | 1
1567 |
1568 |
1569 | config
1570 |
1571 | concurrently
1572 |
1573 | escaping
1574 | 102
1575 | script
1576 | colour=$1
1577 | hex_colour="#$colour"
1578 | save_path="${alfred_workflow_data}/swatch_icons/foreground.png"
1579 |
1580 | convert -size 256x256 xc:$hex_colour "$save_path"
1581 |
1582 | # use an existing image to cut out the alpha
1583 | convert $save_path -matte $bgRoundness \
1584 | -compose DstIn -composite "$save_path"
1585 |
1586 | # add some margin around the whole icon
1587 | convert $save_path -matte -bordercolor none -border "$margin_percent"% "$save_path"
1588 | scriptargtype
1589 | 1
1590 | scriptfile
1591 |
1592 | type
1593 | 5
1594 |
1595 | type
1596 | alfred.workflow.action.script
1597 | uid
1598 | 53C7CA30-87EE-4107-99AB-61C2E4B0A93B
1599 | version
1600 | 2
1601 |
1602 |
1603 | config
1604 |
1605 | concurrently
1606 |
1607 | escaping
1608 | 68
1609 | script
1610 | // Set the main variable in Configuration Sheet
1611 |
1612 | ObjC.import('stdlib');
1613 | Application('com.runningwithcrayons.Alfred').setConfiguration('fg_colour', {
1614 | toValue: $.getenv('selected_colour'),
1615 | inWorkflow: $.getenv('alfred_workflow_bundleid'),
1616 | exportable: true
1617 | });
1618 |
1619 |
1620 | // output selected_colour without the '#' for use in next workflow objects
1621 | $.getenv('selected_colour').replace(/#/g, "");
1622 | scriptargtype
1623 | 1
1624 | scriptfile
1625 |
1626 | type
1627 | 7
1628 |
1629 | type
1630 | alfred.workflow.action.script
1631 | uid
1632 | 85CB9C50-C573-4740-91E9-A1CE2E113117
1633 | version
1634 | 2
1635 |
1636 |
1637 | config
1638 |
1639 | argument
1640 | {query}
1641 | passthroughargument
1642 |
1643 | variables
1644 |
1645 | fg_colour
1646 | {var:selected_colour}
1647 |
1648 |
1649 | type
1650 | alfred.workflow.utility.argument
1651 | uid
1652 | E8E25D44-5E74-4492-8C4A-51A4573F8BFB
1653 | version
1654 | 1
1655 |
1656 |
1657 | config
1658 |
1659 | type
1660 | 0
1661 |
1662 | type
1663 | alfred.workflow.utility.transform
1664 | uid
1665 | DA61D3A2-976B-407E-B752-DBA5447F6274
1666 | version
1667 | 1
1668 |
1669 |
1670 | config
1671 |
1672 | conditions
1673 |
1674 |
1675 | inputstring
1676 | {var:adjusting_fg}
1677 | matchcasesensitive
1678 |
1679 | matchmode
1680 | 5
1681 | matchstring
1682 |
1683 | outputlabel
1684 | Adjust FG
1685 | uid
1686 | EB6CDBC1-7955-407E-B460-94F8E9A7DD25
1687 |
1688 |
1689 | inputstring
1690 | {var:adjusting_bg}
1691 | matchcasesensitive
1692 |
1693 | matchmode
1694 | 5
1695 | matchstring
1696 |
1697 | outputlabel
1698 | Adjust BG
1699 | uid
1700 | F4AAADF4-0B3F-4B49-AD11-7FB5557A8A97
1701 |
1702 |
1703 | elselabel
1704 | error
1705 | hideelse
1706 |
1707 |
1708 | type
1709 | alfred.workflow.utility.conditional
1710 | uid
1711 | EDE2383D-B36D-4BA9-A7FA-0D3BB869D8BD
1712 | version
1713 | 1
1714 |
1715 |
1716 | config
1717 |
1718 | externaltriggerid
1719 | Options Menu
1720 | passinputasargument
1721 |
1722 | passvariables
1723 |
1724 | workflowbundleid
1725 | self
1726 |
1727 | type
1728 | alfred.workflow.output.callexternaltrigger
1729 | uid
1730 | 314177DC-6BA0-4510-92BE-451C74FC6496
1731 | version
1732 | 1
1733 |
1734 |
1735 | config
1736 |
1737 | concurrently
1738 |
1739 | escaping
1740 | 102
1741 | script
1742 | if [ "$useBg" = 1 ]; then
1743 | convert -background $bg_colour -font /Library/Fonts/$fontWeight -fill $fg_colour -gravity "center" -size "256x256" caption:"$glyph" +repage -depth 8 "DBDC800C-892D-4517-833A-8ABC465E948E.png"
1744 | convert "DBDC800C-892D-4517-833A-8ABC465E948E.png" -bordercolor $bg_colour -border 5% -resize "256x256" "DBDC800C-892D-4517-833A-8ABC465E948E.png"
1745 | convert "DBDC800C-892D-4517-833A-8ABC465E948E.png" -matte $bgRoundness -compose DstIn -composite "DBDC800C-892D-4517-833A-8ABC465E948E.png"
1746 | convert "DBDC800C-892D-4517-833A-8ABC465E948E.png" -matte -bordercolor none -border "$margin_percent"% "DBDC800C-892D-4517-833A-8ABC465E948E.png"
1747 | else
1748 | convert -background none -font /Library/Fonts/$fontWeight -fill $fg_colour -gravity "center" -size "256x256" caption:"$glyph" +repage -depth 8 "DBDC800C-892D-4517-833A-8ABC465E948E.png"
1749 | convert "DBDC800C-892D-4517-833A-8ABC465E948E.png" -matte -bordercolor none -border "$margin_percent"% "DBDC800C-892D-4517-833A-8ABC465E948E.png"
1750 | fi
1751 |
1752 | cp -f DBDC800C-892D-4517-833A-8ABC465E948E.png F29DB020-E6BD-4876-8E0C-26A9877DD1C2.png
1753 | scriptargtype
1754 | 1
1755 | scriptfile
1756 |
1757 | type
1758 | 11
1759 |
1760 | inboundconfig
1761 |
1762 | externalid
1763 | Generate Preview
1764 |
1765 | type
1766 | alfred.workflow.action.script
1767 | uid
1768 | AC87F7F8-4F37-4551-9E7C-C0B78DEE104B
1769 | version
1770 | 2
1771 |
1772 |
1773 | config
1774 |
1775 | concurrently
1776 |
1777 | escaping
1778 | 68
1779 | script
1780 | // Set the main variable in Configuration Sheet
1781 |
1782 | ObjC.import('stdlib');
1783 | Application('com.runningwithcrayons.Alfred').setConfiguration('bg_colour', {
1784 | toValue: $.getenv('selected_colour'),
1785 | inWorkflow: $.getenv('alfred_workflow_bundleid'),
1786 | exportable: true
1787 | });
1788 |
1789 | // output selected_colour without the '#' for use in next workflow objects
1790 | $.getenv('selected_colour').replace(/#/g, "");
1791 | scriptargtype
1792 | 1
1793 | scriptfile
1794 |
1795 | type
1796 | 7
1797 |
1798 | type
1799 | alfred.workflow.action.script
1800 | uid
1801 | D6BF1098-3169-4D5B-BBA9-DBD7F6A4D138
1802 | version
1803 | 2
1804 |
1805 |
1806 | config
1807 |
1808 | concurrently
1809 |
1810 | escaping
1811 | 102
1812 | script
1813 | colour=$1
1814 | hex_colour="#$colour"
1815 | save_path="${alfred_workflow_data}/swatch_icons/background.png"
1816 |
1817 | convert -size 256x256 xc:$hex_colour "$save_path"
1818 |
1819 | # use an existing image to cut out the alpha
1820 | convert $save_path -matte $bgRoundness \
1821 | -compose DstIn -composite "$save_path"
1822 |
1823 | # add some margin around the whole icon
1824 | convert $save_path -matte -bordercolor none -border "$margin_percent"% "$save_path"
1825 | scriptargtype
1826 | 1
1827 | scriptfile
1828 |
1829 | type
1830 | 5
1831 |
1832 | type
1833 | alfred.workflow.action.script
1834 | uid
1835 | C2858A82-B228-464A-9D5B-9C692F769CDC
1836 | version
1837 | 2
1838 |
1839 |
1840 | config
1841 |
1842 | type
1843 | 0
1844 |
1845 | type
1846 | alfred.workflow.utility.transform
1847 | uid
1848 | DF5EB554-E73F-410A-83FE-59C299493C6D
1849 | version
1850 | 1
1851 |
1852 |
1853 | config
1854 |
1855 | argument
1856 | {query}
1857 | passthroughargument
1858 |
1859 | variables
1860 |
1861 | bg_colour
1862 | {var:selected_colour}
1863 |
1864 |
1865 | type
1866 | alfred.workflow.utility.argument
1867 | uid
1868 | DE724F31-C36C-4B2E-A900-A39D4B1E3F02
1869 | version
1870 | 1
1871 |
1872 |
1873 | config
1874 |
1875 | availableviaurlhandler
1876 |
1877 | triggerid
1878 | Return to icon generation
1879 |
1880 | type
1881 | alfred.workflow.trigger.external
1882 | uid
1883 | F462E9D8-4B2B-4A3A-BBFA-ECCBEEE96B14
1884 | version
1885 | 1
1886 |
1887 |
1888 | config
1889 |
1890 | externaltriggerid
1891 | Options First Run
1892 | passinputasargument
1893 |
1894 | passvariables
1895 |
1896 | workflowbundleid
1897 | self
1898 |
1899 | type
1900 | alfred.workflow.output.callexternaltrigger
1901 | uid
1902 | 396BF2BF-6D79-4B0E-8811-012F443313AA
1903 | version
1904 | 1
1905 |
1906 |
1907 | config
1908 |
1909 | argument
1910 | {query}
1911 | passthroughargument
1912 |
1913 | variables
1914 |
1915 | creating_icon
1916 | true
1917 |
1918 |
1919 | type
1920 | alfred.workflow.utility.argument
1921 | uid
1922 | 14A5240F-C023-445D-A08B-211F7D92121F
1923 | version
1924 | 1
1925 |
1926 |
1927 | config
1928 |
1929 | argument
1930 | {query}
1931 | passthroughargument
1932 |
1933 | variables
1934 |
1935 | options
1936 | 1
1937 |
1938 |
1939 | type
1940 | alfred.workflow.utility.argument
1941 | uid
1942 | 59FFA607-2846-4AA2-A124-9F64C28235C5
1943 | version
1944 | 1
1945 |
1946 |
1947 | config
1948 |
1949 | argumenttype
1950 | 2
1951 | keyword
1952 | Icon Generator
1953 | subtext
1954 |
1955 | text
1956 | Icon Generator
1957 | withspace
1958 |
1959 |
1960 | type
1961 | alfred.workflow.input.keyword
1962 | uid
1963 | 73352DE3-1237-455E-86DD-10F058887148
1964 | version
1965 | 1
1966 |
1967 |
1968 | config
1969 |
1970 | concurrently
1971 |
1972 | escaping
1973 | 102
1974 | script
1975 | python3 emoji_to_png.py "$glyph" "$output"
1976 | scriptargtype
1977 | 1
1978 | scriptfile
1979 | emoji_to_png.py
1980 | type
1981 | 8
1982 |
1983 | type
1984 | alfred.workflow.action.script
1985 | uid
1986 | A0F7228F-3AF9-471C-947A-EBAE7C94420C
1987 | version
1988 | 2
1989 |
1990 |
1991 | config
1992 |
1993 | argument
1994 |
1995 | passthroughargument
1996 |
1997 | variables
1998 |
1999 | glyph
2000 | {clipboard}
2001 | output
2002 | {var:location}/{random:UUID}.png
2003 |
2004 |
2005 | type
2006 | alfred.workflow.utility.argument
2007 | uid
2008 | 5C5DFAFA-B4E7-4A90-990D-B9DB9703F9B8
2009 | version
2010 | 1
2011 |
2012 |
2013 | config
2014 |
2015 | concurrently
2016 |
2017 | escaping
2018 | 68
2019 | script
2020 | set output to (system attribute "output")
2021 | set the clipboard to (read (POSIX file output) as {«class PNGf»})
2022 | scriptargtype
2023 | 1
2024 | scriptfile
2025 |
2026 | type
2027 | 6
2028 |
2029 | type
2030 | alfred.workflow.action.script
2031 | uid
2032 | 93CA6DBA-4A5E-4411-B779-A0B18FF2EB4C
2033 | version
2034 | 2
2035 |
2036 |
2037 | config
2038 |
2039 | conditions
2040 |
2041 |
2042 | inputstring
2043 | {var:options}
2044 | matchcasesensitive
2045 |
2046 | matchmode
2047 | 5
2048 | matchstring
2049 |
2050 | outputlabel
2051 | Show Options
2052 | uid
2053 | 4CF711AD-8D76-44E8-9102-28E91CD3CD0B
2054 |
2055 |
2056 | elselabel
2057 | Continue
2058 | hideelse
2059 |
2060 |
2061 | type
2062 | alfred.workflow.utility.conditional
2063 | uid
2064 | 029F3070-B55D-4A1D-A2B3-8EF75B13421F
2065 | version
2066 | 1
2067 |
2068 |
2069 | config
2070 |
2071 | conditions
2072 |
2073 |
2074 | inputstring
2075 | {var:glyph}
2076 | matchcasesensitive
2077 |
2078 | matchmode
2079 | 4
2080 | matchstring
2081 | \p{Extended_Pictographic}
2082 | outputlabel
2083 | is Emoji
2084 | uid
2085 | 69C95243-FAD3-4554-A02E-E3E11D3C02B7
2086 |
2087 |
2088 | elselabel
2089 | not Emoji
2090 | hideelse
2091 |
2092 |
2093 | type
2094 | alfred.workflow.utility.conditional
2095 | uid
2096 | ADD1A137-8B4B-4EFB-AF24-2899F98A95D2
2097 | version
2098 | 1
2099 |
2100 |
2101 | config
2102 |
2103 | seconds
2104 | .25
2105 |
2106 | type
2107 | alfred.workflow.utility.delay
2108 | uid
2109 | F856ED1E-689A-4536-A5A0-35E8EAAA5EE5
2110 | version
2111 | 1
2112 |
2113 |
2114 | config
2115 |
2116 | argument
2117 | {query}
2118 | passthroughargument
2119 |
2120 | variables
2121 |
2122 | options
2123 | 1
2124 |
2125 |
2126 | type
2127 | alfred.workflow.utility.argument
2128 | uid
2129 | 6381E717-93A3-4FC4-92D8-35E161FA7714
2130 | version
2131 | 1
2132 |
2133 |
2134 | config
2135 |
2136 | concurrently
2137 |
2138 | escaping
2139 | 102
2140 | script
2141 | if [ "$useBg" = 1 ]; then
2142 | convert -background $bg_colour -font /Library/Fonts/$fontWeight -fill $fg_colour -gravity "center" -size "256x256" caption:"$glyph" +repage -depth 8 "$output"
2143 | convert $output -bordercolor $bg_colour -border 5% -resize "256x256" "$output"
2144 | convert $output -matte $bgRoundness -compose DstIn -composite "$output"
2145 | convert $output -matte -bordercolor none -border "$margin_percent"% "$output"
2146 | else
2147 | convert -background none -font /Library/Fonts/$fontWeight -fill $fg_colour -gravity "center" -size "256x256" caption:"$glyph" +repage -depth 8 "$output"
2148 | convert $output -matte -bordercolor none -border "$margin_percent"% "$output"
2149 | fi
2150 | scriptargtype
2151 | 1
2152 | scriptfile
2153 |
2154 | type
2155 | 11
2156 |
2157 | type
2158 | alfred.workflow.action.script
2159 | uid
2160 | 99745CA9-3E6B-4D75-95CE-9F51AF1E6CBF
2161 | version
2162 | 2
2163 |
2164 |
2165 | config
2166 |
2167 | acceptsfiles
2168 |
2169 | acceptsmulti
2170 | 0
2171 | acceptstext
2172 |
2173 | acceptsurls
2174 |
2175 | name
2176 | Icon Generator
2177 |
2178 | type
2179 | alfred.workflow.trigger.universalaction
2180 | uid
2181 | 4E50EE8A-A0B7-4FEE-93FE-5F0EF7532709
2182 | version
2183 | 1
2184 |
2185 |
2186 | config
2187 |
2188 | argument
2189 |
2190 | passthroughargument
2191 |
2192 | variables
2193 |
2194 | glyph
2195 | {query}
2196 | output
2197 | {var:location}/{random:UUID}.png
2198 |
2199 |
2200 | type
2201 | alfred.workflow.utility.argument
2202 | uid
2203 | A6E73533-57E0-4781-8F3C-E21CB458E4C5
2204 | version
2205 | 1
2206 |
2207 |
2208 | readme
2209 | # Alfred Icon Generator
2210 |
2211 | Icon Generator will quickly convert an SF Symbol or Emoji to .png for use in workflows. It has some nice options for adjusting appearance including a configurable colour palette.
2212 |
2213 | # Dependencies:
2214 |
2215 | SF Symbols - https://developer.apple.com/sf-symbols/
2216 | ImageMagick (available via Homebrew)
2217 | Pillow for Python (available via Homebrew)
2218 | (Note: the latter two dependencies can be handled by Alfred if you are installing through the Alfred Gallery)
2219 |
2220 | # Usage
2221 |
2222 | Start by copying an emoji, or an icon in the SF Symbols app.
2223 |
2224 | Convert it to PNG with the icon generator keyword. The result will be in your clipboard.
2225 |
2226 | Alternatively, select the emoji or icon and use the Universal Action.
2227 |
2228 | You can then paste directly into Alfred.
2229 |
2230 | Hold option when running Icon Generator to configure the icon's appearance
2231 | uidata
2232 |
2233 | 00F10721-43D4-40FD-9314-A3EB924BCFE0
2234 |
2235 | xpos
2236 | 2145
2237 | ypos
2238 | 295
2239 |
2240 | 029F3070-B55D-4A1D-A2B3-8EF75B13421F
2241 |
2242 | xpos
2243 | 565
2244 | ypos
2245 | 1040
2246 |
2247 | 060CD21A-B296-472F-8FA8-F84CE56AB574
2248 |
2249 | xpos
2250 | 2490
2251 | ypos
2252 | 80
2253 |
2254 | 0F112DB8-4F31-4419-B64F-4D2F22C5CE9E
2255 |
2256 | note
2257 | Generate icon preview
2258 | xpos
2259 | 515
2260 | ypos
2261 | 395
2262 |
2263 | 14A5240F-C023-445D-A08B-211F7D92121F
2264 |
2265 | note
2266 | Flag that we are
2267 | creating an icon
2268 | so should return here
2269 | xpos
2270 | 735
2271 | ypos
2272 | 895
2273 |
2274 | 28436EEC-BCBE-420A-9366-B327D94A1814
2275 |
2276 | xpos
2277 | 1975
2278 | ypos
2279 | 430
2280 |
2281 | 2AF6EB83-6A8A-488B-AB9D-12360650E4F6
2282 |
2283 | note
2284 | Set environment variable
2285 | xpos
2286 | 1245
2287 | ypos
2288 | 320
2289 |
2290 | 2B4E492B-764C-4C73-8A11-328F6C462371
2291 |
2292 | note
2293 | Delete entry
2294 | xpos
2295 | 1840
2296 | ypos
2297 | 80
2298 |
2299 | 2CDF706A-DA6A-4E59-BCD2-9C2556317289
2300 |
2301 | xpos
2302 | 1185
2303 | ypos
2304 | 190
2305 |
2306 | 306B2655-B8A6-48EA-A6E6-1E2204F46CB7
2307 |
2308 | xpos
2309 | 1175
2310 | ypos
2311 | 375
2312 |
2313 | 314177DC-6BA0-4510-92BE-451C74FC6496
2314 |
2315 | xpos
2316 | 2495
2317 | ypos
2318 | 670
2319 |
2320 | 35D5B2B4-CF89-4A0C-8B33-6DA5CC4DF20F
2321 |
2322 | xpos
2323 | 1395
2324 | ypos
2325 | 320
2326 |
2327 | 396BF2BF-6D79-4B0E-8811-012F443313AA
2328 |
2329 | xpos
2330 | 815
2331 | ypos
2332 | 890
2333 |
2334 | 3A3F894D-00E7-4283-8996-3B119ABC6E3D
2335 |
2336 | note
2337 | System
2338 | Colour Picker
2339 | xpos
2340 | 1840
2341 | ypos
2342 | 400
2343 |
2344 | 3B30AC28-EEEA-488E-9D0D-5F425B15548B
2345 |
2346 | xpos
2347 | 1395
2348 | ypos
2349 | 155
2350 |
2351 | 4D7F6811-5901-44B6-A4B1-C56E98CC0C99
2352 |
2353 | xpos
2354 | 100
2355 | ypos
2356 | 395
2357 |
2358 | 4E50EE8A-A0B7-4FEE-93FE-5F0EF7532709
2359 |
2360 | xpos
2361 | 115
2362 | ypos
2363 | 1105
2364 |
2365 | 53C7CA30-87EE-4107-99AB-61C2E4B0A93B
2366 |
2367 | note
2368 | Generate
2369 | FG swatch preview
2370 | xpos
2371 | 2150
2372 | ypos
2373 | 585
2374 |
2375 | 59FFA607-2846-4AA2-A124-9F64C28235C5
2376 |
2377 | xpos
2378 | 280
2379 | ypos
2380 | 915
2381 |
2382 | 5B12AB9D-AA76-4239-9AC3-3E23B5FFFE24
2383 |
2384 | xpos
2385 | 1550
2386 | ypos
2387 | 545
2388 |
2389 | 5C5DFAFA-B4E7-4A90-990D-B9DB9703F9B8
2390 |
2391 | xpos
2392 | 375
2393 | ypos
2394 | 970
2395 |
2396 | 6381E717-93A3-4FC4-92D8-35E161FA7714
2397 |
2398 | xpos
2399 | 285
2400 | ypos
2401 | 1070
2402 |
2403 | 7176BEA1-7AF6-481A-B04F-D1F0854D6BC7
2404 |
2405 | xpos
2406 | 1175
2407 | ypos
2408 | 330
2409 |
2410 | 73352DE3-1237-455E-86DD-10F058887148
2411 |
2412 | xpos
2413 | 110
2414 | ypos
2415 | 940
2416 |
2417 | 76557CB6-CADE-4EFD-97EE-C519C1511CED
2418 |
2419 | note
2420 | Set a preview glyph
2421 | xpos
2422 | 335
2423 | ypos
2424 | 425
2425 |
2426 | 79248429-2E61-4DBF-B5C8-D92DBFE16586
2427 |
2428 | xpos
2429 | 1210
2430 | ypos
2431 | 470
2432 |
2433 | 7AEC5654-124E-4EA5-9B6C-AA1AB9BC2F44
2434 |
2435 | xpos
2436 | 2020
2437 | ypos
2438 | 425
2439 |
2440 | 7E62E27C-8A4A-456E-8991-E85D30917869
2441 |
2442 | note
2443 | Generate
2444 | swatch preview
2445 | xpos
2446 | 2280
2447 | ypos
2448 | 405
2449 |
2450 | 83240BF3-7852-428A-81DA-A62F65211658
2451 |
2452 | xpos
2453 | 910
2454 | ypos
2455 | 385
2456 |
2457 | 85CB9C50-C573-4740-91E9-A1CE2E113117
2458 |
2459 | note
2460 | Set environment variable
2461 | xpos
2462 | 1970
2463 | ypos
2464 | 585
2465 |
2466 | 93CA6DBA-4A5E-4411-B779-A0B18FF2EB4C
2467 |
2468 | note
2469 | Put file onto clipboard
2470 | xpos
2471 | 1760
2472 | ypos
2473 | 1035
2474 |
2475 | 99745CA9-3E6B-4D75-95CE-9F51AF1E6CBF
2476 |
2477 | note
2478 | Generate Icon
2479 | with ImageMagick
2480 | xpos
2481 | 1510
2482 | ypos
2483 | 1100
2484 |
2485 | A0F7228F-3AF9-471C-947A-EBAE7C94420C
2486 |
2487 | note
2488 | Generate Emoji Icon
2489 | with Pillow
2490 | xpos
2491 | 1510
2492 | ypos
2493 | 945
2494 |
2495 | A6E73533-57E0-4781-8F3C-E21CB458E4C5
2496 |
2497 | xpos
2498 | 375
2499 | ypos
2500 | 1135
2501 |
2502 | AC87F7F8-4F37-4551-9E7C-C0B78DEE104B
2503 |
2504 | note
2505 | Generate icon preview
2506 | Saving this over
2507 | workflow object icons
2508 | in workflow folder
2509 | xpos
2510 | 2355
2511 | ypos
2512 | 670
2513 |
2514 | ADD1A137-8B4B-4EFB-AF24-2899F98A95D2
2515 |
2516 | xpos
2517 | 1285
2518 | ypos
2519 | 1055
2520 |
2521 | C2858A82-B228-464A-9D5B-9C692F769CDC
2522 |
2523 | note
2524 | Generate
2525 | BG swatch preview
2526 | xpos
2527 | 2150
2528 | ypos
2529 | 730
2530 |
2531 | C39C186A-9E22-4B02-A8E7-795B3D83F82D
2532 |
2533 | xpos
2534 | 1610
2535 | ypos
2536 | 520
2537 |
2538 | D6BF1098-3169-4D5B-BBA9-DBD7F6A4D138
2539 |
2540 | note
2541 | Set environment variable
2542 | xpos
2543 | 1970
2544 | ypos
2545 | 730
2546 |
2547 | DA61D3A2-976B-407E-B752-DBA5447F6274
2548 |
2549 | xpos
2550 | 2100
2551 | ypos
2552 | 615
2553 |
2554 | DBDC800C-892D-4517-833A-8ABC465E948E
2555 |
2556 | note
2557 | Options Menu
2558 | --- Note ---
2559 | The icon for this object
2560 | is being replaced dynamically
2561 | xpos
2562 | 710
2563 | ypos
2564 | 395
2565 |
2566 | DE724F31-C36C-4B2E-A900-A39D4B1E3F02
2567 |
2568 | note
2569 | Force bg_colour to update in session
2570 | xpos
2571 | 1885
2572 | ypos
2573 | 760
2574 |
2575 | DF5EB554-E73F-410A-83FE-59C299493C6D
2576 |
2577 | xpos
2578 | 2100
2579 | ypos
2580 | 760
2581 |
2582 | E4E00064-6141-4E70-B0CD-F8FE19C44ACB
2583 |
2584 | xpos
2585 | 1210
2586 | ypos
2587 | 530
2588 |
2589 | E8E25D44-5E74-4492-8C4A-51A4573F8BFB
2590 |
2591 | note
2592 | Force fg_colour to update in session
2593 | xpos
2594 | 1885
2595 | ypos
2596 | 615
2597 |
2598 | EDE2383D-B36D-4BA9-A7FA-0D3BB869D8BD
2599 |
2600 | xpos
2601 | 1755
2602 | ypos
2603 | 670
2604 |
2605 | EFA6895F-9D07-484D-BF29-75EE2B9873B3
2606 |
2607 | note
2608 | Append entry
2609 | to JSON
2610 | xpos
2611 | 2145
2612 | ypos
2613 | 405
2614 |
2615 | F29DB020-E6BD-4876-8E0C-26A9877DD1C2
2616 |
2617 | note
2618 | Swatch Picker Menu
2619 | --- Note ---
2620 | The icon for this object
2621 | is being replaced dynamically
2622 | xpos
2623 | 1360
2624 | ypos
2625 | 490
2626 |
2627 | F2CED950-18E4-4714-8B51-C280012DF8BD
2628 |
2629 | xpos
2630 | 1840
2631 | ypos
2632 | 240
2633 |
2634 | F462E9D8-4B2B-4A3A-BBFA-ECCBEEE96B14
2635 |
2636 | xpos
2637 | 1080
2638 | ypos
2639 | 890
2640 |
2641 | F856ED1E-689A-4536-A5A0-35E8EAAA5EE5
2642 |
2643 | xpos
2644 | 1700
2645 | ypos
2646 | 1065
2647 |
2648 |
2649 | userconfigurationconfig
2650 |
2651 |
2652 | config
2653 |
2654 | default
2655 | #1E1F29
2656 | placeholder
2657 | #1E1F29
2658 | required
2659 |
2660 | trim
2661 |
2662 |
2663 | description
2664 |
2665 | label
2666 | Foreground Colour
2667 | type
2668 | textfield
2669 | variable
2670 | fg_colour
2671 |
2672 |
2673 | config
2674 |
2675 | default
2676 | #E2E2E2
2677 | placeholder
2678 | #E2E2E2
2679 | required
2680 |
2681 | trim
2682 |
2683 |
2684 | description
2685 |
2686 | label
2687 | Background Colour
2688 | type
2689 | textfield
2690 | variable
2691 | bg_colour
2692 |
2693 |
2694 | config
2695 |
2696 | default
2697 |
2698 | required
2699 |
2700 | text
2701 |
2702 |
2703 | description
2704 |
2705 | label
2706 | Use Background?
2707 | type
2708 | checkbox
2709 | variable
2710 | useBg
2711 |
2712 |
2713 | config
2714 |
2715 | default
2716 | mask_medium.png
2717 | pairs
2718 |
2719 |
2720 | High
2721 | mask_high.png
2722 |
2723 |
2724 | Medium
2725 | mask_medium.png
2726 |
2727 |
2728 | Low
2729 | mask_low.png
2730 |
2731 |
2732 |
2733 | description
2734 |
2735 | label
2736 | Background Roundness
2737 | type
2738 | popupbutton
2739 | variable
2740 | bgRoundness
2741 |
2742 |
2743 | config
2744 |
2745 | default
2746 | SF-Pro-Display-Semibold.otf
2747 | pairs
2748 |
2749 |
2750 | Ultralight
2751 | SF-Pro-Display-Ultralight.otf
2752 |
2753 |
2754 | Thin
2755 | SF-Pro-Display-Thin.otf
2756 |
2757 |
2758 | Light
2759 | SF-Pro-Display-Light.otf
2760 |
2761 |
2762 | Regular
2763 | SF-Pro-Display-Regular.otf
2764 |
2765 |
2766 | Medium
2767 | SF-Pro-Display-Medium.otf
2768 |
2769 |
2770 | Semibold
2771 | SF-Pro-Display-Semibold.otf
2772 |
2773 |
2774 | Bold
2775 | SF-Pro-Display-Bold.otf
2776 |
2777 |
2778 | Heavy
2779 | SF-Pro-Display-Heavy.otf
2780 |
2781 |
2782 | Black
2783 | SF-Pro-Display-Black.otf
2784 |
2785 |
2786 |
2787 | description
2788 |
2789 | label
2790 | Choose Symbol Weight
2791 | type
2792 | popupbutton
2793 | variable
2794 | fontWeight
2795 |
2796 |
2797 | config
2798 |
2799 | default
2800 | 0
2801 | placeholder
2802 | 0
2803 | required
2804 |
2805 | trim
2806 |
2807 |
2808 | description
2809 | Additional margin around the icon.
2810 | Around 0 to 10 works best.
2811 | label
2812 | Margin
2813 | type
2814 | textfield
2815 | variable
2816 | margin_percent
2817 |
2818 |
2819 | config
2820 |
2821 | default
2822 | /tmp
2823 | filtermode
2824 | 1
2825 | placeholder
2826 |
2827 | required
2828 |
2829 |
2830 | description
2831 | By default, generated icons are saved to temporary storage. To save them elsewhere, set a location.
2832 | label
2833 | Location for Saving
2834 | type
2835 | filepicker
2836 | variable
2837 | location
2838 |
2839 |
2840 | variablesdontexport
2841 |
2842 | version
2843 | 3.3.0
2844 | webaddress
2845 | https://github.com/NeighNeighNeigh/Alfred_IconGenerator
2846 |
2847 |
2848 |
--------------------------------------------------------------------------------
/Workflow/mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/mask.png
--------------------------------------------------------------------------------
/Workflow/mask_high.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/mask_high.png
--------------------------------------------------------------------------------
/Workflow/mask_low.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/mask_low.png
--------------------------------------------------------------------------------
/Workflow/mask_medium.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/mask_medium.png
--------------------------------------------------------------------------------
/Workflow/options_menu.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 |
3 | import json
4 | import os
5 |
6 |
7 |
8 | json_data = '''
9 | {
10 | "items": [
11 | {
12 | "title": "Done",
13 | "arg": "done",
14 | "icon": {
15 | "path": "icons/bg_colour.png"
16 | }
17 | },
18 | {
19 | "title": "Foreground Colour",
20 | "arg": "choose_fg",
21 | "icon": {
22 | "path": "icons/fg_colour.png"
23 | }
24 | },
25 | {
26 | "title": "Background Colour",
27 | "arg": "choose_bg",
28 | "icon": {
29 | "path": "icons/bg_colour.png"
30 | }
31 | }
32 | ]
33 | }
34 | '''
35 |
36 | icon_paths = {
37 | "Foreground Colour": os.path.join(os.getenv("alfred_workflow_data"), "swatch_icons/foreground.png"),
38 | "Background Colour": os.path.join(os.getenv("alfred_workflow_data"), "swatch_icons/background.png"),
39 | "Done": "done.png"
40 | }
41 |
42 | data = json.loads(json_data)
43 |
44 | for item in data['items']:
45 | title = item['title']
46 | if title in icon_paths:
47 | item['icon']['path'] = icon_paths[title]
48 |
49 | # New entry to be added
50 | bg_yes = {
51 | "title": "Background Enabled",
52 | "arg": "bg_yes",
53 | "icon": {
54 | "path": "use_bg_yes.png"
55 | }
56 | }
57 |
58 | # New entry to be added
59 | bg_no = {
60 | "title": "Background Disabled",
61 | "arg": "bg_no",
62 | "icon": {
63 | "path": "use_bg_no.png"
64 | }
65 | }
66 |
67 | #get useBg
68 | useBg = os.getenv("useBg")
69 |
70 |
71 | # Insert the new entries at the end of the list
72 | if useBg == "1":
73 | data["items"].append(bg_yes)
74 | else:
75 | data["items"].append(bg_no)
76 |
77 | new_json_data = json.dumps(data, indent=4)
78 |
79 | print(new_json_data)
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/Workflow/prefs.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | bg_colour
6 | #50FA7B
7 | margin_percent
8 | 5
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Workflow/swatch_picker.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 |
3 | import json
4 | import os
5 | import shutil
6 |
7 | alfred_workflow_data = os.getenv("alfred_workflow_data")
8 | alfred_preferences = os.getenv("alfred_preferences")
9 | alfred_workflow_uid = os.getenv("alfred_workflow_uid")
10 |
11 | # Set defaults path
12 | defaults_path = os.path.join(alfred_preferences, "workflows", alfred_workflow_uid, "defaults")
13 |
14 | # Set input path
15 | input_path = os.path.join(alfred_workflow_data, "swatch.json")
16 |
17 |
18 | # NOTE: I'm doing this earlier on now, in the first configuration shell script
19 | # # Check if input_path exists
20 | # if not os.path.exists(input_path): # NOTE: I should add a check in here to see if the icon folder exists too
21 | # # Copy files and folders from defaults_path to alfred_workflow_data
22 | # shutil.copytree(defaults_path, alfred_workflow_data, dirs_exist_ok=True)
23 |
24 |
25 | # Read the JSON file
26 | with open(input_path) as file:
27 | input_json = json.load(file)
28 |
29 | # Add workflow data path to the beginning of every icon path
30 | for item in input_json["items"]:
31 | item["icon"]["path"] = alfred_workflow_data + "/swatch_icons/" + item["icon"]["path"]
32 |
33 |
34 | # New entry to be added
35 | back = {
36 | "title": "Back",
37 | "arg": "back",
38 | "icon": {
39 | "path": "back.png"
40 | }
41 | }
42 |
43 | # New entry to be added
44 | add_swatch = {
45 | "title": "Add Swatch",
46 | "subtitle": "Hold option to remove a swatch",
47 | "arg": "new_swatch",
48 | "icon": {
49 | "path": "add_swatch.png"
50 | }
51 | }
52 |
53 | # Insert the new entries to the list of items
54 | input_json["items"].insert(0, add_swatch)
55 | input_json["items"].insert(0, back)
56 |
57 | # Overflow check
58 | # Check if there are more entries in the list than currently visible
59 | if len(input_json["items"]) > 9:
60 | # Add "subtitle" to the 7th entry
61 | input_json["items"][8]["subtitle"] = "Scroll for more swatches…"
62 |
63 |
64 | json_data = json.dumps(input_json, indent=4)
65 |
66 | print(json_data)
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/Workflow/use_bg_no.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/use_bg_no.png
--------------------------------------------------------------------------------
/Workflow/use_bg_yes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NeighNeighNeigh/Alfred_IconGenerator/5051461acc5afa6666428ad1d4d56722959205fb/Workflow/use_bg_yes.png
--------------------------------------------------------------------------------