The weather widget's icons/layout are hand-drawn PIL primitives -- clean under quantization but flat, no gradients/shadows. Adds an opt-in render_style="modern" (current/daily modes only) that instead renders a Jinja2 template through a persistent headless-Chromium browser (app/html_render.py), following the approach of Tesserae, an open-source e-ink dashboard targeting this same panel family. Key design points: - The Chromium dependency (Playwright) is lazily imported only when a weather widget actually uses "modern" style, and the background browser itself only launches on first use -- every other widget type, and this one's own classic/hourly/multi_city paths, never pay for it. - No Frame-level dithering setting needed: html_render dithers its own rendered widget to exact palette colors (Bayer/ordered, not Floyd-Steinberg) before compositing, so the shared whole-canvas Floyd-Steinberg pass sees zero quantization error there and leaves it untouched -- same trick draw_text/hand-drawn icons already use. Floyd- Steinberg keeps working unchanged for photos and every other widget. - A "Load calibrated Spectra 6 preset" button in Advanced configuration offers a community-measured palette (data ported from paperlesspaper/epdoptimize, Apache 2.0) as an alternative starting point to the existing idealized DEFAULT_PALETTE_RGB -- fills the existing palette table, doesn't save by itself. Known open risk, not resolved here: a headless Chromium binary is far larger than the ~100MB single-layer limit that already forced this project's pip/npm installs into split layers, and (unlike those) is a single ~180MB file that can't be split across layers by ordinary Dockerfile restructuring. Flagged prominently in server/Dockerfile and docs/widgets.md -- treat this render style as experimental/local-only until that's resolved.
52 lines
1.9 KiB
Django/Jinja
52 lines
1.9 KiB
Django/Jinja
<!doctype html>
|
|
<html><head><style>
|
|
@font-face { font-family: "Inter"; src: url("file://{{ font_dir }}/Inter-Regular.ttf"); font-weight: 400; }
|
|
@font-face { font-family: "Inter"; src: url("file://{{ font_dir }}/Inter-Bold.ttf"); font-weight: 700; }
|
|
* { margin: 0; padding: 0; box-sizing: border-box; font-family: "Inter", sans-serif; }
|
|
body { width: {{ w }}px; height: {{ h }}px; background: #ffffff; }
|
|
.card {
|
|
width: {{ w - gutter * 2 }}px;
|
|
height: {{ h - gutter * 2 }}px;
|
|
margin: {{ gutter }}px;
|
|
border-radius: {{ radius }}px;
|
|
overflow: hidden;
|
|
box-shadow: 0 4px 14px rgba(0, 20, 60, 0.25);
|
|
background: #ffffff;
|
|
}
|
|
.header {
|
|
height: {{ header_h }}px;
|
|
background: linear-gradient(135deg, {{ accent_start }} 0%, {{ accent_end }} 100%);
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0 16px;
|
|
}
|
|
.header .title { color: #ffffff; font-weight: 700; font-size: {{ title_size }}px; }
|
|
.body { display: flex; height: calc(100% - {{ header_h }}px); padding: 12px 8px; }
|
|
.col {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 5px;
|
|
}
|
|
.day { font-weight: 600; font-size: {{ label_size }}px; color: #17233b; }
|
|
.icon { font-size: {{ icon_size }}px; line-height: 1; }
|
|
.temps { font-weight: 700; font-size: {{ label_size }}px; color: #17233b; }
|
|
.temps .low { color: #6b7788; font-weight: 400; }
|
|
</style></head>
|
|
<body>
|
|
<div class="card">
|
|
{% if city_label %}<div class="header"><div class="title">{{ city_label }}</div></div>{% endif %}
|
|
<div class="body">
|
|
{% for d in days %}
|
|
<div class="col">
|
|
<div class="day">{{ d.label }}</div>
|
|
<div class="icon">{{ d.emoji }}</div>
|
|
<div class="temps">{{ d.high }}°<span class="low">/{{ d.low }}°{{ unit_suffix }}</span></div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</body></html>
|