diagrams
diagrams copied to clipboard
List of all icons
Hi all!
Amazing project. Wondering if there's a way to have a view of all icons like in a gallery or grid.
Regards, C.
well.. better than nothing
rootfolder = "/opt/conda/lib/python3.7/site-packages/resources"
html = ["""
<style>
ul {
list-style: none;
}
</style>
"""]
html.append("<ul>")
def looprun(folder):
print("folder", folder)
for filename in os.listdir(folder):
filepath = folder+"/"+filename
if os.path.isdir(filepath):
html.append("<li style='clear:both;'>")
html.append(filename)
html.append("<ul>")
looprun(filepath)
html.append("</ul>")
html.append("</li>")
else:
if not filename.endswith(".png"): continue
bg = 'gray' if 'white' in filename else 'white'
html.append(f"<li style='float:left;background:{bg};'>")
html.append(f"<img src='{filepath}' style='height:40px;' title='{filepath}'/>")
html.append("</li>")
looprun(rootfolder)
html.append("</ul>")
@CrashLaker Can you also put the name under each icon?
Here is what I did: https://github.com/mingrammer/diagrams/issues/466#issuecomment-782722682
hi @clayms , hmmm interesting you've made one using Diagrams itself pretty neat!
what i did
html.append(f"<li style='float:left;background:{bg};margin:2px;position:relative;'>")
html.append(f"<img src='{imgb64}' style='height:40px;' title='{filepath}'/>")
html.append(f"<span style='opacity:0.4;position:absolute;font-size:8px;left:0px;bottom:-5px;'>{filename}</span>")
html.append("</li>")
just to make them searchable
you could also
temp = ["diagrams"] + filepath.replace(rootfolder+'/', '').split("/")
cmds.append(" from " + ".".join(temp) + " import *")
then
for cmd in sorted(list(set(cmds)):
print(cmd)
from diagrams.alibabacloud import *
from diagrams.alibabacloud.analytics import *
from diagrams.alibabacloud.application import *
from diagrams.alibabacloud.communication import *
from diagrams.alibabacloud.compute import *
from diagrams.alibabacloud.database import *
from diagrams.alibabacloud.iot import *
from diagrams.alibabacloud.network import *
from diagrams.alibabacloud.security import *
from diagrams.alibabacloud.storage import *
from diagrams.alibabacloud.web import *
from diagrams.aws import *
from diagrams.aws.analytics import *
from diagrams.aws.ar import *
from diagrams.aws.blockchain import *
from diagrams.aws.business import *
from diagrams.aws.compute import *
from diagrams.aws.cost import *
from diagrams.aws.database import *
from diagrams.aws.devtools import *
....
This would be a great addition to the docs.
Also see: #624
I think https://github.com/mingrammer/diagrams/pull/499 is enough.
The website is updated by https://github.com/mingrammer/diagrams/pull/499.