4 Star 4 Fork 2

Gitee 极速下载/Fluent-System-Icons

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/microsoft/fluentui-system-icons
克隆/下载
generate_icons_md.py 1.90 KB
一键复制 编辑 原始数据 按行查看 历史
Nick Romano 提交于 2020-07-29 19:57 . Show all weights in icon sheet (#63)
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
from collections import defaultdict
def to_camel_case(snake_str):
components = snake_str.split("_")
return components[0] + "".join(x.title() for x in components[1:])
with open("icons.md", "w") as icons_md:
icons_md.write("<!-- This file is generated using generate_icons_md.py -->\n")
icons_md.write("# Icons\n")
icons_md.write("\n")
icons_md.write("|Name|Icon|iOS|Android|\n")
icons_md.write("|---|---|---|---|\n")
for asset_dir in sorted(os.listdir("assets")):
if asset_dir == ".DS_Store":
continue
largest_svg_icon_path_by_weight = {}
ios_references_by_weight = defaultdict(list)
android_references_by_weight = defaultdict(list)
weights = set()
pdf_dir = os.path.join("assets", asset_dir, "PDF")
for filename in sorted(os.listdir(pdf_dir)):
components = filename.replace(".pdf", "").split("_")[2:]
weight = components[-1]
weights.add(weight)
ios_references_by_weight[weight].append(f'`{to_camel_case("_".join(components))}`')
svg_dir = os.path.join("assets", asset_dir, "SVG")
for filename in sorted(os.listdir(svg_dir)):
weight = filename.split("_")[-1].replace(".svg", "")
weights.add(weight)
android_references_by_weight[weight].append(f'`{filename.replace(".svg", "")}`')
largest_svg_icon_path_by_weight[weight] = filename
for weight in sorted(weights, reverse=True):
icons_md.write(
f"|{asset_dir} ({weight.title()})"
f'|<img src="{svg_dir}/{largest_svg_icon_path_by_weight[weight]}?raw=true" width="24" height="24">'
f'|{"<br />".join(ios_references_by_weight[weight])}'
f'|{"<br />".join(android_references_by_weight[weight])}|\n'
)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/mirrors/Fluent-System-Icons.git
git@gitee.com:mirrors/Fluent-System-Icons.git
mirrors
Fluent-System-Icons
Fluent-System-Icons
1.1.53

搜索帮助