TsukiNi22/ai-utils / skills/docs/html-style
html-style
VerifiedThe user's visual style for any HTML page (taken from html-doc - R-Type doc colors + context-forge layout) - color tokens for the light and dark themes, system font stacks and type scale, spacing / radius / layout / breakpoints, components (top bar, cards, callouts, tables, code blocks with copy, content tabs, sidebar, pager, SVG diagram classes, sun/moon theme switch, EN/FR switch), rules (responsive on phone, tablet, TV and touch screens, self-contained, no CDN / web font / gradient / emoji, WCAG contrast in both themes) - with scripts to build a self-contained page (new_page.py) and check a page or a palette (check_style.py). Use whenever creating or restyling an HTML page, a small web tool, a dashboard or a page component for the user, or when defining / changing a palette, color, font or theme, unless the user asks for another style.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 16.2 KB |
| scripts/check_render.pyexecutable | script | 27.1 KB |
| scripts/check_style.pyexecutable | script | 25.1 KB |
| scripts/new_page.pyexecutable | script | 4.0 KB |
| scripts/set_logo.pyexecutable | script | 6.1 KB |
| scripts/sync_nav.pyexecutable | script | 7.3 KB |
| templates/base.js | script | 20.1 KB |
| templates/page.html | other | 2.6 KB |
| templates/style.css | other | 25.2 KB |
scripts/new_page.py
View on GitHub#!/usr/bin/env python3
"""
Build a self-contained HTML page in the user's style: templates/page.html with templates/style.css and
templates/base.js inlined, the given body, extra CSS / JS (inlined after the base ones) and the placeholders filled.
Usage:
new_page.py <body.html> -o <out.html> [--css extra.css ...] [--js extra.js ...] [--actions actions.html]
[--lang-switch] [--attr NAME=VALUE ...] [--set KEY=VALUE ...] [--force]
- <body.html>: content of the page layout (an optional <aside class="sidebar" id="sidebar"> + <main>), may hold
{{KEY}} placeholders too.
- --actions: HTML put in the top right actions, before the theme switch (other switches, links).
- --lang-switch: adds the EN | FR pill (bilingual page, [data-lang] / [data-i18n] content).
- --attr: attributes added to <html> (data-page=explain data-nav-title=AES data-default-level=technical).
- --set: placeholders (PROJECT, TITLE, STORAGE_KEY, FOOTER...); STORAGE_KEY defaults to the output file name,
FOOTER and VERSION (badge next to the name, hidden when empty) to an empty string. A placeholder left unfilled is reported (exit 1).
"""
import argparse
import html
import re
import sys
from pathlib import Path
SKILL = Path(__file__).resolve().parent.parent
LANG_SWITCH = """<div class="lang-switch" role="group" aria-label="Language" data-i18n-aria-label>
<button type="button" data-set-lang="en" class="on">EN</button>
<button type="button" data-set-lang="fr">FR</button>
</div>
<span class="divider" aria-hidden="true"></span>"""
def read(paths):
return "\n".join(Path(p).read_text(encoding="utf-8") for p in paths)
def main():
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument("body")
ap.add_argument("-o", "--out", required=True)
ap.add_argument("--css", nargs="*", default=[])
ap.add_argument("--js", nargs="*", default=[])
ap.add_argument("--actions", default="")
ap.add_argument("--lang-switch", action="store_true")
ap.add_argument("--attr", nargs="*", default=[], metavar="NAME=VALUE")
ap.add_argument("--set", nargs="*", default=[], metavar="KEY=VALUE")
ap.add_argument("--force", action="store_true", help="overwrite an existing output")
a = ap.parse_args()
out = Path(a.out)
if out.exists() and not a.force:
sys.exit(f"Error: {out} exists (--force to overwrite)")
values = {"STORAGE_KEY": out.stem, "FOOTER": "", "VERSION": ""}
for kv in a.set:
if "=" not in kv:
sys.exit(f"Error: --set expects KEY=VALUE, got '{kv}'")
k, v = kv.split("=", 1)
values[k] = v
actions = (LANG_SWITCH if a.lang_switch else "") + (read([a.actions]) if a.actions else "")
page = (SKILL / "templates" / "page.html").read_text(encoding="utf-8")
page = page.replace("/*@STYLE@*/", read([SKILL / "templates" / "style.css", *a.css]).rstrip())
page = page.replace("/*@SCRIPT@*/", read([SKILL / "templates" / "base.js", *a.js]).rstrip())
page = page.replace("<!--@ACTIONS@-->", actions)
body = Path(a.body).read_text(encoding="utf-8").strip()
if re.search(r"<main>", body): # the target of the skip link (RGAA 12.7), focusable by the link only
body = body.replace("<main>", '<main id="main" tabindex="-1">', 1)
page = page.replace("<!--@BODY@-->", body)
for kv in a.attr:
if "=" not in kv:
sys.exit(f"Error: --attr expects NAME=VALUE, got '{kv}'")
n, v = kv.split("=", 1)
page = page.replace("<html ", f'<html {n}="{html.escape(v)}" ', 1)
page = re.sub(r"\{\{([A-Z_]+)\}\}", lambda m: values.get(m.group(1), m.group(0)), page)
out.parent.mkdir(parents=True, exist_ok=True)
out.write_text(page, encoding="utf-8")
left = sorted(set(re.findall(r"\{\{[A-Z_]+\}\}", page)))
print(f"{out} ({len(page) // 1024} KB)")
if left:
print("unfilled placeholders: " + ", ".join(left) + " (--set KEY=VALUE or edit the page)")
sys.exit(1)
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |