Skip to content

Commit

Permalink
新增SVG
Browse files Browse the repository at this point in the history
  • Loading branch information
lunzhiPenxil committed Dec 25, 2023
1 parent a046a6d commit be938ce
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 扩展市场

![json](./script/1.svg)
![json](./script/JSON.svg)

本仓库用于供应扩展文件内容和对应的接口

Expand Down
21 changes: 0 additions & 21 deletions script/1.svg

This file was deleted.

21 changes: 21 additions & 0 deletions script/JSON.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions script/releaseDeck.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
from urllib import parse
import codecs

dictMappping = {
'classic': 'JSON',
'yaml': 'YAML',
'excel': 'XLSX'
}

dictCount = {
'classic': 0,
'yaml': 0,
'excel': 0
}

def formatUTF8WithBOM(data:bytes):
res = data
Expand Down Expand Up @@ -115,3 +126,31 @@ def formatUTF8WithBOM(data:bytes):
f.write(json.dumps(index_data, indent=4, ensure_ascii=False))
shutil.copyfile('../target/deck/index.json', '../deck/index.json')
print('releaseDeck done!')

for typeName in dictCount:
str_this = f'''<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="130" height="20" role="img" aria-label="JSON">
<title>test: test</title>
<linearGradient id="s" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="r">
<rect width="80" height="20" rx="10" fill="#fff"/>
</clipPath>
<g clip-path="url(#r)">
<rect width="40" height="20" fill="#555"/>
<rect x="40" width="130" height="20" fill="#007ec6"/>
<rect width="130" height="20" fill="url(#s)"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110">
<text aria-hidden="true" x="210" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="">{dictMappping.get(typeName, "N/A")}</text>
<text x="210" y="140" transform="scale(.1)" fill="#fff" textLength="">{dictMappping.get(typeName, "N/A")}</text>
<text aria-hidden="true" x="580" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="">{dictCount.get(typeName, "N/A")}</text>
<text x="580" y="140" transform="scale(.1)" fill="#fff" textLength="">{dictCount.get(typeName, "N/A")}</text>
</g>
</svg>
'''
with open(f'../target/deck/{typeName}.svg', 'w', encoding='utf-8') as f:
f.write(str_this)

print('releaseSvg done!')

0 comments on commit be938ce

Please sign in to comment.