Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of all icons #634

Closed
CrashLaker opened this issue Dec 11, 2021 · 7 comments
Closed

List of all icons #634

CrashLaker opened this issue Dec 11, 2021 · 7 comments

Comments

@CrashLaker
Copy link

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
Copy link
Author

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

@clayms
Copy link

clayms commented Dec 15, 2021

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

Here is what I did:
#466 (comment)

@CrashLaker
Copy link
Author

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

@askpatrickw
Copy link

This would be a great addition to the docs.

@nvictor
Copy link
Contributor

nvictor commented Apr 8, 2022

Also see: #624

@mingrammer
Copy link
Owner

I think #499 is enough.

@mingrammer
Copy link
Owner

The website is updated by #499.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants