The sword: tray icon, favicon, header logo and a backdrop for the web UI
- The-Kurgan-Sword.png is the source. kurgan/assets/make_assets.py cleans it
(drops the white fringe left by the cut-out, smooths the edge to about a
pixel) and builds everything from it:
- kurgan/assets/kurgan.ico: the tray icon, 16-256 px, cropped to the
crossguard; sizes of 32 px and under are brightened a little so the
metal still reads on a dark taskbar.
- web/static/favicon.ico: the same crop, 16-48 px.
- web/static/logo.png: the header logo, the whole sword with the cut-off
blade faded out.
- web/static/sword-vertical.png: the whole sword turned 90 degrees
clockwise.
- tray.py: ICON_PATH replaces the drawn power-tank icon (make_icon is gone).
app.py already imports ICON_PATH; it went in with f717f7a.
- style.css: the vertical sword is a fixed backdrop below the header, lined
up with the right edge of the tiles; the cards are 90% opaque so it shows
through. 90% keeps the grey text at 4.5:1 contrast or better over the
sword in both themes; 80% dropped it to 3.4:1.
- favicon.svg removed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f717f7a82f
commit
8cc1e9223f
12 files changed
+153
-53
No files matched your search
+4
-38
@@ -18,11 +18,14 @@ from __future__ import annotations
|
||||
import ctypes
|
||||
import ctypes.wintypes as wt
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import threading
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
# The sword's hilt, 16-256 px (made by kurgan/assets/make_assets.py from The-Kurgan-Sword.png).
|
||||
ICON_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "assets", "kurgan.ico")
|
||||
TASK_NAME = "The Kurgan"
|
||||
LEGACY_TASK_NAME = "TT LCD Dashboard" # until setup.ps1 re-registers the task
|
||||
|
||||
@@ -84,37 +87,6 @@ def set_autostart(on: bool) -> None:
|
||||
_powershell(_SET.replace("%TASK%", name).replace("%ON%", "$true" if on else "$false"))
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------- icon image
|
||||
|
||||
def make_icon(path: str, layers: list[tuple[int, int, int]]) -> str:
|
||||
"""Draw a small version of the dashboard's power tank and save it as a .ico file.
|
||||
|
||||
layers: colours from the bottom up (other, CPU, GPU).
|
||||
"""
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
s = 256
|
||||
img = Image.new("RGBA", (s, s), (0, 0, 0, 0))
|
||||
d = ImageDraw.Draw(img)
|
||||
chrome, dark = (206, 206, 212, 255), (20, 20, 24, 255)
|
||||
x0, x1 = 52, 204 # glass
|
||||
d.rectangle([x0, 30, x1, 226], fill=dark)
|
||||
y = 226
|
||||
for h, c in zip((50, 42, 56), layers): # bottom up
|
||||
d.rectangle([x0, y - h, x1, y], fill=c + (255,))
|
||||
y -= h
|
||||
d.rectangle([x0, y - 3, x1, y + 3], fill=dark)
|
||||
hl = Image.new("RGBA", (s, s), (0, 0, 0, 0))
|
||||
ImageDraw.Draw(hl).rectangle([x0 + 22, 36, x0 + 40, 222], fill=(255, 255, 255, 70))
|
||||
img.alpha_composite(hl)
|
||||
d = ImageDraw.Draw(img)
|
||||
for y0, y1 in ((4, 40), (216, 252)): # end caps
|
||||
d.rounded_rectangle([28, y0, 228, y1], radius=12, fill=chrome)
|
||||
d.rectangle([28, (y0 + y1) // 2 - 2, 228, (y0 + y1) // 2 + 2], fill=(120, 120, 128, 255))
|
||||
img.save(path, sizes=[(16, 16), (20, 20), (24, 24), (32, 32), (40, 40), (48, 48), (64, 64)])
|
||||
return path
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------- Win32
|
||||
|
||||
_u32 = ctypes.WinDLL("user32", use_last_error=True)
|
||||
@@ -418,16 +390,10 @@ class TrayIcon:
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Quick check: show the icon for 20 s with a test tooltip.
|
||||
import os
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format="%(levelname)s %(message)s")
|
||||
print("Start with Windows:", autostart_enabled())
|
||||
path = make_icon(os.path.join(tempfile.gettempdir(), "kurgan_tray_test.ico"),
|
||||
[(217, 89, 38), (57, 135, 229), (25, 158, 112)])
|
||||
done = threading.Event()
|
||||
tray = TrayIcon("The Kurgan (test)", path, on_exit=done.set, status_lines=lambda: ["Test run"])
|
||||
tray = TrayIcon("The Kurgan (test)", ICON_PATH, on_exit=done.set, status_lines=lambda: ["Test run"])
|
||||
tray.start()
|
||||
for i in range(20):
|
||||
tray.set_tooltip(f"The Kurgan (test)\n{i} s")
|
||||
|
||||
Reference in new issue
Block a user