Added optional line to have keys WITHIN names rather than exclusively at start of name

This commit is contained in:
Katzlab 2024-01-20 16:44:02 -05:00 committed by GitHub
parent 3ec22ac4ac
commit 719ce9bb9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -250,6 +250,9 @@ def color(file, args):
for leaf in tree:
keys = sorted([key for key in colors if leaf.name.startswith(key)], key = lambda x : -len(x))
# the line below allows you to have keys anywhere within name and not just start of name.. to use, you have to # the line above
#keys = sorted([key for key in colors if key in leaf.name], key=lambda x: -len(x))
if len(keys) > 0:
if '[&!color=' in colors[keys[0]]:
leaf_colors.append(leaf.name + colors[keys[0]])