diagrams icon indicating copy to clipboard operation
diagrams copied to clipboard

List of all icons

Open CrashLaker opened this issue 2 years ago • 5 comments

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.

CrashLaker avatar Dec 11 '21 13:12 CrashLaker

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>")

image

CrashLaker avatar Dec 11 '21 14:12 CrashLaker

@CrashLaker Can you also put the name under each icon?

Here is what I did: https://github.com/mingrammer/diagrams/issues/466#issuecomment-782722682

clayms avatar Dec 15 '21 00:12 clayms

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 image

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 *
....

CrashLaker avatar Dec 15 '21 00:12 CrashLaker

This would be a great addition to the docs.

askpatrickw avatar Jan 12 '22 23:01 askpatrickw

Also see: #624

nvictor avatar Apr 08 '22 13:04 nvictor

I think https://github.com/mingrammer/diagrams/pull/499 is enough.

mingrammer avatar Nov 04 '22 10:11 mingrammer

The website is updated by https://github.com/mingrammer/diagrams/pull/499.

mingrammer avatar Nov 08 '22 12:11 mingrammer