Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .github/assets/hero.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions docs/screenshots/hero.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* flow-render-canvas: 1500x500 */
/* README banner: plugin name on the left, an enlarged launcher window cut off at the bottom right. */

/* Google Fonts (latin subset); @font-face rather than @import, which only works at the top of a stylesheet */
@font-face {
font-family: 'Inter';
font-weight: 700;
font-display: block;
src: url(https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuFuYAZ9hiA.woff2) format('woff2');
}

@font-face {
font-family: 'JetBrains Mono';
font-weight: 400;
font-display: block;
src: url(https://fonts.gstatic.com/s/jetbrainsmono/v24/tDbY2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKxTOlOV.woff2) format('woff2');
}
html,
body {
margin: 0;
width: 1500px;
height: 500px;
overflow: hidden;
}

body {
position: relative;
}

/* on the wrapper rather than body, which would paint the whole canvas and hide the rounded corners */
body > div {
position: absolute;
inset: 0;
overflow: hidden;
border-radius: 20px;
background:
radial-gradient(ellipse 900px 420px at 88% -10%, rgba(24, 188, 242, 0.22), transparent 70%),
linear-gradient(135deg, #121214 0%, #1b1c20 100%);
}

body::before,
body::after {
position: absolute;
z-index: 1;
left: 80px;
color: #ffffff;
}

body::before {
content: "ha-commander";
top: 160px;
font: 700 64px 'Inter', sans-serif;
}

body::after {
content: "search & control Home Assistant";
top: 252px;
color: #b8b8bc;
font: 20px 'JetBrains Mono', monospace;
}

#Preview {
position: absolute;
left: 620px;
top: 48px;
display: block;
width: auto;
height: auto;
transform: scale(1.5);
transform-origin: top left;
}

#WindowBorder {
margin: 0;
}
31 changes: 31 additions & 0 deletions docs/screenshots/hero.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"keyword": "ha",
"query": "living",
"icon": "../../data/icon.png",
"max_results": 4,
"selection": 0,
"results": [
{
"title": "Living Room Lights",
"subtitle": "[Light] On",
"glyph": "lightbulb"
},
{
"title": "Living Room TV",
"subtitle": "[Media Player] Playing",
"glyph": "cast-connected"
},
{
"title": "Living Room Thermostat",
"subtitle": "[Climate] Heat",
"glyph": "thermostat"
},
{
"title": "Living Room Fan",
"subtitle": "[Fan] On",
"glyph": "fan"
}
],
"query_suggestion": "",
"show_caret": true
}
13 changes: 4 additions & 9 deletions docs/screenshots/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
ASSETS_DIR = ROOT / ".github" / "assets"
PLUGIN_ASSETS = ROOT / "src" / "plugin" / "assets"
THEMES = {"dark": "#FFFFFF", "light": "#1B1B1B"}
HERO = {"shot": "search", "theme": "light", "css": "hero-win11-accent.css"}
HERO_WIDTH = 1600
HERO = {"shot": "hero", "theme": "dark", "css": ["win11-dark.css", "docs/screenshots/hero.css"]}

CODEPOINTS = json.loads((PLUGIN_ASSETS / "icons.json").read_text(encoding="utf-8"))["icons"]
FONT = ImageFont.truetype(str(PLUGIN_ASSETS / "materialdesignicons-webfont.ttf"), 112)
Expand All @@ -40,7 +39,7 @@ def glyph_png(name: str, color: str, out_dir: Path) -> Path:

def flow_render(args, out_path: Path) -> None:
with tempfile.TemporaryDirectory() as out_dir:
subprocess.run(["flow-render", *args, "-o", out_dir], check=True)
subprocess.run(["flow-render", *args, "-o", out_dir], check=True, cwd=ROOT)
(rendered,) = Path(out_dir).glob("*.png")
shutil.move(str(rendered), out_path)
print(f"Wrote {out_path}")
Expand All @@ -58,17 +57,13 @@ def render_config(shot: str, theme: str, css: str, out_path: Path, work: Path) -


def main() -> None:
shots = sorted(path.stem for path in SHOTS_DIR.glob("*.json"))
shots = sorted(path.stem for path in SHOTS_DIR.glob("*.json") if path.stem != HERO["shot"])
with tempfile.TemporaryDirectory() as tmp:
work = Path(tmp)
for shot in shots:
for theme in THEMES:
render_config(shot, theme, f"win11-{theme}.css", ASSETS_DIR / f"{shot}-{theme}.png", work)
hero = ASSETS_DIR / "hero.png"
render_config(HERO["shot"], HERO["theme"], HERO["css"], hero, work)
with Image.open(hero) as image:
image = image.resize((HERO_WIDTH, round(image.height * HERO_WIDTH / image.width)), Image.LANCZOS)
image.save(hero, optimize=True)
render_config(HERO["shot"], HERO["theme"], HERO["css"], ASSETS_DIR / "hero.png", work)

package = subprocess.run([str(ROOT / "scripts" / "package.sh"), str(work / "dist")], check=True, capture_output=True, text=True)
plugin_zip = package.stdout.strip().splitlines()[-1]
Expand Down
Loading