forked from ladybug-tools/ladybug-blender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_icons.py
39 lines (36 loc) · 1.37 KB
/
generate_icons.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
from distutils.dir_util import copy_tree
class IconsGenerator:
def __init__(self, runtime):
self.runtime = runtime
self.out_path = f"{self.runtime.build_path}icons{os.path.sep}"
def generate(self):
# Copy Icons from Package Downloader to the build path
copy_tree(
self.runtime.package.icon_path,
self.out_path
)
# Loop through the modules
for module_name in self.runtime.package.schemas:
spec = self.runtime.package.schemas[module_name]
icon_path = os.path.join(self.runtime.package.icon_path, 'lb_{}.png'.format(spec['nickname'].lower()))
os.rename(
os.path.join(self.runtime.package.icon_path, '{}.png'.format(module_name.replace('_', ' '))),
icon_path)
# This incantation reverts the intensity channel in HSI.
# It will make light colors darker, and dark colors lighter
# TODO: Implement ImageMagick
# subprocess.run([
# 'convert',
# icon_path,
# '-colorspace',
# 'HSI',
# '-channel',
# 'B',
# '-level',
# '100,0%',
# '+channel',
# '-colorspace',
# 'sRGB',
# icon_path
# ])