返回提交历史
Modified
g4f/tray.py
+8
-19
XFEstudio/gpt4free
Refactor tray icon SVG and rendering size for improved clarity and aesthetics
7cb5a843
代码差异
1 个文件
+8
-19
@@ -26,21 +26,10 @@ _G4F_SVG = """\
26
26
<stop offset="0%" style="stop-color:#6e48aa"/>
27
27
<stop offset="100%" style="stop-color:#4776E6"/>
28
28
</linearGradient>
29
<filter id="glow">
30
<feGaussianBlur stdDeviation="3" result="blur"/>
31
<feMerge>
32
<feMergeNode in="blur"/>
33
<feMergeNode in="SourceGraphic"/>
34
</feMerge>
35
</filter>
36
<filter id="shadow">
37
<feDropShadow dx="0" dy="4" stdDeviation="10" flood-color="#1a1a2e" flood-opacity="0.5"/>
38
</filter>
39
29
</defs>
40
<circle cx="256" cy="256" r="240" fill="url(#bgGrad)" filter="url(#shadow)"/>
41
<circle cx="256" cy="256" r="210" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1.5"/>
42
<text x="250" y="328" font-family="Arial,Helvetica,sans-serif" font-size="194" font-weight="900"
43
fill="#f8f9fa" text-anchor="middle" letter-spacing="-5" filter="url(#glow)">G4F</text>
30
<circle cx="256" cy="256" r="256" fill="url(#bgGrad)"/>
31
<text x="256" y="328" font-family="Arial,Helvetica,sans-serif" font-size="194" font-weight="900"
32
fill="#f8f9fa" text-anchor="middle" letter-spacing="-5">G4F</text>
44
33
</svg>"""
45
34
46
35
@@ -63,8 +52,8 @@ def _make_icon():
63
52
import cairosvg
64
53
png_bytes = cairosvg.svg2png(
65
54
bytestring=_G4F_SVG.encode(),
66
output_width=64,
67
output_height=64,
55
output_width=16,
56
output_height=16,
68
57
)
69
58
return Image.open(io.BytesIO(png_bytes)).convert("RGBA")
70
59
except Exception:
@@ -76,15 +65,15 @@ def _make_icon():
76
65
except ImportError:
77
66
return None
78
67
79
size = 64
68
size = 256
80
69
img = Image.new("RGBA", (size, size), (0, 0, 0, 0))
81
70
draw = ImageDraw.Draw(img)
82
71
83
72
# Gradient-ish background (approximate purple→blue)
84
draw.ellipse([2, 2, size - 2, size - 2], fill=(110, 72, 170, 255))
73
draw.ellipse([4, 4, size - 4, size - 4], fill=(110, 72, 170, 255))
85
74
86
75
try:
87
font = ImageFont.truetype("arial.ttf", 18)
76
font = ImageFont.truetype("arial.ttf", 72)
88
77
except Exception:
89
78
font = ImageFont.load_default()
90
79