Sync all skills and memories 2026-04-14 07:27
This commit is contained in:
78
skills/.bundled_manifest
Normal file
78
skills/.bundled_manifest
Normal file
@@ -0,0 +1,78 @@
|
||||
apple-notes:16ffca134c5590714781d8aeef51f8f3
|
||||
apple-reminders:0273a9a17f6d07c55c84735c4366186b
|
||||
arxiv:0ad5eb32727a1cb2bbff9e1e8e4dbff7
|
||||
ascii-art:5b776ddc3e15abda4d6c23014e3b374c
|
||||
ascii-video:93697173a0a33f7ecb7c4dc1c27f80e8
|
||||
audiocraft-audio-generation:41d06b6ec94d1cdb3d864efe452780fd
|
||||
axolotl:710b8e88805a85efc461dcd70c937cae
|
||||
blogwatcher:d0b55ef6acff9ad26f1febace610ca3b
|
||||
claude-code:1b94564fef16f64eefe3902c6f376ffb
|
||||
clip:2a3807ccf83a39e5b981884e5a34ef5f
|
||||
codebase-inspection:5b1f99e926f347fe7c8c2658c9cc15b9
|
||||
codex:79bb6b5d9b47453cd0d7ac25df5a3c97
|
||||
dogfood:fc03244c3237e6b7325dc8aef387f2e3
|
||||
dspy:5e0770e2563d11d9d4cc040681277c1c
|
||||
evaluating-llms-harness:d9cd486dd94740c9e0400258759a8f54
|
||||
excalidraw:1679ad1d31a591fa3cb636d9150adcc7
|
||||
find-nearby:5266ed5c0fc9add7f1d5bb4c70ed0d29
|
||||
findmy:bd50940d7b0104f6d6bf8981fc54b827
|
||||
fine-tuning-with-trl:51db2b30e3b9394a932a5ccc3430a4a1
|
||||
gguf-quantization:5133185768fa3dd303ae7bd79f99bad0
|
||||
gif-search:fe5b39e269439d0af2705d7462dc844d
|
||||
github-auth:909ef9bbff492b214a625179f704c09a
|
||||
github-code-review:8bbf670174d05e171e813f85069bada0
|
||||
github-issues:ecb864a88aeea8f88f5b8742fec8806b
|
||||
github-pr-workflow:cab1d57b84e253dddff37bd212f469ca
|
||||
github-repo-management:5c79dd94f418ccd6d297b80fefa1be65
|
||||
godmode:31081226028b5ceff6331a05597fdcb9
|
||||
google-workspace:4556f46c7f13cf7025e1b3742c380082
|
||||
grpo-rl-training:3465d05607abbb04d266c56c58cc5a1d
|
||||
guidance:91a9c28434674575077a9a8fc222f559
|
||||
heartmula:ce53b2e6c9d68238cae5ae727738ecde
|
||||
hermes-agent:e06bc84458f08955d92232bad28f2f60
|
||||
himalaya:1c94b92d224366ab22b10c01d835178f
|
||||
huggingface-hub:14002a449cb5f9a5ff8bdc7f730bcb2f
|
||||
ideation:ed7f67fb2da05b2d85fd798c4b5dd913
|
||||
imessage:f545da0f5cc64dd9ee1ffd2b7733a11b
|
||||
jupyter-live-kernel:6bda9690d8c71095ac738bd9825e32f2
|
||||
linear:a0273574b97ca56dd74f2a398b0fc9c3
|
||||
llama-cpp:ea44fc1c259f0d570c8c9dfcaba5b3e5
|
||||
llm-wiki:f901eecc4f5bec39ca787d173e311c60
|
||||
manim-video:86ba8c24fdd57771d68bea812d3b2466
|
||||
mcporter:a1736a8c1837ea3a9b157b759af675d7
|
||||
minecraft-modpack-server:3cc682f8aef5f86d3580601ba28f9ba3
|
||||
modal-serverless-gpu:957d93b8e4bf44fb229a0466df169f36
|
||||
nano-pdf:7ad841b6a7879ac1ad74579c0e8d6f97
|
||||
native-mcp:a8644a4f45c8403c1ad3342230b5c154
|
||||
notion:ac54a68c490d4cf1604bc24160083d43
|
||||
obliteratus:98dfcbfcad4416d27d5dcbd0a491d772
|
||||
obsidian:1dde562f384c6dc5eaec0b7c214caab4
|
||||
ocr-and-documents:0fe461668b245d894370b8b40c3eb012
|
||||
opencode:e3583bfa72da47385f6466eaf226faef
|
||||
openhue:0487b4695a071cc62da64c79935bc8d1
|
||||
outlines:8efbd31f1252f6c8fb340db4d9dcce2f
|
||||
p5js:80de285f6ef54c19c22e4eafd1877fe4
|
||||
peft-fine-tuning:72f5c4becba0b358cb7baf8a983f7ec5
|
||||
plan:86a38cbbed14813087a6c3edb5058cde
|
||||
pokemon-player:2a30ed51c1179b22967fb4a33e6e57e4
|
||||
polymarket:b4a7d758f2fb29efb290dce1094cc625
|
||||
popular-web-designs:a77ef442dcf747d8d534f5acb6b6f0cf
|
||||
powerpoint:57052a3c399e7b357e7fbf85e4ae3978
|
||||
pytorch-fsdp:bf252a436e718d7c0a864a786674809a
|
||||
requesting-code-review:f9cc90df11a9ce1cc23595c574eacd75
|
||||
research-paper-writing:a5be1df03d86c08ed5378e9f1c18c702
|
||||
segment-anything-model:e21f0c842d399668483c440b7943c5d5
|
||||
serving-llms-vllm:a8b5453a5316da8df055a0f23c3cbd25
|
||||
songsee:7fd11900a2b71aa070b2c52a5c24c614
|
||||
songwriting-and-ai-music:236e0d189a2e7e87b9f080a52ed9188e
|
||||
stable-diffusion-image-generation:4538853049abaf8c4810f3b9d958b4d3
|
||||
subagent-driven-development:c0fc6b8a5f450d03a7f77f9bee4628c8
|
||||
systematic-debugging:883a52bedd09b321dc6441114dace445
|
||||
test-driven-development:2e4bab04e2e2bf6a7742f88115690503
|
||||
unsloth:fe249a8fcdcfc4f6e266fe8c6d3f4e82
|
||||
webhook-subscriptions:783bdd39b8a4fe54ef6482bc03846ed4
|
||||
weights-and-biases:91fd048a0b693f6d74a4639ea08bbd1d
|
||||
whisper:9b61b7c196526aff5d10091e06740e69
|
||||
writing-plans:5b72a4318524fd7ffb37fd43e51e3954
|
||||
xitter:64e1c2cc22acef46a448832c237178c5
|
||||
youtube-content:c448e213097433492d51a063d34eb9ae
|
||||
3
skills/apple/DESCRIPTION.md
Normal file
3
skills/apple/DESCRIPTION.md
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
description: Apple/macOS-specific skills — iMessage, Reminders, Notes, FindMy, and macOS automation. These skills only load on macOS systems.
|
||||
---
|
||||
90
skills/apple/apple-notes/SKILL.md
Normal file
90
skills/apple/apple-notes/SKILL.md
Normal file
@@ -0,0 +1,90 @@
|
||||
---
|
||||
name: apple-notes
|
||||
description: Manage Apple Notes via the memo CLI on macOS (create, view, search, edit).
|
||||
version: 1.0.0
|
||||
author: Hermes Agent
|
||||
license: MIT
|
||||
platforms: [macos]
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [Notes, Apple, macOS, note-taking]
|
||||
related_skills: [obsidian]
|
||||
prerequisites:
|
||||
commands: [memo]
|
||||
---
|
||||
|
||||
# Apple Notes
|
||||
|
||||
Use `memo` to manage Apple Notes directly from the terminal. Notes sync across all Apple devices via iCloud.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **macOS** with Notes.app
|
||||
- Install: `brew tap antoniorodr/memo && brew install antoniorodr/memo/memo`
|
||||
- Grant Automation access to Notes.app when prompted (System Settings → Privacy → Automation)
|
||||
|
||||
## When to Use
|
||||
|
||||
- User asks to create, view, or search Apple Notes
|
||||
- Saving information to Notes.app for cross-device access
|
||||
- Organizing notes into folders
|
||||
- Exporting notes to Markdown/HTML
|
||||
|
||||
## When NOT to Use
|
||||
|
||||
- Obsidian vault management → use the `obsidian` skill
|
||||
- Bear Notes → separate app (not supported here)
|
||||
- Quick agent-only notes → use the `memory` tool instead
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### View Notes
|
||||
|
||||
```bash
|
||||
memo notes # List all notes
|
||||
memo notes -f "Folder Name" # Filter by folder
|
||||
memo notes -s "query" # Search notes (fuzzy)
|
||||
```
|
||||
|
||||
### Create Notes
|
||||
|
||||
```bash
|
||||
memo notes -a # Interactive editor
|
||||
memo notes -a "Note Title" # Quick add with title
|
||||
```
|
||||
|
||||
### Edit Notes
|
||||
|
||||
```bash
|
||||
memo notes -e # Interactive selection to edit
|
||||
```
|
||||
|
||||
### Delete Notes
|
||||
|
||||
```bash
|
||||
memo notes -d # Interactive selection to delete
|
||||
```
|
||||
|
||||
### Move Notes
|
||||
|
||||
```bash
|
||||
memo notes -m # Move note to folder (interactive)
|
||||
```
|
||||
|
||||
### Export Notes
|
||||
|
||||
```bash
|
||||
memo notes -ex # Export to HTML/Markdown
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
- Cannot edit notes containing images or attachments
|
||||
- Interactive prompts require terminal access (use pty=true if needed)
|
||||
- macOS only — requires Apple Notes.app
|
||||
|
||||
## Rules
|
||||
|
||||
1. Prefer Apple Notes when user wants cross-device sync (iPhone/iPad/Mac)
|
||||
2. Use the `memory` tool for agent-internal notes that don't need to sync
|
||||
3. Use the `obsidian` skill for Markdown-native knowledge management
|
||||
98
skills/apple/apple-reminders/SKILL.md
Normal file
98
skills/apple/apple-reminders/SKILL.md
Normal file
@@ -0,0 +1,98 @@
|
||||
---
|
||||
name: apple-reminders
|
||||
description: Manage Apple Reminders via remindctl CLI (list, add, complete, delete).
|
||||
version: 1.0.0
|
||||
author: Hermes Agent
|
||||
license: MIT
|
||||
platforms: [macos]
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [Reminders, tasks, todo, macOS, Apple]
|
||||
prerequisites:
|
||||
commands: [remindctl]
|
||||
---
|
||||
|
||||
# Apple Reminders
|
||||
|
||||
Use `remindctl` to manage Apple Reminders directly from the terminal. Tasks sync across all Apple devices via iCloud.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **macOS** with Reminders.app
|
||||
- Install: `brew install steipete/tap/remindctl`
|
||||
- Grant Reminders permission when prompted
|
||||
- Check: `remindctl status` / Request: `remindctl authorize`
|
||||
|
||||
## When to Use
|
||||
|
||||
- User mentions "reminder" or "Reminders app"
|
||||
- Creating personal to-dos with due dates that sync to iOS
|
||||
- Managing Apple Reminders lists
|
||||
- User wants tasks to appear on their iPhone/iPad
|
||||
|
||||
## When NOT to Use
|
||||
|
||||
- Scheduling agent alerts → use the cronjob tool instead
|
||||
- Calendar events → use Apple Calendar or Google Calendar
|
||||
- Project task management → use GitHub Issues, Notion, etc.
|
||||
- If user says "remind me" but means an agent alert → clarify first
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### View Reminders
|
||||
|
||||
```bash
|
||||
remindctl # Today's reminders
|
||||
remindctl today # Today
|
||||
remindctl tomorrow # Tomorrow
|
||||
remindctl week # This week
|
||||
remindctl overdue # Past due
|
||||
remindctl all # Everything
|
||||
remindctl 2026-01-04 # Specific date
|
||||
```
|
||||
|
||||
### Manage Lists
|
||||
|
||||
```bash
|
||||
remindctl list # List all lists
|
||||
remindctl list Work # Show specific list
|
||||
remindctl list Projects --create # Create list
|
||||
remindctl list Work --delete # Delete list
|
||||
```
|
||||
|
||||
### Create Reminders
|
||||
|
||||
```bash
|
||||
remindctl add "Buy milk"
|
||||
remindctl add --title "Call mom" --list Personal --due tomorrow
|
||||
remindctl add --title "Meeting prep" --due "2026-02-15 09:00"
|
||||
```
|
||||
|
||||
### Complete / Delete
|
||||
|
||||
```bash
|
||||
remindctl complete 1 2 3 # Complete by ID
|
||||
remindctl delete 4A83 --force # Delete by ID
|
||||
```
|
||||
|
||||
### Output Formats
|
||||
|
||||
```bash
|
||||
remindctl today --json # JSON for scripting
|
||||
remindctl today --plain # TSV format
|
||||
remindctl today --quiet # Counts only
|
||||
```
|
||||
|
||||
## Date Formats
|
||||
|
||||
Accepted by `--due` and date filters:
|
||||
- `today`, `tomorrow`, `yesterday`
|
||||
- `YYYY-MM-DD`
|
||||
- `YYYY-MM-DD HH:mm`
|
||||
- ISO 8601 (`2026-01-04T12:34:56Z`)
|
||||
|
||||
## Rules
|
||||
|
||||
1. When user says "remind me", clarify: Apple Reminders (syncs to phone) vs agent cronjob alert
|
||||
2. Always confirm reminder content and due date before creating
|
||||
3. Use `--json` for programmatic parsing
|
||||
131
skills/apple/findmy/SKILL.md
Normal file
131
skills/apple/findmy/SKILL.md
Normal file
@@ -0,0 +1,131 @@
|
||||
---
|
||||
name: findmy
|
||||
description: Track Apple devices and AirTags via FindMy.app on macOS using AppleScript and screen capture.
|
||||
version: 1.0.0
|
||||
author: Hermes Agent
|
||||
license: MIT
|
||||
platforms: [macos]
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [FindMy, AirTag, location, tracking, macOS, Apple]
|
||||
---
|
||||
|
||||
# Find My (Apple)
|
||||
|
||||
Track Apple devices and AirTags via the FindMy.app on macOS. Since Apple doesn't
|
||||
provide a CLI for FindMy, this skill uses AppleScript to open the app and
|
||||
screen capture to read device locations.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **macOS** with Find My app and iCloud signed in
|
||||
- Devices/AirTags already registered in Find My
|
||||
- Screen Recording permission for terminal (System Settings → Privacy → Screen Recording)
|
||||
- **Optional but recommended**: Install `peekaboo` for better UI automation:
|
||||
`brew install steipete/tap/peekaboo`
|
||||
|
||||
## When to Use
|
||||
|
||||
- User asks "where is my [device/cat/keys/bag]?"
|
||||
- Tracking AirTag locations
|
||||
- Checking device locations (iPhone, iPad, Mac, AirPods)
|
||||
- Monitoring pet or item movement over time (AirTag patrol routes)
|
||||
|
||||
## Method 1: AppleScript + Screenshot (Basic)
|
||||
|
||||
### Open FindMy and Navigate
|
||||
|
||||
```bash
|
||||
# Open Find My app
|
||||
osascript -e 'tell application "FindMy" to activate'
|
||||
|
||||
# Wait for it to load
|
||||
sleep 3
|
||||
|
||||
# Take a screenshot of the Find My window
|
||||
screencapture -w -o /tmp/findmy.png
|
||||
```
|
||||
|
||||
Then use `vision_analyze` to read the screenshot:
|
||||
```
|
||||
vision_analyze(image_url="/tmp/findmy.png", question="What devices/items are shown and what are their locations?")
|
||||
```
|
||||
|
||||
### Switch Between Tabs
|
||||
|
||||
```bash
|
||||
# Switch to Devices tab
|
||||
osascript -e '
|
||||
tell application "System Events"
|
||||
tell process "FindMy"
|
||||
click button "Devices" of toolbar 1 of window 1
|
||||
end tell
|
||||
end tell'
|
||||
|
||||
# Switch to Items tab (AirTags)
|
||||
osascript -e '
|
||||
tell application "System Events"
|
||||
tell process "FindMy"
|
||||
click button "Items" of toolbar 1 of window 1
|
||||
end tell
|
||||
end tell'
|
||||
```
|
||||
|
||||
## Method 2: Peekaboo UI Automation (Recommended)
|
||||
|
||||
If `peekaboo` is installed, use it for more reliable UI interaction:
|
||||
|
||||
```bash
|
||||
# Open Find My
|
||||
osascript -e 'tell application "FindMy" to activate'
|
||||
sleep 3
|
||||
|
||||
# Capture and annotate the UI
|
||||
peekaboo see --app "FindMy" --annotate --path /tmp/findmy-ui.png
|
||||
|
||||
# Click on a specific device/item by element ID
|
||||
peekaboo click --on B3 --app "FindMy"
|
||||
|
||||
# Capture the detail view
|
||||
peekaboo image --app "FindMy" --path /tmp/findmy-detail.png
|
||||
```
|
||||
|
||||
Then analyze with vision:
|
||||
```
|
||||
vision_analyze(image_url="/tmp/findmy-detail.png", question="What is the location shown for this device/item? Include address and coordinates if visible.")
|
||||
```
|
||||
|
||||
## Workflow: Track AirTag Location Over Time
|
||||
|
||||
For monitoring an AirTag (e.g., tracking a cat's patrol route):
|
||||
|
||||
```bash
|
||||
# 1. Open FindMy to Items tab
|
||||
osascript -e 'tell application "FindMy" to activate'
|
||||
sleep 3
|
||||
|
||||
# 2. Click on the AirTag item (stay on page — AirTag only updates when page is open)
|
||||
|
||||
# 3. Periodically capture location
|
||||
while true; do
|
||||
screencapture -w -o /tmp/findmy-$(date +%H%M%S).png
|
||||
sleep 300 # Every 5 minutes
|
||||
done
|
||||
```
|
||||
|
||||
Analyze each screenshot with vision to extract coordinates, then compile a route.
|
||||
|
||||
## Limitations
|
||||
|
||||
- FindMy has **no CLI or API** — must use UI automation
|
||||
- AirTags only update location while the FindMy page is actively displayed
|
||||
- Location accuracy depends on nearby Apple devices in the FindMy network
|
||||
- Screen Recording permission required for screenshots
|
||||
- AppleScript UI automation may break across macOS versions
|
||||
|
||||
## Rules
|
||||
|
||||
1. Keep FindMy app in the foreground when tracking AirTags (updates stop when minimized)
|
||||
2. Use `vision_analyze` to read screenshot content — don't try to parse pixels
|
||||
3. For ongoing tracking, use a cronjob to periodically capture and log locations
|
||||
4. Respect privacy — only track devices/items the user owns
|
||||
102
skills/apple/imessage/SKILL.md
Normal file
102
skills/apple/imessage/SKILL.md
Normal file
@@ -0,0 +1,102 @@
|
||||
---
|
||||
name: imessage
|
||||
description: Send and receive iMessages/SMS via the imsg CLI on macOS.
|
||||
version: 1.0.0
|
||||
author: Hermes Agent
|
||||
license: MIT
|
||||
platforms: [macos]
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [iMessage, SMS, messaging, macOS, Apple]
|
||||
prerequisites:
|
||||
commands: [imsg]
|
||||
---
|
||||
|
||||
# iMessage
|
||||
|
||||
Use `imsg` to read and send iMessage/SMS via macOS Messages.app.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **macOS** with Messages.app signed in
|
||||
- Install: `brew install steipete/tap/imsg`
|
||||
- Grant Full Disk Access for terminal (System Settings → Privacy → Full Disk Access)
|
||||
- Grant Automation permission for Messages.app when prompted
|
||||
|
||||
## When to Use
|
||||
|
||||
- User asks to send an iMessage or text message
|
||||
- Reading iMessage conversation history
|
||||
- Checking recent Messages.app chats
|
||||
- Sending to phone numbers or Apple IDs
|
||||
|
||||
## When NOT to Use
|
||||
|
||||
- Telegram/Discord/Slack/WhatsApp messages → use the appropriate gateway channel
|
||||
- Group chat management (adding/removing members) → not supported
|
||||
- Bulk/mass messaging → always confirm with user first
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### List Chats
|
||||
|
||||
```bash
|
||||
imsg chats --limit 10 --json
|
||||
```
|
||||
|
||||
### View History
|
||||
|
||||
```bash
|
||||
# By chat ID
|
||||
imsg history --chat-id 1 --limit 20 --json
|
||||
|
||||
# With attachments info
|
||||
imsg history --chat-id 1 --limit 20 --attachments --json
|
||||
```
|
||||
|
||||
### Send Messages
|
||||
|
||||
```bash
|
||||
# Text only
|
||||
imsg send --to "+14155551212" --text "Hello!"
|
||||
|
||||
# With attachment
|
||||
imsg send --to "+14155551212" --text "Check this out" --file /path/to/image.jpg
|
||||
|
||||
# Force iMessage or SMS
|
||||
imsg send --to "+14155551212" --text "Hi" --service imessage
|
||||
imsg send --to "+14155551212" --text "Hi" --service sms
|
||||
```
|
||||
|
||||
### Watch for New Messages
|
||||
|
||||
```bash
|
||||
imsg watch --chat-id 1 --attachments
|
||||
```
|
||||
|
||||
## Service Options
|
||||
|
||||
- `--service imessage` — Force iMessage (requires recipient has iMessage)
|
||||
- `--service sms` — Force SMS (green bubble)
|
||||
- `--service auto` — Let Messages.app decide (default)
|
||||
|
||||
## Rules
|
||||
|
||||
1. **Always confirm recipient and message content** before sending
|
||||
2. **Never send to unknown numbers** without explicit user approval
|
||||
3. **Verify file paths** exist before attaching
|
||||
4. **Don't spam** — rate-limit yourself
|
||||
|
||||
## Example Workflow
|
||||
|
||||
User: "Text mom that I'll be late"
|
||||
|
||||
```bash
|
||||
# 1. Find mom's chat
|
||||
imsg chats --limit 20 --json | jq '.[] | select(.displayName | contains("Mom"))'
|
||||
|
||||
# 2. Confirm with user: "Found Mom at +1555123456. Send 'I'll be late' via iMessage?"
|
||||
|
||||
# 3. Send after confirmation
|
||||
imsg send --to "+1555123456" --text "I'll be late"
|
||||
```
|
||||
3
skills/autonomous-ai-agents/DESCRIPTION.md
Normal file
3
skills/autonomous-ai-agents/DESCRIPTION.md
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
description: Skills for spawning and orchestrating autonomous AI coding agents and multi-agent workflows — running independent agent processes, delegating tasks, and coordinating parallel workstreams.
|
||||
---
|
||||
744
skills/autonomous-ai-agents/claude-code/SKILL.md
Normal file
744
skills/autonomous-ai-agents/claude-code/SKILL.md
Normal file
@@ -0,0 +1,744 @@
|
||||
---
|
||||
name: claude-code
|
||||
description: Delegate coding tasks to Claude Code (Anthropic's CLI agent). Use for building features, refactoring, PR reviews, and iterative coding. Requires the claude CLI installed.
|
||||
version: 2.2.0
|
||||
author: Hermes Agent + Teknium
|
||||
license: MIT
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [Coding-Agent, Claude, Anthropic, Code-Review, Refactoring, PTY, Automation]
|
||||
related_skills: [codex, hermes-agent, opencode]
|
||||
---
|
||||
|
||||
# Claude Code — Hermes Orchestration Guide
|
||||
|
||||
Delegate coding tasks to [Claude Code](https://code.claude.com/docs/en/cli-reference) (Anthropic's autonomous coding agent CLI) via the Hermes terminal. Claude Code v2.x can read files, write code, run shell commands, spawn subagents, and manage git workflows autonomously.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **Install:** `npm install -g @anthropic-ai/claude-code`
|
||||
- **Auth:** run `claude` once to log in (browser OAuth for Pro/Max, or set `ANTHROPIC_API_KEY`)
|
||||
- **Console auth:** `claude auth login --console` for API key billing
|
||||
- **SSO auth:** `claude auth login --sso` for Enterprise
|
||||
- **Check status:** `claude auth status` (JSON) or `claude auth status --text` (human-readable)
|
||||
- **Health check:** `claude doctor` — checks auto-updater and installation health
|
||||
- **Version check:** `claude --version` (requires v2.x+)
|
||||
- **Update:** `claude update` or `claude upgrade`
|
||||
|
||||
## Two Orchestration Modes
|
||||
|
||||
Hermes interacts with Claude Code in two fundamentally different ways. Choose based on the task.
|
||||
|
||||
### Mode 1: Print Mode (`-p`) — Non-Interactive (PREFERRED for most tasks)
|
||||
|
||||
Print mode runs a one-shot task, returns the result, and exits. No PTY needed. No interactive prompts. This is the cleanest integration path.
|
||||
|
||||
```
|
||||
terminal(command="claude -p 'Add error handling to all API calls in src/' --allowedTools 'Read,Edit' --max-turns 10", workdir="/path/to/project", timeout=120)
|
||||
```
|
||||
|
||||
**When to use print mode:**
|
||||
- One-shot coding tasks (fix a bug, add a feature, refactor)
|
||||
- CI/CD automation and scripting
|
||||
- Structured data extraction with `--json-schema`
|
||||
- Piped input processing (`cat file | claude -p "analyze this"`)
|
||||
- Any task where you don't need multi-turn conversation
|
||||
|
||||
**Print mode skips ALL interactive dialogs** — no workspace trust prompt, no permission confirmations. This makes it ideal for automation.
|
||||
|
||||
### Mode 2: Interactive PTY via tmux — Multi-Turn Sessions
|
||||
|
||||
Interactive mode gives you a full conversational REPL where you can send follow-up prompts, use slash commands, and watch Claude work in real time. **Requires tmux orchestration.**
|
||||
|
||||
```
|
||||
# Start a tmux session
|
||||
terminal(command="tmux new-session -d -s claude-work -x 140 -y 40")
|
||||
|
||||
# Launch Claude Code inside it
|
||||
terminal(command="tmux send-keys -t claude-work 'cd /path/to/project && claude' Enter")
|
||||
|
||||
# Wait for startup, then send your task
|
||||
# (after ~3-5 seconds for the welcome screen)
|
||||
terminal(command="sleep 5 && tmux send-keys -t claude-work 'Refactor the auth module to use JWT tokens' Enter")
|
||||
|
||||
# Monitor progress by capturing the pane
|
||||
terminal(command="sleep 15 && tmux capture-pane -t claude-work -p -S -50")
|
||||
|
||||
# Send follow-up tasks
|
||||
terminal(command="tmux send-keys -t claude-work 'Now add unit tests for the new JWT code' Enter")
|
||||
|
||||
# Exit when done
|
||||
terminal(command="tmux send-keys -t claude-work '/exit' Enter")
|
||||
```
|
||||
|
||||
**When to use interactive mode:**
|
||||
- Multi-turn iterative work (refactor → review → fix → test cycle)
|
||||
- Tasks requiring human-in-the-loop decisions
|
||||
- Exploratory coding sessions
|
||||
- When you need to use Claude's slash commands (`/compact`, `/review`, `/model`)
|
||||
|
||||
## PTY Dialog Handling (CRITICAL for Interactive Mode)
|
||||
|
||||
Claude Code presents up to two confirmation dialogs on first launch. You MUST handle these via tmux send-keys:
|
||||
|
||||
### Dialog 1: Workspace Trust (first visit to a directory)
|
||||
```
|
||||
❯ 1. Yes, I trust this folder ← DEFAULT (just press Enter)
|
||||
2. No, exit
|
||||
```
|
||||
**Handling:** `tmux send-keys -t <session> Enter` — default selection is correct.
|
||||
|
||||
### Dialog 2: Bypass Permissions Warning (only with --dangerously-skip-permissions)
|
||||
```
|
||||
❯ 1. No, exit ← DEFAULT (WRONG choice!)
|
||||
2. Yes, I accept
|
||||
```
|
||||
**Handling:** Must navigate DOWN first, then Enter:
|
||||
```
|
||||
tmux send-keys -t <session> Down && sleep 0.3 && tmux send-keys -t <session> Enter
|
||||
```
|
||||
|
||||
### Robust Dialog Handling Pattern
|
||||
```
|
||||
# Launch with permissions bypass
|
||||
terminal(command="tmux send-keys -t claude-work 'claude --dangerously-skip-permissions \"your task\"' Enter")
|
||||
|
||||
# Handle trust dialog (Enter for default "Yes")
|
||||
terminal(command="sleep 4 && tmux send-keys -t claude-work Enter")
|
||||
|
||||
# Handle permissions dialog (Down then Enter for "Yes, I accept")
|
||||
terminal(command="sleep 3 && tmux send-keys -t claude-work Down && sleep 0.3 && tmux send-keys -t claude-work Enter")
|
||||
|
||||
# Now wait for Claude to work
|
||||
terminal(command="sleep 15 && tmux capture-pane -t claude-work -p -S -60")
|
||||
```
|
||||
|
||||
**Note:** After the first trust acceptance for a directory, the trust dialog won't appear again. Only the permissions dialog recurs each time you use `--dangerously-skip-permissions`.
|
||||
|
||||
## CLI Subcommands
|
||||
|
||||
| Subcommand | Purpose |
|
||||
|------------|---------|
|
||||
| `claude` | Start interactive REPL |
|
||||
| `claude "query"` | Start REPL with initial prompt |
|
||||
| `claude -p "query"` | Print mode (non-interactive, exits when done) |
|
||||
| `cat file \| claude -p "query"` | Pipe content as stdin context |
|
||||
| `claude -c` | Continue the most recent conversation in this directory |
|
||||
| `claude -r "id"` | Resume a specific session by ID or name |
|
||||
| `claude auth login` | Sign in (add `--console` for API billing, `--sso` for Enterprise) |
|
||||
| `claude auth status` | Check login status (returns JSON; `--text` for human-readable) |
|
||||
| `claude mcp add <name> -- <cmd>` | Add an MCP server |
|
||||
| `claude mcp list` | List configured MCP servers |
|
||||
| `claude mcp remove <name>` | Remove an MCP server |
|
||||
| `claude agents` | List configured agents |
|
||||
| `claude doctor` | Run health checks on installation and auto-updater |
|
||||
| `claude update` / `claude upgrade` | Update Claude Code to latest version |
|
||||
| `claude remote-control` | Start server to control Claude from claude.ai or mobile app |
|
||||
| `claude install [target]` | Install native build (stable, latest, or specific version) |
|
||||
| `claude setup-token` | Set up long-lived auth token (requires subscription) |
|
||||
| `claude plugin` / `claude plugins` | Manage Claude Code plugins |
|
||||
| `claude auto-mode` | Inspect auto mode classifier configuration |
|
||||
|
||||
## Print Mode Deep Dive
|
||||
|
||||
### Structured JSON Output
|
||||
```
|
||||
terminal(command="claude -p 'Analyze auth.py for security issues' --output-format json --max-turns 5", workdir="/project", timeout=120)
|
||||
```
|
||||
|
||||
Returns a JSON object with:
|
||||
```json
|
||||
{
|
||||
"type": "result",
|
||||
"subtype": "success",
|
||||
"result": "The analysis text...",
|
||||
"session_id": "75e2167f-...",
|
||||
"num_turns": 3,
|
||||
"total_cost_usd": 0.0787,
|
||||
"duration_ms": 10276,
|
||||
"stop_reason": "end_turn",
|
||||
"terminal_reason": "completed",
|
||||
"usage": { "input_tokens": 5, "output_tokens": 603, ... },
|
||||
"modelUsage": { "claude-sonnet-4-6": { "costUSD": 0.078, "contextWindow": 200000 } }
|
||||
}
|
||||
```
|
||||
|
||||
**Key fields:** `session_id` for resumption, `num_turns` for agentic loop count, `total_cost_usd` for spend tracking, `subtype` for success/error detection (`success`, `error_max_turns`, `error_budget`).
|
||||
|
||||
### Streaming JSON Output
|
||||
For real-time token streaming, use `stream-json` with `--verbose`:
|
||||
```
|
||||
terminal(command="claude -p 'Write a summary' --output-format stream-json --verbose --include-partial-messages", timeout=60)
|
||||
```
|
||||
|
||||
Returns newline-delimited JSON events. Filter with jq for live text:
|
||||
```
|
||||
claude -p "Explain X" --output-format stream-json --verbose --include-partial-messages | \
|
||||
jq -rj 'select(.type == "stream_event" and .event.delta.type? == "text_delta") | .event.delta.text'
|
||||
```
|
||||
|
||||
Stream events include `system/api_retry` with `attempt`, `max_retries`, and `error` fields (e.g., `rate_limit`, `billing_error`).
|
||||
|
||||
### Bidirectional Streaming
|
||||
For real-time input AND output streaming:
|
||||
```
|
||||
claude -p "task" --input-format stream-json --output-format stream-json --replay-user-messages
|
||||
```
|
||||
`--replay-user-messages` re-emits user messages on stdout for acknowledgment.
|
||||
|
||||
### Piped Input
|
||||
```
|
||||
# Pipe a file for analysis
|
||||
terminal(command="cat src/auth.py | claude -p 'Review this code for bugs' --max-turns 1", timeout=60)
|
||||
|
||||
# Pipe multiple files
|
||||
terminal(command="cat src/*.py | claude -p 'Find all TODO comments' --max-turns 1", timeout=60)
|
||||
|
||||
# Pipe command output
|
||||
terminal(command="git diff HEAD~3 | claude -p 'Summarize these changes' --max-turns 1", timeout=60)
|
||||
```
|
||||
|
||||
### JSON Schema for Structured Extraction
|
||||
```
|
||||
terminal(command="claude -p 'List all functions in src/' --output-format json --json-schema '{\"type\":\"object\",\"properties\":{\"functions\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"functions\"]}' --max-turns 5", workdir="/project", timeout=90)
|
||||
```
|
||||
|
||||
Parse `structured_output` from the JSON result. Claude validates output against the schema before returning.
|
||||
|
||||
### Session Continuation
|
||||
```
|
||||
# Start a task
|
||||
terminal(command="claude -p 'Start refactoring the database layer' --output-format json --max-turns 10 > /tmp/session.json", workdir="/project", timeout=180)
|
||||
|
||||
# Resume with session ID
|
||||
terminal(command="claude -p 'Continue and add connection pooling' --resume $(cat /tmp/session.json | python3 -c 'import json,sys; print(json.load(sys.stdin)[\"session_id\"])') --max-turns 5", workdir="/project", timeout=120)
|
||||
|
||||
# Or resume the most recent session in the same directory
|
||||
terminal(command="claude -p 'What did you do last time?' --continue --max-turns 1", workdir="/project", timeout=30)
|
||||
|
||||
# Fork a session (new ID, keeps history)
|
||||
terminal(command="claude -p 'Try a different approach' --resume <id> --fork-session --max-turns 10", workdir="/project", timeout=120)
|
||||
```
|
||||
|
||||
### Bare Mode for CI/Scripting
|
||||
```
|
||||
terminal(command="claude --bare -p 'Run all tests and report failures' --allowedTools 'Read,Bash' --max-turns 10", workdir="/project", timeout=180)
|
||||
```
|
||||
|
||||
`--bare` skips hooks, plugins, MCP discovery, and CLAUDE.md loading. Fastest startup. Requires `ANTHROPIC_API_KEY` (skips OAuth).
|
||||
|
||||
To selectively load context in bare mode:
|
||||
| To load | Flag |
|
||||
|---------|------|
|
||||
| System prompt additions | `--append-system-prompt "text"` or `--append-system-prompt-file path` |
|
||||
| Settings | `--settings <file-or-json>` |
|
||||
| MCP servers | `--mcp-config <file-or-json>` |
|
||||
| Custom agents | `--agents '<json>'` |
|
||||
|
||||
### Fallback Model for Overload
|
||||
```
|
||||
terminal(command="claude -p 'task' --fallback-model haiku --max-turns 5", timeout=90)
|
||||
```
|
||||
Automatically falls back to the specified model when the default is overloaded (print mode only).
|
||||
|
||||
## Complete CLI Flags Reference
|
||||
|
||||
### Session & Environment
|
||||
| Flag | Effect |
|
||||
|------|--------|
|
||||
| `-p, --print` | Non-interactive one-shot mode (exits when done) |
|
||||
| `-c, --continue` | Resume most recent conversation in current directory |
|
||||
| `-r, --resume <id>` | Resume specific session by ID or name (interactive picker if no ID) |
|
||||
| `--fork-session` | When resuming, create new session ID instead of reusing original |
|
||||
| `--session-id <uuid>` | Use a specific UUID for the conversation |
|
||||
| `--no-session-persistence` | Don't save session to disk (print mode only) |
|
||||
| `--add-dir <paths...>` | Grant Claude access to additional working directories |
|
||||
| `-w, --worktree [name]` | Run in an isolated git worktree at `.claude/worktrees/<name>` |
|
||||
| `--tmux` | Create a tmux session for the worktree (requires `--worktree`) |
|
||||
| `--ide` | Auto-connect to a valid IDE on startup |
|
||||
| `--chrome` / `--no-chrome` | Enable/disable Chrome browser integration for web testing |
|
||||
| `--from-pr [number]` | Resume session linked to a specific GitHub PR |
|
||||
| `--file <specs...>` | File resources to download at startup (format: `file_id:relative_path`) |
|
||||
|
||||
### Model & Performance
|
||||
| Flag | Effect |
|
||||
|------|--------|
|
||||
| `--model <alias>` | Model selection: `sonnet`, `opus`, `haiku`, or full name like `claude-sonnet-4-6` |
|
||||
| `--effort <level>` | Reasoning depth: `low`, `medium`, `high`, `max`, `auto` | Both |
|
||||
| `--max-turns <n>` | Limit agentic loops (print mode only; prevents runaway) |
|
||||
| `--max-budget-usd <n>` | Cap API spend in dollars (print mode only) |
|
||||
| `--fallback-model <model>` | Auto-fallback when default model is overloaded (print mode only) |
|
||||
| `--betas <betas...>` | Beta headers to include in API requests (API key users only) |
|
||||
|
||||
### Permission & Safety
|
||||
| Flag | Effect |
|
||||
|------|--------|
|
||||
| `--dangerously-skip-permissions` | Auto-approve ALL tool use (file writes, bash, network, etc.) |
|
||||
| `--allow-dangerously-skip-permissions` | Enable bypass as an *option* without enabling it by default |
|
||||
| `--permission-mode <mode>` | `default`, `acceptEdits`, `plan`, `auto`, `dontAsk`, `bypassPermissions` |
|
||||
| `--allowedTools <tools...>` | Whitelist specific tools (comma or space-separated) |
|
||||
| `--disallowedTools <tools...>` | Blacklist specific tools |
|
||||
| `--tools <tools...>` | Override built-in tool set (`""` = none, `"default"` = all, or tool names) |
|
||||
|
||||
### Output & Input Format
|
||||
| Flag | Effect |
|
||||
|------|--------|
|
||||
| `--output-format <fmt>` | `text` (default), `json` (single result object), `stream-json` (newline-delimited) |
|
||||
| `--input-format <fmt>` | `text` (default) or `stream-json` (real-time streaming input) |
|
||||
| `--json-schema <schema>` | Force structured JSON output matching a schema |
|
||||
| `--verbose` | Full turn-by-turn output |
|
||||
| `--include-partial-messages` | Include partial message chunks as they arrive (stream-json + print) |
|
||||
| `--replay-user-messages` | Re-emit user messages on stdout (stream-json bidirectional) |
|
||||
|
||||
### System Prompt & Context
|
||||
| Flag | Effect |
|
||||
|------|--------|
|
||||
| `--append-system-prompt <text>` | **Add** to the default system prompt (preserves built-in capabilities) |
|
||||
| `--append-system-prompt-file <path>` | **Add** file contents to the default system prompt |
|
||||
| `--system-prompt <text>` | **Replace** the entire system prompt (use --append instead usually) |
|
||||
| `--system-prompt-file <path>` | **Replace** the system prompt with file contents |
|
||||
| `--bare` | Skip hooks, plugins, MCP discovery, CLAUDE.md, OAuth (fastest startup) |
|
||||
| `--agents '<json>'` | Define custom subagents dynamically as JSON |
|
||||
| `--mcp-config <path>` | Load MCP servers from JSON file (repeatable) |
|
||||
| `--strict-mcp-config` | Only use MCP servers from `--mcp-config`, ignoring all other MCP configs |
|
||||
| `--settings <file-or-json>` | Load additional settings from a JSON file or inline JSON |
|
||||
| `--setting-sources <sources>` | Comma-separated sources to load: `user`, `project`, `local` |
|
||||
| `--plugin-dir <paths...>` | Load plugins from directories for this session only |
|
||||
| `--disable-slash-commands` | Disable all skills/slash commands |
|
||||
|
||||
### Debugging
|
||||
| Flag | Effect |
|
||||
|------|--------|
|
||||
| `-d, --debug [filter]` | Enable debug logging with optional category filter (e.g., `"api,hooks"`, `"!1p,!file"`) |
|
||||
| `--debug-file <path>` | Write debug logs to file (implicitly enables debug mode) |
|
||||
|
||||
### Agent Teams
|
||||
| Flag | Effect |
|
||||
|------|--------|
|
||||
| `--teammate-mode <mode>` | How agent teams display: `auto`, `in-process`, or `tmux` |
|
||||
| `--brief` | Enable `SendUserMessage` tool for agent-to-user communication |
|
||||
|
||||
### Tool Name Syntax for --allowedTools / --disallowedTools
|
||||
```
|
||||
Read # All file reading
|
||||
Edit # File editing (existing files)
|
||||
Write # File creation (new files)
|
||||
Bash # All shell commands
|
||||
Bash(git *) # Only git commands
|
||||
Bash(git commit *) # Only git commit commands
|
||||
Bash(npm run lint:*) # Pattern matching with wildcards
|
||||
WebSearch # Web search capability
|
||||
WebFetch # Web page fetching
|
||||
mcp__<server>__<tool> # Specific MCP tool
|
||||
```
|
||||
|
||||
## Settings & Configuration
|
||||
|
||||
### Settings Hierarchy (highest to lowest priority)
|
||||
1. **CLI flags** — override everything
|
||||
2. **Local project:** `.claude/settings.local.json` (personal, gitignored)
|
||||
3. **Project:** `.claude/settings.json` (shared, git-tracked)
|
||||
4. **User:** `~/.claude/settings.json` (global)
|
||||
|
||||
### Permissions in Settings
|
||||
```json
|
||||
{
|
||||
"permissions": {
|
||||
"allow": ["Bash(npm run lint:*)", "WebSearch", "Read"],
|
||||
"ask": ["Write(*.ts)", "Bash(git push*)"],
|
||||
"deny": ["Read(.env)", "Bash(rm -rf *)"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Memory Files (CLAUDE.md) Hierarchy
|
||||
1. **Global:** `~/.claude/CLAUDE.md` — applies to all projects
|
||||
2. **Project:** `./CLAUDE.md` — project-specific context (git-tracked)
|
||||
3. **Local:** `.claude/CLAUDE.local.md` — personal project overrides (gitignored)
|
||||
|
||||
Use the `#` prefix in interactive mode to quickly add to memory: `# Always use 2-space indentation`.
|
||||
|
||||
## Interactive Session: Slash Commands
|
||||
|
||||
### Session & Context
|
||||
| Command | Purpose |
|
||||
|---------|---------|
|
||||
| `/help` | Show all commands (including custom and MCP commands) |
|
||||
| `/compact [focus]` | Compress context to save tokens; CLAUDE.md survives compaction. E.g., `/compact focus on auth logic` |
|
||||
| `/clear` | Wipe conversation history for a fresh start |
|
||||
| `/context` | Visualize context usage as a colored grid with optimization tips |
|
||||
| `/cost` | View token usage with per-model and cache-hit breakdowns |
|
||||
| `/resume` | Switch to or resume a different session |
|
||||
| `/rewind` | Revert to a previous checkpoint in conversation or code |
|
||||
| `/btw <question>` | Ask a side question without adding to context cost |
|
||||
| `/status` | Show version, connectivity, and session info |
|
||||
| `/todos` | List tracked action items from the conversation |
|
||||
| `/exit` or `Ctrl+D` | End session |
|
||||
|
||||
### Development & Review
|
||||
| Command | Purpose |
|
||||
|---------|---------|
|
||||
| `/review` | Request code review of current changes |
|
||||
| `/security-review` | Perform security analysis of current changes |
|
||||
| `/plan [description]` | Enter Plan mode with auto-start for task planning |
|
||||
| `/loop [interval]` | Schedule recurring tasks within the session |
|
||||
| `/batch` | Auto-create worktrees for large parallel changes (5-30 worktrees) |
|
||||
|
||||
### Configuration & Tools
|
||||
| Command | Purpose |
|
||||
|---------|---------|
|
||||
| `/model [model]` | Switch models mid-session (use arrow keys to adjust effort) |
|
||||
| `/effort [level]` | Set reasoning effort: `low`, `medium`, `high`, `max`, or `auto` |
|
||||
| `/init` | Create a CLAUDE.md file for project memory |
|
||||
| `/memory` | Open CLAUDE.md for editing |
|
||||
| `/config` | Open interactive settings configuration |
|
||||
| `/permissions` | View/update tool permissions |
|
||||
| `/agents` | Manage specialized subagents |
|
||||
| `/mcp` | Interactive UI to manage MCP servers |
|
||||
| `/add-dir` | Add additional working directories (useful for monorepos) |
|
||||
| `/usage` | Show plan limits and rate limit status |
|
||||
| `/voice` | Enable push-to-talk voice mode (20 languages; hold Space to record, release to send) |
|
||||
| `/release-notes` | Interactive picker for version release notes |
|
||||
|
||||
### Custom Slash Commands
|
||||
Create `.claude/commands/<name>.md` (project-shared) or `~/.claude/commands/<name>.md` (personal):
|
||||
|
||||
```markdown
|
||||
# .claude/commands/deploy.md
|
||||
Run the deploy pipeline:
|
||||
1. Run all tests
|
||||
2. Build the Docker image
|
||||
3. Push to registry
|
||||
4. Update the $ARGUMENTS environment (default: staging)
|
||||
```
|
||||
|
||||
Usage: `/deploy production` — `$ARGUMENTS` is replaced with the user's input.
|
||||
|
||||
### Skills (Natural Language Invocation)
|
||||
Unlike slash commands (manually invoked), skills in `.claude/skills/` are markdown guides that Claude invokes automatically via natural language when the task matches:
|
||||
|
||||
```markdown
|
||||
# .claude/skills/database-migration.md
|
||||
When asked to create or modify database migrations:
|
||||
1. Use Alembic for migration generation
|
||||
2. Always create a rollback function
|
||||
3. Test migrations against a local database copy
|
||||
```
|
||||
|
||||
## Interactive Session: Keyboard Shortcuts
|
||||
|
||||
### General Controls
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `Ctrl+C` | Cancel current input or generation |
|
||||
| `Ctrl+D` | Exit session |
|
||||
| `Ctrl+R` | Reverse search command history |
|
||||
| `Ctrl+B` | Background a running task |
|
||||
| `Ctrl+V` | Paste image into conversation |
|
||||
| `Ctrl+O` | Transcript mode — see Claude's thinking process |
|
||||
| `Ctrl+G` or `Ctrl+X Ctrl+E` | Open prompt in external editor |
|
||||
| `Esc Esc` | Rewind conversation or code state / summarize |
|
||||
|
||||
### Mode Toggles
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `Shift+Tab` | Cycle permission modes (Normal → Auto-Accept → Plan) |
|
||||
| `Alt+P` | Switch model |
|
||||
| `Alt+T` | Toggle thinking mode |
|
||||
| `Alt+O` | Toggle Fast Mode |
|
||||
|
||||
### Multiline Input
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `\` + `Enter` | Quick newline |
|
||||
| `Shift+Enter` | Newline (alternative) |
|
||||
| `Ctrl+J` | Newline (alternative) |
|
||||
|
||||
### Input Prefixes
|
||||
| Prefix | Action |
|
||||
|--------|--------|
|
||||
| `!` | Execute bash directly, bypassing AI (e.g., `!npm test`). Use `!` alone to toggle shell mode. |
|
||||
| `@` | Reference files/directories with autocomplete (e.g., `@./src/api/`) |
|
||||
| `#` | Quick add to CLAUDE.md memory (e.g., `# Use 2-space indentation`) |
|
||||
| `/` | Slash commands |
|
||||
|
||||
### Pro Tip: "ultrathink"
|
||||
Use the keyword "ultrathink" in your prompt for maximum reasoning effort on a specific turn. This triggers the deepest thinking mode regardless of the current `/effort` setting.
|
||||
|
||||
## PR Review Pattern
|
||||
|
||||
### Quick Review (Print Mode)
|
||||
```
|
||||
terminal(command="cd /path/to/repo && git diff main...feature-branch | claude -p 'Review this diff for bugs, security issues, and style problems. Be thorough.' --max-turns 1", timeout=60)
|
||||
```
|
||||
|
||||
### Deep Review (Interactive + Worktree)
|
||||
```
|
||||
terminal(command="tmux new-session -d -s review -x 140 -y 40")
|
||||
terminal(command="tmux send-keys -t review 'cd /path/to/repo && claude -w pr-review' Enter")
|
||||
terminal(command="sleep 5 && tmux send-keys -t review Enter") # Trust dialog
|
||||
terminal(command="sleep 2 && tmux send-keys -t review 'Review all changes vs main. Check for bugs, security issues, race conditions, and missing tests.' Enter")
|
||||
terminal(command="sleep 30 && tmux capture-pane -t review -p -S -60")
|
||||
```
|
||||
|
||||
### PR Review from Number
|
||||
```
|
||||
terminal(command="claude -p 'Review this PR thoroughly' --from-pr 42 --max-turns 10", workdir="/path/to/repo", timeout=120)
|
||||
```
|
||||
|
||||
### Claude Worktree with tmux
|
||||
```
|
||||
terminal(command="claude -w feature-x --tmux", workdir="/path/to/repo")
|
||||
```
|
||||
Creates an isolated git worktree at `.claude/worktrees/feature-x` AND a tmux session for it. Uses iTerm2 native panes when available; add `--tmux=classic` for traditional tmux.
|
||||
|
||||
## Parallel Claude Instances
|
||||
|
||||
Run multiple independent Claude tasks simultaneously:
|
||||
|
||||
```
|
||||
# Task 1: Fix backend
|
||||
terminal(command="tmux new-session -d -s task1 -x 140 -y 40 && tmux send-keys -t task1 'cd ~/project && claude -p \"Fix the auth bug in src/auth.py\" --allowedTools \"Read,Edit\" --max-turns 10' Enter")
|
||||
|
||||
# Task 2: Write tests
|
||||
terminal(command="tmux new-session -d -s task2 -x 140 -y 40 && tmux send-keys -t task2 'cd ~/project && claude -p \"Write integration tests for the API endpoints\" --allowedTools \"Read,Write,Bash\" --max-turns 15' Enter")
|
||||
|
||||
# Task 3: Update docs
|
||||
terminal(command="tmux new-session -d -s task3 -x 140 -y 40 && tmux send-keys -t task3 'cd ~/project && claude -p \"Update README.md with the new API endpoints\" --allowedTools \"Read,Edit\" --max-turns 5' Enter")
|
||||
|
||||
# Monitor all
|
||||
terminal(command="sleep 30 && for s in task1 task2 task3; do echo '=== '$s' ==='; tmux capture-pane -t $s -p -S -5 2>/dev/null; done")
|
||||
```
|
||||
|
||||
## CLAUDE.md — Project Context File
|
||||
|
||||
Claude Code auto-loads `CLAUDE.md` from the project root. Use it to persist project context:
|
||||
|
||||
```markdown
|
||||
# Project: My API
|
||||
|
||||
## Architecture
|
||||
- FastAPI backend with SQLAlchemy ORM
|
||||
- PostgreSQL database, Redis cache
|
||||
- pytest for testing with 90% coverage target
|
||||
|
||||
## Key Commands
|
||||
- `make test` — run full test suite
|
||||
- `make lint` — ruff + mypy
|
||||
- `make dev` — start dev server on :8000
|
||||
|
||||
## Code Standards
|
||||
- Type hints on all public functions
|
||||
- Docstrings in Google style
|
||||
- 2-space indentation for YAML, 4-space for Python
|
||||
- No wildcard imports
|
||||
```
|
||||
|
||||
**Be specific.** Instead of "Write good code", use "Use 2-space indentation for JS" or "Name test files with `.test.ts` suffix." Specific instructions save correction cycles.
|
||||
|
||||
### Rules Directory (Modular CLAUDE.md)
|
||||
For projects with many rules, use the rules directory instead of one massive CLAUDE.md:
|
||||
- **Project rules:** `.claude/rules/*.md` — team-shared, git-tracked
|
||||
- **User rules:** `~/.claude/rules/*.md` — personal, global
|
||||
|
||||
Each `.md` file in the rules directory is loaded as additional context. This is cleaner than cramming everything into a single CLAUDE.md.
|
||||
|
||||
### Auto-Memory
|
||||
Claude automatically stores learned project context in `~/.claude/projects/<project>/memory/`.
|
||||
- **Limit:** 25KB or 200 lines per project
|
||||
- This is separate from CLAUDE.md — it's Claude's own notes about the project, accumulated across sessions
|
||||
|
||||
## Custom Subagents
|
||||
|
||||
Define specialized agents in `.claude/agents/` (project), `~/.claude/agents/` (personal), or via `--agents` CLI flag (session):
|
||||
|
||||
### Agent Location Priority
|
||||
1. `.claude/agents/` — project-level, team-shared
|
||||
2. `--agents` CLI flag — session-specific, dynamic
|
||||
3. `~/.claude/agents/` — user-level, personal
|
||||
|
||||
### Creating an Agent
|
||||
```markdown
|
||||
# .claude/agents/security-reviewer.md
|
||||
---
|
||||
name: security-reviewer
|
||||
description: Security-focused code review
|
||||
model: opus
|
||||
tools: [Read, Bash]
|
||||
---
|
||||
You are a senior security engineer. Review code for:
|
||||
- Injection vulnerabilities (SQL, XSS, command injection)
|
||||
- Authentication/authorization flaws
|
||||
- Secrets in code
|
||||
- Unsafe deserialization
|
||||
```
|
||||
|
||||
Invoke via: `@security-reviewer review the auth module`
|
||||
|
||||
### Dynamic Agents via CLI
|
||||
```
|
||||
terminal(command="claude --agents '{\"reviewer\": {\"description\": \"Reviews code\", \"prompt\": \"You are a code reviewer focused on performance\"}}' -p 'Use @reviewer to check auth.py'", timeout=120)
|
||||
```
|
||||
|
||||
Claude can orchestrate multiple agents: "Use @db-expert to optimize queries, then @security to audit the changes."
|
||||
|
||||
## Hooks — Automation on Events
|
||||
|
||||
Configure in `.claude/settings.json` (project) or `~/.claude/settings.json` (global):
|
||||
|
||||
```json
|
||||
{
|
||||
"hooks": {
|
||||
"PostToolUse": [{
|
||||
"matcher": "Write(*.py)",
|
||||
"hooks": [{"type": "command", "command": "ruff check --fix $CLAUDE_FILE_PATHS"}]
|
||||
}],
|
||||
"PreToolUse": [{
|
||||
"matcher": "Bash",
|
||||
"hooks": [{"type": "command", "command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -q 'rm -rf'; then echo 'Blocked!' && exit 2; fi"}]
|
||||
}],
|
||||
"Stop": [{
|
||||
"hooks": [{"type": "command", "command": "echo 'Claude finished a response' >> /tmp/claude-activity.log"}]
|
||||
}]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### All 8 Hook Types
|
||||
| Hook | When it fires | Common use |
|
||||
|------|--------------|------------|
|
||||
| `UserPromptSubmit` | Before Claude processes a user prompt | Input validation, logging |
|
||||
| `PreToolUse` | Before tool execution | Security gates, block dangerous commands (exit 2 = block) |
|
||||
| `PostToolUse` | After a tool finishes | Auto-format code, run linters |
|
||||
| `Notification` | On permission requests or input waits | Desktop notifications, alerts |
|
||||
| `Stop` | When Claude finishes a response | Completion logging, status updates |
|
||||
| `SubagentStop` | When a subagent completes | Agent orchestration |
|
||||
| `PreCompact` | Before context memory is cleared | Backup session transcripts |
|
||||
| `SessionStart` | When a session begins | Load dev context (e.g., `git status`) |
|
||||
|
||||
### Hook Environment Variables
|
||||
| Variable | Content |
|
||||
|----------|---------|
|
||||
| `CLAUDE_PROJECT_DIR` | Current project path |
|
||||
| `CLAUDE_FILE_PATHS` | Files being modified |
|
||||
| `CLAUDE_TOOL_INPUT` | Tool parameters as JSON |
|
||||
|
||||
### Security Hook Examples
|
||||
```json
|
||||
{
|
||||
"PreToolUse": [{
|
||||
"matcher": "Bash",
|
||||
"hooks": [{"type": "command", "command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -qE 'rm -rf|git push.*--force|:(){ :|:& };:'; then echo 'Dangerous command blocked!' && exit 2; fi"}]
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
## MCP Integration
|
||||
|
||||
Add external tool servers for databases, APIs, and services:
|
||||
|
||||
```
|
||||
# GitHub integration
|
||||
terminal(command="claude mcp add -s user github -- npx @modelcontextprotocol/server-github", timeout=30)
|
||||
|
||||
# PostgreSQL queries
|
||||
terminal(command="claude mcp add -s local postgres -- npx @anthropic-ai/server-postgres --connection-string postgresql://localhost/mydb", timeout=30)
|
||||
|
||||
# Puppeteer for web testing
|
||||
terminal(command="claude mcp add puppeteer -- npx @anthropic-ai/server-puppeteer", timeout=30)
|
||||
```
|
||||
|
||||
### MCP Scopes
|
||||
| Flag | Scope | Storage |
|
||||
|------|-------|---------|
|
||||
| `-s user` | Global (all projects) | `~/.claude.json` |
|
||||
| `-s local` | This project (personal) | `.claude/settings.local.json` (gitignored) |
|
||||
| `-s project` | This project (team-shared) | `.claude/settings.json` (git-tracked) |
|
||||
|
||||
### MCP in Print/CI Mode
|
||||
```
|
||||
terminal(command="claude --bare -p 'Query database' --mcp-config mcp-servers.json --strict-mcp-config", timeout=60)
|
||||
```
|
||||
`--strict-mcp-config` ignores all MCP servers except those from `--mcp-config`.
|
||||
|
||||
Reference MCP resources in chat: `@github:issue://123`
|
||||
|
||||
### MCP Limits & Tuning
|
||||
- **Tool descriptions:** 2KB cap per server for tool descriptions and server instructions
|
||||
- **Result size:** Default capped; use `maxResultSizeChars` annotation to allow up to **500K** characters for large outputs
|
||||
- **Output tokens:** `export MAX_MCP_OUTPUT_TOKENS=50000` — cap output from MCP servers to prevent context flooding
|
||||
- **Transports:** `stdio` (local process), `http` (remote), `sse` (server-sent events)
|
||||
|
||||
## Monitoring Interactive Sessions
|
||||
|
||||
### Reading the TUI Status
|
||||
```
|
||||
# Periodic capture to check if Claude is still working or waiting for input
|
||||
terminal(command="tmux capture-pane -t dev -p -S -10")
|
||||
```
|
||||
|
||||
Look for these indicators:
|
||||
- `❯` at bottom = waiting for your input (Claude is done or asking a question)
|
||||
- `●` lines = Claude is actively using tools (reading, writing, running commands)
|
||||
- `⏵⏵ bypass permissions on` = status bar showing permissions mode
|
||||
- `◐ medium · /effort` = current effort level in status bar
|
||||
- `ctrl+o to expand` = tool output was truncated (can be expanded interactively)
|
||||
|
||||
### Context Window Health
|
||||
Use `/context` in interactive mode to see a colored grid of context usage. Key thresholds:
|
||||
- **< 70%** — Normal operation, full precision
|
||||
- **70-85%** — Precision starts dropping, consider `/compact`
|
||||
- **> 85%** — Hallucination risk spikes significantly, use `/compact` or `/clear`
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Effect |
|
||||
|----------|--------|
|
||||
| `ANTHROPIC_API_KEY` | API key for authentication (alternative to OAuth) |
|
||||
| `CLAUDE_CODE_EFFORT_LEVEL` | Default effort: `low`, `medium`, `high`, `max`, or `auto` |
|
||||
| `MAX_THINKING_TOKENS` | Cap thinking tokens (set to `0` to disable thinking entirely) |
|
||||
| `MAX_MCP_OUTPUT_TOKENS` | Cap output from MCP servers (default varies; set e.g., `50000`) |
|
||||
| `CLAUDE_CODE_NO_FLICKER=1` | Enable alt-screen rendering to eliminate terminal flicker |
|
||||
| `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` | Strip credentials from sub-processes for security |
|
||||
|
||||
## Cost & Performance Tips
|
||||
|
||||
1. **Use `--max-turns`** in print mode to prevent runaway loops. Start with 5-10 for most tasks.
|
||||
2. **Use `--max-budget-usd`** for cost caps. Note: minimum ~$0.05 for system prompt cache creation.
|
||||
3. **Use `--effort low`** for simple tasks (faster, cheaper). `high` or `max` for complex reasoning.
|
||||
4. **Use `--bare`** for CI/scripting to skip plugin/hook discovery overhead.
|
||||
5. **Use `--allowedTools`** to restrict to only what's needed (e.g., `Read` only for reviews).
|
||||
6. **Use `/compact`** in interactive sessions when context gets large.
|
||||
7. **Pipe input** instead of having Claude read files when you just need analysis of known content.
|
||||
8. **Use `--model haiku`** for simple tasks (cheaper) and `--model opus` for complex multi-step work.
|
||||
9. **Use `--fallback-model haiku`** in print mode to gracefully handle model overload.
|
||||
10. **Start new sessions for distinct tasks** — sessions last 5 hours; fresh context is more efficient.
|
||||
11. **Use `--no-session-persistence`** in CI to avoid accumulating saved sessions on disk.
|
||||
|
||||
## Pitfalls & Gotchas
|
||||
|
||||
1. **Interactive mode REQUIRES tmux** — Claude Code is a full TUI app. Using `pty=true` alone in Hermes terminal works but tmux gives you `capture-pane` for monitoring and `send-keys` for input, which is essential for orchestration.
|
||||
2. **`--dangerously-skip-permissions` dialog defaults to "No, exit"** — you must send Down then Enter to accept. Print mode (`-p`) skips this entirely.
|
||||
3. **`--max-budget-usd` minimum is ~$0.05** — system prompt cache creation alone costs this much. Setting lower will error immediately.
|
||||
4. **`--max-turns` is print-mode only** — ignored in interactive sessions.
|
||||
5. **Claude may use `python` instead of `python3`** — on systems without a `python` symlink, Claude's bash commands will fail on first try but it self-corrects.
|
||||
6. **Session resumption requires same directory** — `--continue` finds the most recent session for the current working directory.
|
||||
7. **`--json-schema` needs enough `--max-turns`** — Claude must read files before producing structured output, which takes multiple turns.
|
||||
8. **Trust dialog only appears once per directory** — first-time only, then cached.
|
||||
9. **Background tmux sessions persist** — always clean up with `tmux kill-session -t <name>` when done.
|
||||
10. **Slash commands (like `/commit`) only work in interactive mode** — in `-p` mode, describe the task in natural language instead.
|
||||
11. **`--bare` skips OAuth** — requires `ANTHROPIC_API_KEY` env var or an `apiKeyHelper` in settings.
|
||||
12. **Context degradation is real** — AI output quality measurably degrades above 70% context window usage. Monitor with `/context` and proactively `/compact`.
|
||||
|
||||
## Rules for Hermes Agents
|
||||
|
||||
1. **Prefer print mode (`-p`) for single tasks** — cleaner, no dialog handling, structured output
|
||||
2. **Use tmux for multi-turn interactive work** — the only reliable way to orchestrate the TUI
|
||||
3. **Always set `workdir`** — keep Claude focused on the right project directory
|
||||
4. **Set `--max-turns` in print mode** — prevents infinite loops and runaway costs
|
||||
5. **Monitor tmux sessions** — use `tmux capture-pane -t <session> -p -S -50` to check progress
|
||||
6. **Look for the `❯` prompt** — indicates Claude is waiting for input (done or asking a question)
|
||||
7. **Clean up tmux sessions** — kill them when done to avoid resource leaks
|
||||
8. **Report results to user** — after completion, summarize what Claude did and what changed
|
||||
9. **Don't kill slow sessions** — Claude may be doing multi-step work; check progress instead
|
||||
10. **Use `--allowedTools`** — restrict capabilities to what the task actually needs
|
||||
113
skills/autonomous-ai-agents/codex/SKILL.md
Normal file
113
skills/autonomous-ai-agents/codex/SKILL.md
Normal file
@@ -0,0 +1,113 @@
|
||||
---
|
||||
name: codex
|
||||
description: Delegate coding tasks to OpenAI Codex CLI agent. Use for building features, refactoring, PR reviews, and batch issue fixing. Requires the codex CLI and a git repository.
|
||||
version: 1.0.0
|
||||
author: Hermes Agent
|
||||
license: MIT
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [Coding-Agent, Codex, OpenAI, Code-Review, Refactoring]
|
||||
related_skills: [claude-code, hermes-agent]
|
||||
---
|
||||
|
||||
# Codex CLI
|
||||
|
||||
Delegate coding tasks to [Codex](https://github.com/openai/codex) via the Hermes terminal. Codex is OpenAI's autonomous coding agent CLI.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Codex installed: `npm install -g @openai/codex`
|
||||
- OpenAI API key configured
|
||||
- **Must run inside a git repository** — Codex refuses to run outside one
|
||||
- Use `pty=true` in terminal calls — Codex is an interactive terminal app
|
||||
|
||||
## One-Shot Tasks
|
||||
|
||||
```
|
||||
terminal(command="codex exec 'Add dark mode toggle to settings'", workdir="~/project", pty=true)
|
||||
```
|
||||
|
||||
For scratch work (Codex needs a git repo):
|
||||
```
|
||||
terminal(command="cd $(mktemp -d) && git init && codex exec 'Build a snake game in Python'", pty=true)
|
||||
```
|
||||
|
||||
## Background Mode (Long Tasks)
|
||||
|
||||
```
|
||||
# Start in background with PTY
|
||||
terminal(command="codex exec --full-auto 'Refactor the auth module'", workdir="~/project", background=true, pty=true)
|
||||
# Returns session_id
|
||||
|
||||
# Monitor progress
|
||||
process(action="poll", session_id="<id>")
|
||||
process(action="log", session_id="<id>")
|
||||
|
||||
# Send input if Codex asks a question
|
||||
process(action="submit", session_id="<id>", data="yes")
|
||||
|
||||
# Kill if needed
|
||||
process(action="kill", session_id="<id>")
|
||||
```
|
||||
|
||||
## Key Flags
|
||||
|
||||
| Flag | Effect |
|
||||
|------|--------|
|
||||
| `exec "prompt"` | One-shot execution, exits when done |
|
||||
| `--full-auto` | Sandboxed but auto-approves file changes in workspace |
|
||||
| `--yolo` | No sandbox, no approvals (fastest, most dangerous) |
|
||||
|
||||
## PR Reviews
|
||||
|
||||
Clone to a temp directory for safe review:
|
||||
|
||||
```
|
||||
terminal(command="REVIEW=$(mktemp -d) && git clone https://github.com/user/repo.git $REVIEW && cd $REVIEW && gh pr checkout 42 && codex review --base origin/main", pty=true)
|
||||
```
|
||||
|
||||
## Parallel Issue Fixing with Worktrees
|
||||
|
||||
```
|
||||
# Create worktrees
|
||||
terminal(command="git worktree add -b fix/issue-78 /tmp/issue-78 main", workdir="~/project")
|
||||
terminal(command="git worktree add -b fix/issue-99 /tmp/issue-99 main", workdir="~/project")
|
||||
|
||||
# Launch Codex in each
|
||||
terminal(command="codex --yolo exec 'Fix issue #78: <description>. Commit when done.'", workdir="/tmp/issue-78", background=true, pty=true)
|
||||
terminal(command="codex --yolo exec 'Fix issue #99: <description>. Commit when done.'", workdir="/tmp/issue-99", background=true, pty=true)
|
||||
|
||||
# Monitor
|
||||
process(action="list")
|
||||
|
||||
# After completion, push and create PRs
|
||||
terminal(command="cd /tmp/issue-78 && git push -u origin fix/issue-78")
|
||||
terminal(command="gh pr create --repo user/repo --head fix/issue-78 --title 'fix: ...' --body '...'")
|
||||
|
||||
# Cleanup
|
||||
terminal(command="git worktree remove /tmp/issue-78", workdir="~/project")
|
||||
```
|
||||
|
||||
## Batch PR Reviews
|
||||
|
||||
```
|
||||
# Fetch all PR refs
|
||||
terminal(command="git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*'", workdir="~/project")
|
||||
|
||||
# Review multiple PRs in parallel
|
||||
terminal(command="codex exec 'Review PR #86. git diff origin/main...origin/pr/86'", workdir="~/project", background=true, pty=true)
|
||||
terminal(command="codex exec 'Review PR #87. git diff origin/main...origin/pr/87'", workdir="~/project", background=true, pty=true)
|
||||
|
||||
# Post results
|
||||
terminal(command="gh pr comment 86 --body '<review>'", workdir="~/project")
|
||||
```
|
||||
|
||||
## Rules
|
||||
|
||||
1. **Always use `pty=true`** — Codex is an interactive terminal app and hangs without a PTY
|
||||
2. **Git repo required** — Codex won't run outside a git directory. Use `mktemp -d && git init` for scratch
|
||||
3. **Use `exec` for one-shots** — `codex exec "prompt"` runs and exits cleanly
|
||||
4. **`--full-auto` for building** — auto-approves changes within the sandbox
|
||||
5. **Background for long tasks** — use `background=true` and monitor with `process` tool
|
||||
6. **Don't interfere** — monitor with `poll`/`log`, be patient with long-running tasks
|
||||
7. **Parallel is fine** — run multiple Codex processes at once for batch work
|
||||
706
skills/autonomous-ai-agents/hermes-agent/SKILL.md
Normal file
706
skills/autonomous-ai-agents/hermes-agent/SKILL.md
Normal file
@@ -0,0 +1,706 @@
|
||||
---
|
||||
name: hermes-agent
|
||||
description: Complete guide to using and extending Hermes Agent — CLI usage, setup, configuration, spawning additional agents, gateway platforms, skills, voice, tools, profiles, and a concise contributor reference. Load this skill when helping users configure Hermes, troubleshoot issues, spawn agent instances, or make code contributions.
|
||||
version: 2.0.0
|
||||
author: Hermes Agent + Teknium
|
||||
license: MIT
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [hermes, setup, configuration, multi-agent, spawning, cli, gateway, development]
|
||||
homepage: https://github.com/NousResearch/hermes-agent
|
||||
related_skills: [claude-code, codex, opencode]
|
||||
---
|
||||
|
||||
# Hermes Agent
|
||||
|
||||
Hermes Agent is an open-source AI agent framework by Nous Research that runs in your terminal, messaging platforms, and IDEs. It belongs to the same category as Claude Code (Anthropic), Codex (OpenAI), and OpenClaw — autonomous coding and task-execution agents that use tool calling to interact with your system. Hermes works with any LLM provider (OpenRouter, Anthropic, OpenAI, DeepSeek, local models, and 15+ others) and runs on Linux, macOS, and WSL.
|
||||
|
||||
What makes Hermes different:
|
||||
|
||||
- **Self-improving through skills** — Hermes learns from experience by saving reusable procedures as skills. When it solves a complex problem, discovers a workflow, or gets corrected, it can persist that knowledge as a skill document that loads into future sessions. Skills accumulate over time, making the agent better at your specific tasks and environment.
|
||||
- **Persistent memory across sessions** — remembers who you are, your preferences, environment details, and lessons learned. Pluggable memory backends (built-in, Honcho, Mem0, and more) let you choose how memory works.
|
||||
- **Multi-platform gateway** — the same agent runs on Telegram, Discord, Slack, WhatsApp, Signal, Matrix, Email, and 10+ other platforms with full tool access, not just chat.
|
||||
- **Provider-agnostic** — swap models and providers mid-workflow without changing anything else. Credential pools rotate across multiple API keys automatically.
|
||||
- **Profiles** — run multiple independent Hermes instances with isolated configs, sessions, skills, and memory.
|
||||
- **Extensible** — plugins, MCP servers, custom tools, webhook triggers, cron scheduling, and the full Python ecosystem.
|
||||
|
||||
People use Hermes for software development, research, system administration, data analysis, content creation, home automation, and anything else that benefits from an AI agent with persistent context and full system access.
|
||||
|
||||
**This skill helps you work with Hermes Agent effectively** — setting it up, configuring features, spawning additional agent instances, troubleshooting issues, finding the right commands and settings, and understanding how the system works when you need to extend or contribute to it.
|
||||
|
||||
**Docs:** https://hermes-agent.nousresearch.com/docs/
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Install
|
||||
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
|
||||
|
||||
# Interactive chat (default)
|
||||
hermes
|
||||
|
||||
# Single query
|
||||
hermes chat -q "What is the capital of France?"
|
||||
|
||||
# Setup wizard
|
||||
hermes setup
|
||||
|
||||
# Change model/provider
|
||||
hermes model
|
||||
|
||||
# Check health
|
||||
hermes doctor
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## CLI Reference
|
||||
|
||||
### Global Flags
|
||||
|
||||
```
|
||||
hermes [flags] [command]
|
||||
|
||||
--version, -V Show version
|
||||
--resume, -r SESSION Resume session by ID or title
|
||||
--continue, -c [NAME] Resume by name, or most recent session
|
||||
--worktree, -w Isolated git worktree mode (parallel agents)
|
||||
--skills, -s SKILL Preload skills (comma-separate or repeat)
|
||||
--profile, -p NAME Use a named profile
|
||||
--yolo Skip dangerous command approval
|
||||
--pass-session-id Include session ID in system prompt
|
||||
```
|
||||
|
||||
No subcommand defaults to `chat`.
|
||||
|
||||
### Chat
|
||||
|
||||
```
|
||||
hermes chat [flags]
|
||||
-q, --query TEXT Single query, non-interactive
|
||||
-m, --model MODEL Model (e.g. anthropic/claude-sonnet-4)
|
||||
-t, --toolsets LIST Comma-separated toolsets
|
||||
--provider PROVIDER Force provider (openrouter, anthropic, nous, etc.)
|
||||
-v, --verbose Verbose output
|
||||
-Q, --quiet Suppress banner, spinner, tool previews
|
||||
--checkpoints Enable filesystem checkpoints (/rollback)
|
||||
--source TAG Session source tag (default: cli)
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
```
|
||||
hermes setup [section] Interactive wizard (model|terminal|gateway|tools|agent)
|
||||
hermes model Interactive model/provider picker
|
||||
hermes config View current config
|
||||
hermes config edit Open config.yaml in $EDITOR
|
||||
hermes config set KEY VAL Set a config value
|
||||
hermes config path Print config.yaml path
|
||||
hermes config env-path Print .env path
|
||||
hermes config check Check for missing/outdated config
|
||||
hermes config migrate Update config with new options
|
||||
hermes login [--provider P] OAuth login (nous, openai-codex)
|
||||
hermes logout Clear stored auth
|
||||
hermes doctor [--fix] Check dependencies and config
|
||||
hermes status [--all] Show component status
|
||||
```
|
||||
|
||||
### Tools & Skills
|
||||
|
||||
```
|
||||
hermes tools Interactive tool enable/disable (curses UI)
|
||||
hermes tools list Show all tools and status
|
||||
hermes tools enable NAME Enable a toolset
|
||||
hermes tools disable NAME Disable a toolset
|
||||
|
||||
hermes skills list List installed skills
|
||||
hermes skills search QUERY Search the skills hub
|
||||
hermes skills install ID Install a skill
|
||||
hermes skills inspect ID Preview without installing
|
||||
hermes skills config Enable/disable skills per platform
|
||||
hermes skills check Check for updates
|
||||
hermes skills update Update outdated skills
|
||||
hermes skills uninstall N Remove a hub skill
|
||||
hermes skills publish PATH Publish to registry
|
||||
hermes skills browse Browse all available skills
|
||||
hermes skills tap add REPO Add a GitHub repo as skill source
|
||||
```
|
||||
|
||||
### MCP Servers
|
||||
|
||||
```
|
||||
hermes mcp serve Run Hermes as an MCP server
|
||||
hermes mcp add NAME Add an MCP server (--url or --command)
|
||||
hermes mcp remove NAME Remove an MCP server
|
||||
hermes mcp list List configured servers
|
||||
hermes mcp test NAME Test connection
|
||||
hermes mcp configure NAME Toggle tool selection
|
||||
```
|
||||
|
||||
### Gateway (Messaging Platforms)
|
||||
|
||||
```
|
||||
hermes gateway run Start gateway foreground
|
||||
hermes gateway install Install as background service
|
||||
hermes gateway start/stop Control the service
|
||||
hermes gateway restart Restart the service
|
||||
hermes gateway status Check status
|
||||
hermes gateway setup Configure platforms
|
||||
```
|
||||
|
||||
Supported platforms: Telegram, Discord, Slack, WhatsApp, Signal, Email, SMS, Matrix, Mattermost, Home Assistant, DingTalk, Feishu, WeCom, BlueBubbles (iMessage), Weixin (WeChat), API Server, Webhooks. Open WebUI connects via the API Server adapter.
|
||||
|
||||
Platform docs: https://hermes-agent.nousresearch.com/docs/user-guide/messaging/
|
||||
|
||||
### Sessions
|
||||
|
||||
```
|
||||
hermes sessions list List recent sessions
|
||||
hermes sessions browse Interactive picker
|
||||
hermes sessions export OUT Export to JSONL
|
||||
hermes sessions rename ID T Rename a session
|
||||
hermes sessions delete ID Delete a session
|
||||
hermes sessions prune Clean up old sessions (--older-than N days)
|
||||
hermes sessions stats Session store statistics
|
||||
```
|
||||
|
||||
### Cron Jobs
|
||||
|
||||
```
|
||||
hermes cron list List jobs (--all for disabled)
|
||||
hermes cron create SCHED Create: '30m', 'every 2h', '0 9 * * *'
|
||||
hermes cron edit ID Edit schedule, prompt, delivery
|
||||
hermes cron pause/resume ID Control job state
|
||||
hermes cron run ID Trigger on next tick
|
||||
hermes cron remove ID Delete a job
|
||||
hermes cron status Scheduler status
|
||||
```
|
||||
|
||||
### Webhooks
|
||||
|
||||
```
|
||||
hermes webhook subscribe N Create route at /webhooks/<name>
|
||||
hermes webhook list List subscriptions
|
||||
hermes webhook remove NAME Remove a subscription
|
||||
hermes webhook test NAME Send a test POST
|
||||
```
|
||||
|
||||
### Profiles
|
||||
|
||||
```
|
||||
hermes profile list List all profiles
|
||||
hermes profile create NAME Create (--clone, --clone-all, --clone-from)
|
||||
hermes profile use NAME Set sticky default
|
||||
hermes profile delete NAME Delete a profile
|
||||
hermes profile show NAME Show details
|
||||
hermes profile alias NAME Manage wrapper scripts
|
||||
hermes profile rename A B Rename a profile
|
||||
hermes profile export NAME Export to tar.gz
|
||||
hermes profile import FILE Import from archive
|
||||
```
|
||||
|
||||
### Credential Pools
|
||||
|
||||
```
|
||||
hermes auth add Interactive credential wizard
|
||||
hermes auth list [PROVIDER] List pooled credentials
|
||||
hermes auth remove P INDEX Remove by provider + index
|
||||
hermes auth reset PROVIDER Clear exhaustion status
|
||||
```
|
||||
|
||||
### Other
|
||||
|
||||
```
|
||||
hermes insights [--days N] Usage analytics
|
||||
hermes update Update to latest version
|
||||
hermes pairing list/approve/revoke DM authorization
|
||||
hermes plugins list/install/remove Plugin management
|
||||
hermes honcho setup/status Honcho memory integration (requires honcho plugin)
|
||||
hermes memory setup/status/off Memory provider config
|
||||
hermes completion bash|zsh Shell completions
|
||||
hermes acp ACP server (IDE integration)
|
||||
hermes claw migrate Migrate from OpenClaw
|
||||
hermes uninstall Uninstall Hermes
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Slash Commands (In-Session)
|
||||
|
||||
Type these during an interactive chat session.
|
||||
|
||||
### Session Control
|
||||
```
|
||||
/new (/reset) Fresh session
|
||||
/clear Clear screen + new session (CLI)
|
||||
/retry Resend last message
|
||||
/undo Remove last exchange
|
||||
/title [name] Name the session
|
||||
/compress Manually compress context
|
||||
/stop Kill background processes
|
||||
/rollback [N] Restore filesystem checkpoint
|
||||
/background <prompt> Run prompt in background
|
||||
/queue <prompt> Queue for next turn
|
||||
/resume [name] Resume a named session
|
||||
```
|
||||
|
||||
### Configuration
|
||||
```
|
||||
/config Show config (CLI)
|
||||
/model [name] Show or change model
|
||||
/provider Show provider info
|
||||
/personality [name] Set personality
|
||||
/reasoning [level] Set reasoning (none|minimal|low|medium|high|xhigh|show|hide)
|
||||
/verbose Cycle: off → new → all → verbose
|
||||
/voice [on|off|tts] Voice mode
|
||||
/yolo Toggle approval bypass
|
||||
/skin [name] Change theme (CLI)
|
||||
/statusbar Toggle status bar (CLI)
|
||||
```
|
||||
|
||||
### Tools & Skills
|
||||
```
|
||||
/tools Manage tools (CLI)
|
||||
/toolsets List toolsets (CLI)
|
||||
/skills Search/install skills (CLI)
|
||||
/skill <name> Load a skill into session
|
||||
/cron Manage cron jobs (CLI)
|
||||
/reload-mcp Reload MCP servers
|
||||
/plugins List plugins (CLI)
|
||||
```
|
||||
|
||||
### Gateway
|
||||
```
|
||||
/approve Approve a pending command (gateway)
|
||||
/deny Deny a pending command (gateway)
|
||||
/restart Restart gateway (gateway)
|
||||
/sethome Set current chat as home channel (gateway)
|
||||
/update Update Hermes to latest (gateway)
|
||||
/platforms (/gateway) Show platform connection status (gateway)
|
||||
```
|
||||
|
||||
### Utility
|
||||
```
|
||||
/branch (/fork) Branch the current session
|
||||
/btw Ephemeral side question (doesn't interrupt main task)
|
||||
/fast Toggle priority/fast processing
|
||||
/browser Open CDP browser connection
|
||||
/history Show conversation history (CLI)
|
||||
/save Save conversation to file (CLI)
|
||||
/paste Attach clipboard image (CLI)
|
||||
/image Attach local image file (CLI)
|
||||
```
|
||||
|
||||
### Info
|
||||
```
|
||||
/help Show commands
|
||||
/commands [page] Browse all commands (gateway)
|
||||
/usage Token usage
|
||||
/insights [days] Usage analytics
|
||||
/status Session info (gateway)
|
||||
/profile Active profile info
|
||||
```
|
||||
|
||||
### Exit
|
||||
```
|
||||
/quit (/exit, /q) Exit CLI
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Key Paths & Config
|
||||
|
||||
```
|
||||
~/.hermes/config.yaml Main configuration
|
||||
~/.hermes/.env API keys and secrets
|
||||
~/.hermes/skills/ Installed skills
|
||||
~/.hermes/sessions/ Session transcripts
|
||||
~/.hermes/logs/ Gateway and error logs
|
||||
~/.hermes/auth.json OAuth tokens and credential pools
|
||||
~/.hermes/hermes-agent/ Source code (if git-installed)
|
||||
```
|
||||
|
||||
Profiles use `~/.hermes/profiles/<name>/` with the same layout.
|
||||
|
||||
### Config Sections
|
||||
|
||||
Edit with `hermes config edit` or `hermes config set section.key value`.
|
||||
|
||||
| Section | Key options |
|
||||
|---------|-------------|
|
||||
| `model` | `default`, `provider`, `base_url`, `api_key`, `context_length` |
|
||||
| `agent` | `max_turns` (90), `tool_use_enforcement` |
|
||||
| `terminal` | `backend` (local/docker/ssh/modal), `cwd`, `timeout` (180) |
|
||||
| `compression` | `enabled`, `threshold` (0.50), `target_ratio` (0.20) |
|
||||
| `display` | `skin`, `tool_progress`, `show_reasoning`, `show_cost` |
|
||||
| `stt` | `enabled`, `provider` (local/groq/openai/mistral) |
|
||||
| `tts` | `provider` (edge/elevenlabs/openai/minimax/mistral/neutts) |
|
||||
| `memory` | `memory_enabled`, `user_profile_enabled`, `provider` |
|
||||
| `security` | `tirith_enabled`, `website_blocklist` |
|
||||
| `delegation` | `model`, `provider`, `base_url`, `api_key`, `max_iterations` (50), `reasoning_effort` |
|
||||
| `smart_model_routing` | `enabled`, `cheap_model` |
|
||||
| `checkpoints` | `enabled`, `max_snapshots` (50) |
|
||||
|
||||
Full config reference: https://hermes-agent.nousresearch.com/docs/user-guide/configuration
|
||||
|
||||
### Providers
|
||||
|
||||
20+ providers supported. Set via `hermes model` or `hermes setup`.
|
||||
|
||||
| Provider | Auth | Key env var |
|
||||
|----------|------|-------------|
|
||||
| OpenRouter | API key | `OPENROUTER_API_KEY` |
|
||||
| Anthropic | API key | `ANTHROPIC_API_KEY` |
|
||||
| Nous Portal | OAuth | `hermes login --provider nous` |
|
||||
| OpenAI Codex | OAuth | `hermes login --provider openai-codex` |
|
||||
| GitHub Copilot | Token | `COPILOT_GITHUB_TOKEN` |
|
||||
| Google Gemini | API key | `GOOGLE_API_KEY` or `GEMINI_API_KEY` |
|
||||
| DeepSeek | API key | `DEEPSEEK_API_KEY` |
|
||||
| xAI / Grok | API key | `XAI_API_KEY` |
|
||||
| Hugging Face | Token | `HF_TOKEN` |
|
||||
| Z.AI / GLM | API key | `GLM_API_KEY` |
|
||||
| MiniMax | API key | `MINIMAX_API_KEY` |
|
||||
| MiniMax CN | API key | `MINIMAX_CN_API_KEY` |
|
||||
| Kimi / Moonshot | API key | `KIMI_API_KEY` |
|
||||
| Alibaba / DashScope | API key | `DASHSCOPE_API_KEY` |
|
||||
| Xiaomi MiMo | API key | `XIAOMI_API_KEY` |
|
||||
| Kilo Code | API key | `KILOCODE_API_KEY` |
|
||||
| AI Gateway (Vercel) | API key | `AI_GATEWAY_API_KEY` |
|
||||
| OpenCode Zen | API key | `OPENCODE_ZEN_API_KEY` |
|
||||
| OpenCode Go | API key | `OPENCODE_GO_API_KEY` |
|
||||
| Qwen OAuth | OAuth | `hermes login --provider qwen-oauth` |
|
||||
| Custom endpoint | Config | `model.base_url` + `model.api_key` in config.yaml |
|
||||
| GitHub Copilot ACP | External | `COPILOT_CLI_PATH` or Copilot CLI |
|
||||
|
||||
Full provider docs: https://hermes-agent.nousresearch.com/docs/integrations/providers
|
||||
|
||||
### Toolsets
|
||||
|
||||
Enable/disable via `hermes tools` (interactive) or `hermes tools enable/disable NAME`.
|
||||
|
||||
| Toolset | What it provides |
|
||||
|---------|-----------------|
|
||||
| `web` | Web search and content extraction |
|
||||
| `browser` | Browser automation (Browserbase, Camofox, or local Chromium) |
|
||||
| `terminal` | Shell commands and process management |
|
||||
| `file` | File read/write/search/patch |
|
||||
| `code_execution` | Sandboxed Python execution |
|
||||
| `vision` | Image analysis |
|
||||
| `image_gen` | AI image generation |
|
||||
| `tts` | Text-to-speech |
|
||||
| `skills` | Skill browsing and management |
|
||||
| `memory` | Persistent cross-session memory |
|
||||
| `session_search` | Search past conversations |
|
||||
| `delegation` | Subagent task delegation |
|
||||
| `cronjob` | Scheduled task management |
|
||||
| `clarify` | Ask user clarifying questions |
|
||||
| `messaging` | Cross-platform message sending |
|
||||
| `search` | Web search only (subset of `web`) |
|
||||
| `todo` | In-session task planning and tracking |
|
||||
| `rl` | Reinforcement learning tools (off by default) |
|
||||
| `moa` | Mixture of Agents (off by default) |
|
||||
| `homeassistant` | Smart home control (off by default) |
|
||||
|
||||
Tool changes take effect on `/reset` (new session). They do NOT apply mid-conversation to preserve prompt caching.
|
||||
|
||||
---
|
||||
|
||||
## Voice & Transcription
|
||||
|
||||
### STT (Voice → Text)
|
||||
|
||||
Voice messages from messaging platforms are auto-transcribed.
|
||||
|
||||
Provider priority (auto-detected):
|
||||
1. **Local faster-whisper** — free, no API key: `pip install faster-whisper`
|
||||
2. **Groq Whisper** — free tier: set `GROQ_API_KEY`
|
||||
3. **OpenAI Whisper** — paid: set `VOICE_TOOLS_OPENAI_KEY`
|
||||
4. **Mistral Voxtral** — set `MISTRAL_API_KEY`
|
||||
|
||||
Config:
|
||||
```yaml
|
||||
stt:
|
||||
enabled: true
|
||||
provider: local # local, groq, openai, mistral
|
||||
local:
|
||||
model: base # tiny, base, small, medium, large-v3
|
||||
```
|
||||
|
||||
### TTS (Text → Voice)
|
||||
|
||||
| Provider | Env var | Free? |
|
||||
|----------|---------|-------|
|
||||
| Edge TTS | None | Yes (default) |
|
||||
| ElevenLabs | `ELEVENLABS_API_KEY` | Free tier |
|
||||
| OpenAI | `VOICE_TOOLS_OPENAI_KEY` | Paid |
|
||||
| MiniMax | `MINIMAX_API_KEY` | Paid |
|
||||
| Mistral (Voxtral) | `MISTRAL_API_KEY` | Paid |
|
||||
| NeuTTS (local) | None (`pip install neutts[all]` + `espeak-ng`) | Free |
|
||||
|
||||
Voice commands: `/voice on` (voice-to-voice), `/voice tts` (always voice), `/voice off`.
|
||||
|
||||
---
|
||||
|
||||
## Spawning Additional Hermes Instances
|
||||
|
||||
Run additional Hermes processes as fully independent subprocesses — separate sessions, tools, and environments.
|
||||
|
||||
### When to Use This vs delegate_task
|
||||
|
||||
| | `delegate_task` | Spawning `hermes` process |
|
||||
|-|-----------------|--------------------------|
|
||||
| Isolation | Separate conversation, shared process | Fully independent process |
|
||||
| Duration | Minutes (bounded by parent loop) | Hours/days |
|
||||
| Tool access | Subset of parent's tools | Full tool access |
|
||||
| Interactive | No | Yes (PTY mode) |
|
||||
| Use case | Quick parallel subtasks | Long autonomous missions |
|
||||
|
||||
### One-Shot Mode
|
||||
|
||||
```
|
||||
terminal(command="hermes chat -q 'Research GRPO papers and write summary to ~/research/grpo.md'", timeout=300)
|
||||
|
||||
# Background for long tasks:
|
||||
terminal(command="hermes chat -q 'Set up CI/CD for ~/myapp'", background=true)
|
||||
```
|
||||
|
||||
### Interactive PTY Mode (via tmux)
|
||||
|
||||
Hermes uses prompt_toolkit, which requires a real terminal. Use tmux for interactive spawning:
|
||||
|
||||
```
|
||||
# Start
|
||||
terminal(command="tmux new-session -d -s agent1 -x 120 -y 40 'hermes'", timeout=10)
|
||||
|
||||
# Wait for startup, then send a message
|
||||
terminal(command="sleep 8 && tmux send-keys -t agent1 'Build a FastAPI auth service' Enter", timeout=15)
|
||||
|
||||
# Read output
|
||||
terminal(command="sleep 20 && tmux capture-pane -t agent1 -p", timeout=5)
|
||||
|
||||
# Send follow-up
|
||||
terminal(command="tmux send-keys -t agent1 'Add rate limiting middleware' Enter", timeout=5)
|
||||
|
||||
# Exit
|
||||
terminal(command="tmux send-keys -t agent1 '/exit' Enter && sleep 2 && tmux kill-session -t agent1", timeout=10)
|
||||
```
|
||||
|
||||
### Multi-Agent Coordination
|
||||
|
||||
```
|
||||
# Agent A: backend
|
||||
terminal(command="tmux new-session -d -s backend -x 120 -y 40 'hermes -w'", timeout=10)
|
||||
terminal(command="sleep 8 && tmux send-keys -t backend 'Build REST API for user management' Enter", timeout=15)
|
||||
|
||||
# Agent B: frontend
|
||||
terminal(command="tmux new-session -d -s frontend -x 120 -y 40 'hermes -w'", timeout=10)
|
||||
terminal(command="sleep 8 && tmux send-keys -t frontend 'Build React dashboard for user management' Enter", timeout=15)
|
||||
|
||||
# Check progress, relay context between them
|
||||
terminal(command="tmux capture-pane -t backend -p | tail -30", timeout=5)
|
||||
terminal(command="tmux send-keys -t frontend 'Here is the API schema from the backend agent: ...' Enter", timeout=5)
|
||||
```
|
||||
|
||||
### Session Resume
|
||||
|
||||
```
|
||||
# Resume most recent session
|
||||
terminal(command="tmux new-session -d -s resumed 'hermes --continue'", timeout=10)
|
||||
|
||||
# Resume specific session
|
||||
terminal(command="tmux new-session -d -s resumed 'hermes --resume 20260225_143052_a1b2c3'", timeout=10)
|
||||
```
|
||||
|
||||
### Tips
|
||||
|
||||
- **Prefer `delegate_task` for quick subtasks** — less overhead than spawning a full process
|
||||
- **Use `-w` (worktree mode)** when spawning agents that edit code — prevents git conflicts
|
||||
- **Set timeouts** for one-shot mode — complex tasks can take 5-10 minutes
|
||||
- **Use `hermes chat -q` for fire-and-forget** — no PTY needed
|
||||
- **Use tmux for interactive sessions** — raw PTY mode has `\r` vs `\n` issues with prompt_toolkit
|
||||
- **For scheduled tasks**, use the `cronjob` tool instead of spawning — handles delivery and retry
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Voice not working
|
||||
1. Check `stt.enabled: true` in config.yaml
|
||||
2. Verify provider: `pip install faster-whisper` or set API key
|
||||
3. In gateway: `/restart`. In CLI: exit and relaunch.
|
||||
|
||||
### Tool not available
|
||||
1. `hermes tools` — check if toolset is enabled for your platform
|
||||
2. Some tools need env vars (check `.env`)
|
||||
3. `/reset` after enabling tools
|
||||
|
||||
### Model/provider issues
|
||||
1. `hermes doctor` — check config and dependencies
|
||||
2. `hermes login` — re-authenticate OAuth providers
|
||||
3. Check `.env` has the right API key
|
||||
4. **Copilot 403**: `gh auth login` tokens do NOT work for Copilot API. You must use the Copilot-specific OAuth device code flow via `hermes model` → GitHub Copilot.
|
||||
|
||||
### Changes not taking effect
|
||||
- **Tools/skills:** `/reset` starts a new session with updated toolset
|
||||
- **Config changes:** In gateway: `/restart`. In CLI: exit and relaunch.
|
||||
- **Code changes:** Restart the CLI or gateway process
|
||||
|
||||
### Skills not showing
|
||||
1. `hermes skills list` — verify installed
|
||||
2. `hermes skills config` — check platform enablement
|
||||
3. Load explicitly: `/skill name` or `hermes -s name`
|
||||
|
||||
### Gateway issues
|
||||
Check logs first:
|
||||
```bash
|
||||
grep -i "failed to send\|error" ~/.hermes/logs/gateway.log | tail -20
|
||||
```
|
||||
|
||||
Common gateway problems:
|
||||
- **Gateway dies on SSH logout**: Enable linger: `sudo loginctl enable-linger $USER`
|
||||
- **Gateway dies on WSL2 close**: WSL2 requires `systemd=true` in `/etc/wsl.conf` for systemd services to work. Without it, gateway falls back to `nohup` (dies when session closes).
|
||||
- **Gateway crash loop**: Reset the failed state: `systemctl --user reset-failed hermes-gateway`
|
||||
|
||||
### Platform-specific issues
|
||||
- **Discord bot silent**: Must enable **Message Content Intent** in Bot → Privileged Gateway Intents.
|
||||
- **Slack bot only works in DMs**: Must subscribe to `message.channels` event. Without it, the bot ignores public channels.
|
||||
- **Windows HTTP 400 "No models provided"**: Config file encoding issue (BOM). Ensure `config.yaml` is saved as UTF-8 without BOM.
|
||||
|
||||
### Auxiliary models not working
|
||||
If `auxiliary` tasks (vision, compression, session_search) fail silently, the `auto` provider can't find a backend. Either set `OPENROUTER_API_KEY` or `GOOGLE_API_KEY`, or explicitly configure each auxiliary task's provider:
|
||||
```bash
|
||||
hermes config set auxiliary.vision.provider <your_provider>
|
||||
hermes config set auxiliary.vision.model <model_name>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Where to Find Things
|
||||
|
||||
| Looking for... | Location |
|
||||
|----------------|----------|
|
||||
| Config options | `hermes config edit` or [Configuration docs](https://hermes-agent.nousresearch.com/docs/user-guide/configuration) |
|
||||
| Available tools | `hermes tools list` or [Tools reference](https://hermes-agent.nousresearch.com/docs/reference/tools-reference) |
|
||||
| Slash commands | `/help` in session or [Slash commands reference](https://hermes-agent.nousresearch.com/docs/reference/slash-commands) |
|
||||
| Skills catalog | `hermes skills browse` or [Skills catalog](https://hermes-agent.nousresearch.com/docs/reference/skills-catalog) |
|
||||
| Provider setup | `hermes model` or [Providers guide](https://hermes-agent.nousresearch.com/docs/integrations/providers) |
|
||||
| Platform setup | `hermes gateway setup` or [Messaging docs](https://hermes-agent.nousresearch.com/docs/user-guide/messaging/) |
|
||||
| MCP servers | `hermes mcp list` or [MCP guide](https://hermes-agent.nousresearch.com/docs/user-guide/features/mcp) |
|
||||
| Profiles | `hermes profile list` or [Profiles docs](https://hermes-agent.nousresearch.com/docs/user-guide/profiles) |
|
||||
| Cron jobs | `hermes cron list` or [Cron docs](https://hermes-agent.nousresearch.com/docs/user-guide/features/cron) |
|
||||
| Memory | `hermes memory status` or [Memory docs](https://hermes-agent.nousresearch.com/docs/user-guide/features/memory) |
|
||||
| Env variables | `hermes config env-path` or [Env vars reference](https://hermes-agent.nousresearch.com/docs/reference/environment-variables) |
|
||||
| CLI commands | `hermes --help` or [CLI reference](https://hermes-agent.nousresearch.com/docs/reference/cli-commands) |
|
||||
| Gateway logs | `~/.hermes/logs/gateway.log` |
|
||||
| Session files | `~/.hermes/sessions/` or `hermes sessions browse` |
|
||||
| Source code | `~/.hermes/hermes-agent/` |
|
||||
|
||||
---
|
||||
|
||||
## Contributor Quick Reference
|
||||
|
||||
For occasional contributors and PR authors. Full developer docs: https://hermes-agent.nousresearch.com/docs/developer-guide/
|
||||
|
||||
### Project Layout
|
||||
|
||||
```
|
||||
hermes-agent/
|
||||
├── run_agent.py # AIAgent — core conversation loop
|
||||
├── model_tools.py # Tool discovery and dispatch
|
||||
├── toolsets.py # Toolset definitions
|
||||
├── cli.py # Interactive CLI (HermesCLI)
|
||||
├── hermes_state.py # SQLite session store
|
||||
├── agent/ # Prompt builder, context compression, memory, model routing, credential pooling, skill dispatch
|
||||
├── hermes_cli/ # CLI subcommands, config, setup, commands
|
||||
│ ├── commands.py # Slash command registry (CommandDef)
|
||||
│ ├── config.py # DEFAULT_CONFIG, env var definitions
|
||||
│ └── main.py # CLI entry point and argparse
|
||||
├── tools/ # One file per tool
|
||||
│ └── registry.py # Central tool registry
|
||||
├── gateway/ # Messaging gateway
|
||||
│ └── platforms/ # Platform adapters (telegram, discord, etc.)
|
||||
├── cron/ # Job scheduler
|
||||
├── tests/ # ~3000 pytest tests
|
||||
└── website/ # Docusaurus docs site
|
||||
```
|
||||
|
||||
Config: `~/.hermes/config.yaml` (settings), `~/.hermes/.env` (API keys).
|
||||
|
||||
### Adding a Tool (3 files)
|
||||
|
||||
**1. Create `tools/your_tool.py`:**
|
||||
```python
|
||||
import json, os
|
||||
from tools.registry import registry
|
||||
|
||||
def check_requirements() -> bool:
|
||||
return bool(os.getenv("EXAMPLE_API_KEY"))
|
||||
|
||||
def example_tool(param: str, task_id: str = None) -> str:
|
||||
return json.dumps({"success": True, "data": "..."})
|
||||
|
||||
registry.register(
|
||||
name="example_tool",
|
||||
toolset="example",
|
||||
schema={"name": "example_tool", "description": "...", "parameters": {...}},
|
||||
handler=lambda args, **kw: example_tool(
|
||||
param=args.get("param", ""), task_id=kw.get("task_id")),
|
||||
check_fn=check_requirements,
|
||||
requires_env=["EXAMPLE_API_KEY"],
|
||||
)
|
||||
```
|
||||
|
||||
**2. Add import** in `model_tools.py` → `_discover_tools()` list.
|
||||
|
||||
**3. Add to `toolsets.py`** → `_HERMES_CORE_TOOLS` list.
|
||||
|
||||
All handlers must return JSON strings. Use `get_hermes_home()` for paths, never hardcode `~/.hermes`.
|
||||
|
||||
### Adding a Slash Command
|
||||
|
||||
1. Add `CommandDef` to `COMMAND_REGISTRY` in `hermes_cli/commands.py`
|
||||
2. Add handler in `cli.py` → `process_command()`
|
||||
3. (Optional) Add gateway handler in `gateway/run.py`
|
||||
|
||||
All consumers (help text, autocomplete, Telegram menu, Slack mapping) derive from the central registry automatically.
|
||||
|
||||
### Agent Loop (High Level)
|
||||
|
||||
```
|
||||
run_conversation():
|
||||
1. Build system prompt
|
||||
2. Loop while iterations < max:
|
||||
a. Call LLM (OpenAI-format messages + tool schemas)
|
||||
b. If tool_calls → dispatch each via handle_function_call() → append results → continue
|
||||
c. If text response → return
|
||||
3. Context compression triggers automatically near token limit
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
```bash
|
||||
python -m pytest tests/ -o 'addopts=' -q # Full suite
|
||||
python -m pytest tests/tools/ -q # Specific area
|
||||
```
|
||||
|
||||
- Tests auto-redirect `HERMES_HOME` to temp dirs — never touch real `~/.hermes/`
|
||||
- Run full suite before pushing any change
|
||||
- Use `-o 'addopts='` to clear any baked-in pytest flags
|
||||
|
||||
### Commit Conventions
|
||||
|
||||
```
|
||||
type: concise subject line
|
||||
|
||||
Optional body.
|
||||
```
|
||||
|
||||
Types: `fix:`, `feat:`, `refactor:`, `docs:`, `chore:`
|
||||
|
||||
### Key Rules
|
||||
|
||||
- **Never break prompt caching** — don't change context, tools, or system prompt mid-conversation
|
||||
- **Message role alternation** — never two assistant or two user messages in a row
|
||||
- Use `get_hermes_home()` from `hermes_constants` for all paths (profile-safe)
|
||||
- Config values go in `config.yaml`, secrets go in `.env`
|
||||
- New tools need a `check_fn` so they only appear when requirements are met
|
||||
218
skills/autonomous-ai-agents/opencode/SKILL.md
Normal file
218
skills/autonomous-ai-agents/opencode/SKILL.md
Normal file
@@ -0,0 +1,218 @@
|
||||
---
|
||||
name: opencode
|
||||
description: Delegate coding tasks to OpenCode CLI agent for feature implementation, refactoring, PR review, and long-running autonomous sessions. Requires the opencode CLI installed and authenticated.
|
||||
version: 1.2.0
|
||||
author: Hermes Agent
|
||||
license: MIT
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [Coding-Agent, OpenCode, Autonomous, Refactoring, Code-Review]
|
||||
related_skills: [claude-code, codex, hermes-agent]
|
||||
---
|
||||
|
||||
# OpenCode CLI
|
||||
|
||||
Use [OpenCode](https://opencode.ai) as an autonomous coding worker orchestrated by Hermes terminal/process tools. OpenCode is a provider-agnostic, open-source AI coding agent with a TUI and CLI.
|
||||
|
||||
## When to Use
|
||||
|
||||
- User explicitly asks to use OpenCode
|
||||
- You want an external coding agent to implement/refactor/review code
|
||||
- You need long-running coding sessions with progress checks
|
||||
- You want parallel task execution in isolated workdirs/worktrees
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- OpenCode installed: `npm i -g opencode-ai@latest` or `brew install anomalyco/tap/opencode`
|
||||
- Auth configured: `opencode auth login` or set provider env vars (OPENROUTER_API_KEY, etc.)
|
||||
- Verify: `opencode auth list` should show at least one provider
|
||||
- Git repository for code tasks (recommended)
|
||||
- `pty=true` for interactive TUI sessions
|
||||
|
||||
## Binary Resolution (Important)
|
||||
|
||||
Shell environments may resolve different OpenCode binaries. If behavior differs between your terminal and Hermes, check:
|
||||
|
||||
```
|
||||
terminal(command="which -a opencode")
|
||||
terminal(command="opencode --version")
|
||||
```
|
||||
|
||||
If needed, pin an explicit binary path:
|
||||
|
||||
```
|
||||
terminal(command="$HOME/.opencode/bin/opencode run '...'", workdir="~/project", pty=true)
|
||||
```
|
||||
|
||||
## One-Shot Tasks
|
||||
|
||||
Use `opencode run` for bounded, non-interactive tasks:
|
||||
|
||||
```
|
||||
terminal(command="opencode run 'Add retry logic to API calls and update tests'", workdir="~/project")
|
||||
```
|
||||
|
||||
Attach context files with `-f`:
|
||||
|
||||
```
|
||||
terminal(command="opencode run 'Review this config for security issues' -f config.yaml -f .env.example", workdir="~/project")
|
||||
```
|
||||
|
||||
Show model thinking with `--thinking`:
|
||||
|
||||
```
|
||||
terminal(command="opencode run 'Debug why tests fail in CI' --thinking", workdir="~/project")
|
||||
```
|
||||
|
||||
Force a specific model:
|
||||
|
||||
```
|
||||
terminal(command="opencode run 'Refactor auth module' --model openrouter/anthropic/claude-sonnet-4", workdir="~/project")
|
||||
```
|
||||
|
||||
## Interactive Sessions (Background)
|
||||
|
||||
For iterative work requiring multiple exchanges, start the TUI in background:
|
||||
|
||||
```
|
||||
terminal(command="opencode", workdir="~/project", background=true, pty=true)
|
||||
# Returns session_id
|
||||
|
||||
# Send a prompt
|
||||
process(action="submit", session_id="<id>", data="Implement OAuth refresh flow and add tests")
|
||||
|
||||
# Monitor progress
|
||||
process(action="poll", session_id="<id>")
|
||||
process(action="log", session_id="<id>")
|
||||
|
||||
# Send follow-up input
|
||||
process(action="submit", session_id="<id>", data="Now add error handling for token expiry")
|
||||
|
||||
# Exit cleanly — Ctrl+C
|
||||
process(action="write", session_id="<id>", data="\x03")
|
||||
# Or just kill the process
|
||||
process(action="kill", session_id="<id>")
|
||||
```
|
||||
|
||||
**Important:** Do NOT use `/exit` — it is not a valid OpenCode command and will open an agent selector dialog instead. Use Ctrl+C (`\x03`) or `process(action="kill")` to exit.
|
||||
|
||||
### TUI Keybindings
|
||||
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `Enter` | Submit message (press twice if needed) |
|
||||
| `Tab` | Switch between agents (build/plan) |
|
||||
| `Ctrl+P` | Open command palette |
|
||||
| `Ctrl+X L` | Switch session |
|
||||
| `Ctrl+X M` | Switch model |
|
||||
| `Ctrl+X N` | New session |
|
||||
| `Ctrl+X E` | Open editor |
|
||||
| `Ctrl+C` | Exit OpenCode |
|
||||
|
||||
### Resuming Sessions
|
||||
|
||||
After exiting, OpenCode prints a session ID. Resume with:
|
||||
|
||||
```
|
||||
terminal(command="opencode -c", workdir="~/project", background=true, pty=true) # Continue last session
|
||||
terminal(command="opencode -s ses_abc123", workdir="~/project", background=true, pty=true) # Specific session
|
||||
```
|
||||
|
||||
## Common Flags
|
||||
|
||||
| Flag | Use |
|
||||
|------|-----|
|
||||
| `run 'prompt'` | One-shot execution and exit |
|
||||
| `--continue` / `-c` | Continue the last OpenCode session |
|
||||
| `--session <id>` / `-s` | Continue a specific session |
|
||||
| `--agent <name>` | Choose OpenCode agent (build or plan) |
|
||||
| `--model provider/model` | Force specific model |
|
||||
| `--format json` | Machine-readable output/events |
|
||||
| `--file <path>` / `-f` | Attach file(s) to the message |
|
||||
| `--thinking` | Show model thinking blocks |
|
||||
| `--variant <level>` | Reasoning effort (high, max, minimal) |
|
||||
| `--title <name>` | Name the session |
|
||||
| `--attach <url>` | Connect to a running opencode server |
|
||||
|
||||
## Procedure
|
||||
|
||||
1. Verify tool readiness:
|
||||
- `terminal(command="opencode --version")`
|
||||
- `terminal(command="opencode auth list")`
|
||||
2. For bounded tasks, use `opencode run '...'` (no pty needed).
|
||||
3. For iterative tasks, start `opencode` with `background=true, pty=true`.
|
||||
4. Monitor long tasks with `process(action="poll"|"log")`.
|
||||
5. If OpenCode asks for input, respond via `process(action="submit", ...)`.
|
||||
6. Exit with `process(action="write", data="\x03")` or `process(action="kill")`.
|
||||
7. Summarize file changes, test results, and next steps back to user.
|
||||
|
||||
## PR Review Workflow
|
||||
|
||||
OpenCode has a built-in PR command:
|
||||
|
||||
```
|
||||
terminal(command="opencode pr 42", workdir="~/project", pty=true)
|
||||
```
|
||||
|
||||
Or review in a temporary clone for isolation:
|
||||
|
||||
```
|
||||
terminal(command="REVIEW=$(mktemp -d) && git clone https://github.com/user/repo.git $REVIEW && cd $REVIEW && opencode run 'Review this PR vs main. Report bugs, security risks, test gaps, and style issues.' -f $(git diff origin/main --name-only | head -20 | tr '\n' ' ')", pty=true)
|
||||
```
|
||||
|
||||
## Parallel Work Pattern
|
||||
|
||||
Use separate workdirs/worktrees to avoid collisions:
|
||||
|
||||
```
|
||||
terminal(command="opencode run 'Fix issue #101 and commit'", workdir="/tmp/issue-101", background=true, pty=true)
|
||||
terminal(command="opencode run 'Add parser regression tests and commit'", workdir="/tmp/issue-102", background=true, pty=true)
|
||||
process(action="list")
|
||||
```
|
||||
|
||||
## Session & Cost Management
|
||||
|
||||
List past sessions:
|
||||
|
||||
```
|
||||
terminal(command="opencode session list")
|
||||
```
|
||||
|
||||
Check token usage and costs:
|
||||
|
||||
```
|
||||
terminal(command="opencode stats")
|
||||
terminal(command="opencode stats --days 7 --models anthropic/claude-sonnet-4")
|
||||
```
|
||||
|
||||
## Pitfalls
|
||||
|
||||
- Interactive `opencode` (TUI) sessions require `pty=true`. The `opencode run` command does NOT need pty.
|
||||
- `/exit` is NOT a valid command — it opens an agent selector. Use Ctrl+C to exit the TUI.
|
||||
- PATH mismatch can select the wrong OpenCode binary/model config.
|
||||
- If OpenCode appears stuck, inspect logs before killing:
|
||||
- `process(action="log", session_id="<id>")`
|
||||
- Avoid sharing one working directory across parallel OpenCode sessions.
|
||||
- Enter may need to be pressed twice to submit in the TUI (once to finalize text, once to send).
|
||||
|
||||
## Verification
|
||||
|
||||
Smoke test:
|
||||
|
||||
```
|
||||
terminal(command="opencode run 'Respond with exactly: OPENCODE_SMOKE_OK'")
|
||||
```
|
||||
|
||||
Success criteria:
|
||||
- Output includes `OPENCODE_SMOKE_OK`
|
||||
- Command exits without provider/model errors
|
||||
- For code tasks: expected files changed and tests pass
|
||||
|
||||
## Rules
|
||||
|
||||
1. Prefer `opencode run` for one-shot automation — it's simpler and doesn't need pty.
|
||||
2. Use interactive background mode only when iteration is needed.
|
||||
3. Always scope OpenCode sessions to a single repo/workdir.
|
||||
4. For long tasks, provide progress updates from `process` logs.
|
||||
5. Report concrete outcomes (files changed, tests, remaining risks).
|
||||
6. Exit interactive sessions with Ctrl+C or kill, never `/exit`.
|
||||
3
skills/creative/DESCRIPTION.md
Normal file
3
skills/creative/DESCRIPTION.md
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
description: Creative content generation — ASCII art, hand-drawn style diagrams, and visual design tools.
|
||||
---
|
||||
321
skills/creative/ascii-art/SKILL.md
Normal file
321
skills/creative/ascii-art/SKILL.md
Normal file
@@ -0,0 +1,321 @@
|
||||
---
|
||||
name: ascii-art
|
||||
description: Generate ASCII art using pyfiglet (571 fonts), cowsay, boxes, toilet, image-to-ascii, remote APIs (asciified, ascii.co.uk), and LLM fallback. No API keys required.
|
||||
version: 4.0.0
|
||||
author: 0xbyt4, Hermes Agent
|
||||
license: MIT
|
||||
dependencies: []
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [ASCII, Art, Banners, Creative, Unicode, Text-Art, pyfiglet, figlet, cowsay, boxes]
|
||||
related_skills: [excalidraw]
|
||||
|
||||
---
|
||||
|
||||
# ASCII Art Skill
|
||||
|
||||
Multiple tools for different ASCII art needs. All tools are local CLI programs or free REST APIs — no API keys required.
|
||||
|
||||
## Tool 1: Text Banners (pyfiglet — local)
|
||||
|
||||
Render text as large ASCII art banners. 571 built-in fonts.
|
||||
|
||||
### Setup
|
||||
|
||||
```bash
|
||||
pip install pyfiglet --break-system-packages -q
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
python3 -m pyfiglet "YOUR TEXT" -f slant
|
||||
python3 -m pyfiglet "TEXT" -f doom -w 80 # Set width
|
||||
python3 -m pyfiglet --list_fonts # List all 571 fonts
|
||||
```
|
||||
|
||||
### Recommended fonts
|
||||
|
||||
| Style | Font | Best for |
|
||||
|-------|------|----------|
|
||||
| Clean & modern | `slant` | Project names, headers |
|
||||
| Bold & blocky | `doom` | Titles, logos |
|
||||
| Big & readable | `big` | Banners |
|
||||
| Classic banner | `banner3` | Wide displays |
|
||||
| Compact | `small` | Subtitles |
|
||||
| Cyberpunk | `cyberlarge` | Tech themes |
|
||||
| 3D effect | `3-d` | Splash screens |
|
||||
| Gothic | `gothic` | Dramatic text |
|
||||
|
||||
### Tips
|
||||
|
||||
- Preview 2-3 fonts and let the user pick their favorite
|
||||
- Short text (1-8 chars) works best with detailed fonts like `doom` or `block`
|
||||
- Long text works better with compact fonts like `small` or `mini`
|
||||
|
||||
## Tool 2: Text Banners (asciified API — remote, no install)
|
||||
|
||||
Free REST API that converts text to ASCII art. 250+ FIGlet fonts. Returns plain text directly — no parsing needed. Use this when pyfiglet is not installed or as a quick alternative.
|
||||
|
||||
### Usage (via terminal curl)
|
||||
|
||||
```bash
|
||||
# Basic text banner (default font)
|
||||
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello+World"
|
||||
|
||||
# With a specific font
|
||||
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=Slant"
|
||||
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=Doom"
|
||||
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=Star+Wars"
|
||||
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=3-D"
|
||||
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=Banner3"
|
||||
|
||||
# List all available fonts (returns JSON array)
|
||||
curl -s "https://asciified.thelicato.io/api/v2/fonts"
|
||||
```
|
||||
|
||||
### Tips
|
||||
|
||||
- URL-encode spaces as `+` in the text parameter
|
||||
- The response is plain text ASCII art — no JSON wrapping, ready to display
|
||||
- Font names are case-sensitive; use the fonts endpoint to get exact names
|
||||
- Works from any terminal with curl — no Python or pip needed
|
||||
|
||||
## Tool 3: Cowsay (Message Art)
|
||||
|
||||
Classic tool that wraps text in a speech bubble with an ASCII character.
|
||||
|
||||
### Setup
|
||||
|
||||
```bash
|
||||
sudo apt install cowsay -y # Debian/Ubuntu
|
||||
# brew install cowsay # macOS
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
cowsay "Hello World"
|
||||
cowsay -f tux "Linux rules" # Tux the penguin
|
||||
cowsay -f dragon "Rawr!" # Dragon
|
||||
cowsay -f stegosaurus "Roar!" # Stegosaurus
|
||||
cowthink "Hmm..." # Thought bubble
|
||||
cowsay -l # List all characters
|
||||
```
|
||||
|
||||
### Available characters (50+)
|
||||
|
||||
`beavis.zen`, `bong`, `bunny`, `cheese`, `daemon`, `default`, `dragon`,
|
||||
`dragon-and-cow`, `elephant`, `eyes`, `flaming-skull`, `ghostbusters`,
|
||||
`hellokitty`, `kiss`, `kitty`, `koala`, `luke-koala`, `mech-and-cow`,
|
||||
`meow`, `moofasa`, `moose`, `ren`, `sheep`, `skeleton`, `small`,
|
||||
`stegosaurus`, `stimpy`, `supermilker`, `surgery`, `three-eyes`,
|
||||
`turkey`, `turtle`, `tux`, `udder`, `vader`, `vader-koala`, `www`
|
||||
|
||||
### Eye/tongue modifiers
|
||||
|
||||
```bash
|
||||
cowsay -b "Borg" # =_= eyes
|
||||
cowsay -d "Dead" # x_x eyes
|
||||
cowsay -g "Greedy" # $_$ eyes
|
||||
cowsay -p "Paranoid" # @_@ eyes
|
||||
cowsay -s "Stoned" # *_* eyes
|
||||
cowsay -w "Wired" # O_O eyes
|
||||
cowsay -e "OO" "Msg" # Custom eyes
|
||||
cowsay -T "U " "Msg" # Custom tongue
|
||||
```
|
||||
|
||||
## Tool 4: Boxes (Decorative Borders)
|
||||
|
||||
Draw decorative ASCII art borders/frames around any text. 70+ built-in designs.
|
||||
|
||||
### Setup
|
||||
|
||||
```bash
|
||||
sudo apt install boxes -y # Debian/Ubuntu
|
||||
# brew install boxes # macOS
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
echo "Hello World" | boxes # Default box
|
||||
echo "Hello World" | boxes -d stone # Stone border
|
||||
echo "Hello World" | boxes -d parchment # Parchment scroll
|
||||
echo "Hello World" | boxes -d cat # Cat border
|
||||
echo "Hello World" | boxes -d dog # Dog border
|
||||
echo "Hello World" | boxes -d unicornsay # Unicorn
|
||||
echo "Hello World" | boxes -d diamonds # Diamond pattern
|
||||
echo "Hello World" | boxes -d c-cmt # C-style comment
|
||||
echo "Hello World" | boxes -d html-cmt # HTML comment
|
||||
echo "Hello World" | boxes -a c # Center text
|
||||
boxes -l # List all 70+ designs
|
||||
```
|
||||
|
||||
### Combine with pyfiglet or asciified
|
||||
|
||||
```bash
|
||||
python3 -m pyfiglet "HERMES" -f slant | boxes -d stone
|
||||
# Or without pyfiglet installed:
|
||||
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=HERMES&font=Slant" | boxes -d stone
|
||||
```
|
||||
|
||||
## Tool 5: TOIlet (Colored Text Art)
|
||||
|
||||
Like pyfiglet but with ANSI color effects and visual filters. Great for terminal eye candy.
|
||||
|
||||
### Setup
|
||||
|
||||
```bash
|
||||
sudo apt install toilet toilet-fonts -y # Debian/Ubuntu
|
||||
# brew install toilet # macOS
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
toilet "Hello World" # Basic text art
|
||||
toilet -f bigmono12 "Hello" # Specific font
|
||||
toilet --gay "Rainbow!" # Rainbow coloring
|
||||
toilet --metal "Metal!" # Metallic effect
|
||||
toilet -F border "Bordered" # Add border
|
||||
toilet -F border --gay "Fancy!" # Combined effects
|
||||
toilet -f pagga "Block" # Block-style font (unique to toilet)
|
||||
toilet -F list # List available filters
|
||||
```
|
||||
|
||||
### Filters
|
||||
|
||||
`crop`, `gay` (rainbow), `metal`, `flip`, `flop`, `180`, `left`, `right`, `border`
|
||||
|
||||
**Note**: toilet outputs ANSI escape codes for colors — works in terminals but may not render in all contexts (e.g., plain text files, some chat platforms).
|
||||
|
||||
## Tool 6: Image to ASCII Art
|
||||
|
||||
Convert images (PNG, JPEG, GIF, WEBP) to ASCII art.
|
||||
|
||||
### Option A: ascii-image-converter (recommended, modern)
|
||||
|
||||
```bash
|
||||
# Install
|
||||
sudo snap install ascii-image-converter
|
||||
# OR: go install github.com/TheZoraiz/ascii-image-converter@latest
|
||||
```
|
||||
|
||||
```bash
|
||||
ascii-image-converter image.png # Basic
|
||||
ascii-image-converter image.png -C # Color output
|
||||
ascii-image-converter image.png -d 60,30 # Set dimensions
|
||||
ascii-image-converter image.png -b # Braille characters
|
||||
ascii-image-converter image.png -n # Negative/inverted
|
||||
ascii-image-converter https://url/image.jpg # Direct URL
|
||||
ascii-image-converter image.png --save-txt out # Save as text
|
||||
```
|
||||
|
||||
### Option B: jp2a (lightweight, JPEG only)
|
||||
|
||||
```bash
|
||||
sudo apt install jp2a -y
|
||||
jp2a --width=80 image.jpg
|
||||
jp2a --colors image.jpg # Colorized
|
||||
```
|
||||
|
||||
## Tool 7: Search Pre-Made ASCII Art
|
||||
|
||||
Search curated ASCII art from the web. Use `terminal` with `curl`.
|
||||
|
||||
### Source A: ascii.co.uk (recommended for pre-made art)
|
||||
|
||||
Large collection of classic ASCII art organized by subject. Art is inside HTML `<pre>` tags. Fetch the page with curl, then extract art with a small Python snippet.
|
||||
|
||||
**URL pattern:** `https://ascii.co.uk/art/{subject}`
|
||||
|
||||
**Step 1 — Fetch the page:**
|
||||
|
||||
```bash
|
||||
curl -s 'https://ascii.co.uk/art/cat' -o /tmp/ascii_art.html
|
||||
```
|
||||
|
||||
**Step 2 — Extract art from pre tags:**
|
||||
|
||||
```python
|
||||
import re, html
|
||||
with open('/tmp/ascii_art.html') as f:
|
||||
text = f.read()
|
||||
arts = re.findall(r'<pre[^>]*>(.*?)</pre>', text, re.DOTALL)
|
||||
for art in arts:
|
||||
clean = re.sub(r'<[^>]+>', '', art)
|
||||
clean = html.unescape(clean).strip()
|
||||
if len(clean) > 30:
|
||||
print(clean)
|
||||
print('\n---\n')
|
||||
```
|
||||
|
||||
**Available subjects** (use as URL path):
|
||||
- Animals: `cat`, `dog`, `horse`, `bird`, `fish`, `dragon`, `snake`, `rabbit`, `elephant`, `dolphin`, `butterfly`, `owl`, `wolf`, `bear`, `penguin`, `turtle`
|
||||
- Objects: `car`, `ship`, `airplane`, `rocket`, `guitar`, `computer`, `coffee`, `beer`, `cake`, `house`, `castle`, `sword`, `crown`, `key`
|
||||
- Nature: `tree`, `flower`, `sun`, `moon`, `star`, `mountain`, `ocean`, `rainbow`
|
||||
- Characters: `skull`, `robot`, `angel`, `wizard`, `pirate`, `ninja`, `alien`
|
||||
- Holidays: `christmas`, `halloween`, `valentine`
|
||||
|
||||
**Tips:**
|
||||
- Preserve artist signatures/initials — important etiquette
|
||||
- Multiple art pieces per page — pick the best one for the user
|
||||
- Works reliably via curl, no JavaScript needed
|
||||
|
||||
### Source B: GitHub Octocat API (fun easter egg)
|
||||
|
||||
Returns a random GitHub Octocat with a wise quote. No auth needed.
|
||||
|
||||
```bash
|
||||
curl -s https://api.github.com/octocat
|
||||
```
|
||||
|
||||
## Tool 8: Fun ASCII Utilities (via curl)
|
||||
|
||||
These free services return ASCII art directly — great for fun extras.
|
||||
|
||||
### QR Codes as ASCII Art
|
||||
|
||||
```bash
|
||||
curl -s "qrenco.de/Hello+World"
|
||||
curl -s "qrenco.de/https://example.com"
|
||||
```
|
||||
|
||||
### Weather as ASCII Art
|
||||
|
||||
```bash
|
||||
curl -s "wttr.in/London" # Full weather report with ASCII graphics
|
||||
curl -s "wttr.in/Moon" # Moon phase in ASCII art
|
||||
curl -s "v2.wttr.in/London" # Detailed version
|
||||
```
|
||||
|
||||
## Tool 9: LLM-Generated Custom Art (Fallback)
|
||||
|
||||
When tools above don't have what's needed, generate ASCII art directly using these Unicode characters:
|
||||
|
||||
### Character Palette
|
||||
|
||||
**Box Drawing:** `╔ ╗ ╚ ╝ ║ ═ ╠ ╣ ╦ ╩ ╬ ┌ ┐ └ ┘ │ ─ ├ ┤ ┬ ┴ ┼ ╭ ╮ ╰ ╯`
|
||||
|
||||
**Block Elements:** `░ ▒ ▓ █ ▄ ▀ ▌ ▐ ▖ ▗ ▘ ▝ ▚ ▞`
|
||||
|
||||
**Geometric & Symbols:** `◆ ◇ ◈ ● ○ ◉ ■ □ ▲ △ ▼ ▽ ★ ☆ ✦ ✧ ◀ ▶ ◁ ▷ ⬡ ⬢ ⌂`
|
||||
|
||||
### Rules
|
||||
|
||||
- Max width: 60 characters per line (terminal-safe)
|
||||
- Max height: 15 lines for banners, 25 for scenes
|
||||
- Monospace only: output must render correctly in fixed-width fonts
|
||||
|
||||
## Decision Flow
|
||||
|
||||
1. **Text as a banner** → pyfiglet if installed, otherwise asciified API via curl
|
||||
2. **Wrap a message in fun character art** → cowsay
|
||||
3. **Add decorative border/frame** → boxes (can combine with pyfiglet/asciified)
|
||||
4. **Art of a specific thing** (cat, rocket, dragon) → ascii.co.uk via curl + parsing
|
||||
5. **Convert an image to ASCII** → ascii-image-converter or jp2a
|
||||
6. **QR code** → qrenco.de via curl
|
||||
7. **Weather/moon art** → wttr.in via curl
|
||||
8. **Something custom/creative** → LLM generation with Unicode palette
|
||||
9. **Any tool not installed** → install it, or fall back to next option
|
||||
290
skills/creative/ascii-video/README.md
Normal file
290
skills/creative/ascii-video/README.md
Normal file
@@ -0,0 +1,290 @@
|
||||
# ☤ ASCII Video
|
||||
|
||||
Renders any content as colored ASCII character video. Audio, video, images, text, or pure math in, MP4/GIF/PNG sequence out. Full RGB color per character cell, 1080p 24fps default. No GPU.
|
||||
|
||||
Built for [Hermes Agent](https://github.com/NousResearch/hermes-agent). Usable in any coding agent. Canonical source lives here; synced to [`NousResearch/hermes-agent/skills/creative/ascii-video`](https://github.com/NousResearch/hermes-agent/tree/main/skills/creative/ascii-video) via PR.
|
||||
|
||||
## What this is
|
||||
|
||||
A skill that teaches an agent how to build single-file Python renderers for ASCII video from scratch. The agent gets the full pipeline: grid system, font rasterization, effect library, shader chain, audio analysis, parallel encoding. It writes the renderer, runs it, gets video.
|
||||
|
||||
The output is actual video. Not terminal escape codes. Frames are computed as grids of colored characters, composited onto pixel canvases with pre-rasterized font bitmaps, post-processed through shaders, piped to ffmpeg.
|
||||
|
||||
## Modes
|
||||
|
||||
| Mode | Input | Output |
|
||||
|------|-------|--------|
|
||||
| Video-to-ASCII | A video file | ASCII recreation of the footage |
|
||||
| Audio-reactive | An audio file | Visuals driven by frequency bands, beats, energy |
|
||||
| Generative | Nothing | Procedural animation from math |
|
||||
| Hybrid | Video + audio | ASCII video with audio-reactive overlays |
|
||||
| Lyrics/text | Audio + timed text (SRT) | Karaoke-style text with effects |
|
||||
| TTS narration | Text quotes + API key | Narrated video with typewriter text and generated speech |
|
||||
|
||||
## Pipeline
|
||||
|
||||
Every mode follows the same 6-stage path:
|
||||
|
||||
```
|
||||
INPUT --> ANALYZE --> SCENE_FN --> TONEMAP --> SHADE --> ENCODE
|
||||
```
|
||||
|
||||
1. **Input** loads source material (or nothing for generative).
|
||||
2. **Analyze** extracts per-frame features. Audio gets 6-band FFT, RMS, spectral centroid, flatness, flux, beat detection with exponential decay. Video gets luminance, edges, motion.
|
||||
3. **Scene function** returns a pixel canvas directly. Composes multiple character grids at different densities, value/hue fields, pixel blend modes. This is where the visuals happen.
|
||||
4. **Tonemap** does adaptive percentile-based brightness normalization with per-scene gamma. ASCII on black is inherently dark. Linear multipliers don't work. This does.
|
||||
5. **Shade** runs a `ShaderChain` (38 composable shaders) plus a `FeedbackBuffer` for temporal recursion with spatial transforms.
|
||||
6. **Encode** pipes raw RGB frames to ffmpeg for H.264 encoding. Segments concatenated, audio muxed.
|
||||
|
||||
## Grid system
|
||||
|
||||
Characters render on fixed-size grids. Layer multiple densities for depth.
|
||||
|
||||
| Size | Font | Grid at 1080p | Use |
|
||||
|------|------|---------------|-----|
|
||||
| xs | 8px | 400x108 | Ultra-dense data fields |
|
||||
| sm | 10px | 320x83 | Rain, starfields |
|
||||
| md | 16px | 192x56 | Default balanced |
|
||||
| lg | 20px | 160x45 | Readable text |
|
||||
| xl | 24px | 137x37 | Large titles |
|
||||
| xxl | 40px | 80x22 | Giant minimal |
|
||||
|
||||
Rendering the same scene on `sm` and `lg` then screen-blending them creates natural texture interference. Fine detail shows through gaps in coarse characters. Most scenes use two or three grids.
|
||||
|
||||
## Character palettes (24)
|
||||
|
||||
Each sorted dark-to-bright, each a different visual texture. Validated against the font at init so broken glyphs get dropped silently.
|
||||
|
||||
| Family | Examples | Feel |
|
||||
|--------|----------|------|
|
||||
| Density ramps | ` .:-=+#@█` | Classic ASCII art gradient |
|
||||
| Block elements | ` ░▒▓█▄▀▐▌` | Chunky, digital |
|
||||
| Braille | ` ⠁⠂⠃...⠿` | Fine-grained pointillism |
|
||||
| Dots | ` ⋅∘∙●◉◎` | Smooth, organic |
|
||||
| Stars | ` ·✧✦✩✨★✶` | Sparkle, celestial |
|
||||
| Half-fills | ` ◔◑◕◐◒◓◖◗◙` | Directional fill progression |
|
||||
| Crosshatch | ` ▣▤▥▦▧▨▩` | Hatched density ramp |
|
||||
| Math | ` ·∘∙•°±×÷≈≠≡∞∫∑Ω` | Scientific, abstract |
|
||||
| Box drawing | ` ─│┌┐└┘├┤┬┴┼` | Structural, circuit-like |
|
||||
| Katakana | ` ·ヲァィゥェォャュ...` | Matrix rain |
|
||||
| Greek | ` αβγδεζηθ...ω` | Classical, academic |
|
||||
| Runes | ` ᚠᚢᚦᚱᚷᛁᛇᛒᛖᛚᛞᛟ` | Mystical, ancient |
|
||||
| Alchemical | ` ☉☽♀♂♃♄♅♆♇` | Esoteric |
|
||||
| Arrows | ` ←↑→↓↔↕↖↗↘↙` | Directional, kinetic |
|
||||
| Music | ` ♪♫♬♩♭♮♯○●` | Musical |
|
||||
| Project-specific | ` .·~=≈∞⚡☿✦★⊕◊◆▲▼●■` | Themed per project |
|
||||
|
||||
Custom palettes are built per project to match the content.
|
||||
|
||||
## Color strategies
|
||||
|
||||
| Strategy | How it maps hue | Good for |
|
||||
|----------|----------------|----------|
|
||||
| Angle-mapped | Position angle from center | Rainbow radial effects |
|
||||
| Distance-mapped | Distance from center | Depth, tunnels |
|
||||
| Frequency-mapped | Audio spectral centroid | Timbral shifting |
|
||||
| Value-mapped | Brightness level | Heat maps, fire |
|
||||
| Time-cycled | Slow rotation over time | Ambient, chill |
|
||||
| Source-sampled | Original video pixel colors | Video-to-ASCII |
|
||||
| Palette-indexed | Discrete lookup table | Retro, flat graphic |
|
||||
| Temperature | Warm-to-cool blend | Emotional tone |
|
||||
| Complementary | Hue + opposite | Bold, dramatic |
|
||||
| Triadic | Three equidistant hues | Psychedelic, vibrant |
|
||||
| Analogous | Neighboring hues | Harmonious, subtle |
|
||||
| Monochrome | Fixed hue, vary S/V | Noir, focused |
|
||||
|
||||
Plus 10 discrete RGB palettes (neon, pastel, cyberpunk, vaporwave, earth, ice, blood, forest, mono-green, mono-amber).
|
||||
|
||||
Full OKLAB/OKLCH color system: sRGB↔linear↔OKLAB conversion pipeline, perceptually uniform gradient interpolation, and color harmony generation (complementary, triadic, analogous, split-complementary, tetradic).
|
||||
|
||||
## Value field generators (21)
|
||||
|
||||
Value fields are the core visual building blocks. Each produces a 2D float array in [0, 1] mapping every grid cell to a brightness value.
|
||||
|
||||
### Trigonometric (12)
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| Sine field | Layered multi-sine interference, general-purpose background |
|
||||
| Smooth noise | Multi-octave sine approximation of Perlin noise |
|
||||
| Rings | Concentric rings, bass-driven count and wobble |
|
||||
| Spiral | Logarithmic spiral arms, configurable arm count/tightness |
|
||||
| Tunnel | Infinite depth perspective (inverse distance) |
|
||||
| Vortex | Twisting radial pattern, distance modulates angle |
|
||||
| Interference | N overlapping sine waves creating moire |
|
||||
| Aurora | Horizontal flowing bands |
|
||||
| Ripple | Concentric waves from configurable source points |
|
||||
| Plasma | Sum of sines at multiple orientations/speeds |
|
||||
| Diamond | Diamond/checkerboard pattern |
|
||||
| Noise/static | Random per-cell per-frame flicker |
|
||||
|
||||
### Noise-based (4)
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| Value noise | Smooth organic noise, no axis-alignment artifacts |
|
||||
| fBM | Fractal Brownian Motion — octaved noise for clouds, terrain, smoke |
|
||||
| Domain warp | Inigo Quilez technique — fBM-driven coordinate distortion for flowing organic forms |
|
||||
| Voronoi | Moving seed points with distance, edge, and cell-ID output modes |
|
||||
|
||||
### Simulation-based (4)
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| Reaction-diffusion | Gray-Scott with 7 presets: coral, spots, worms, labyrinths, mitosis, pulsating, chaos |
|
||||
| Cellular automata | Game of Life + 4 rule variants with analog fade trails |
|
||||
| Strange attractors | Clifford, De Jong, Bedhead — iterated point systems binned to density fields |
|
||||
| Temporal noise | 3D noise that morphs in-place without directional drift |
|
||||
|
||||
### SDF-based
|
||||
|
||||
7 signed distance field primitives (circle, box, ring, line, triangle, star, heart) with smooth boolean combinators (union, intersection, subtraction, smooth union/subtraction) and infinite tiling. Render as solid fills or glowing outlines.
|
||||
|
||||
## Hue field generators (9)
|
||||
|
||||
Determine per-cell color independent of brightness: fixed hue, angle-mapped rainbow, distance gradient, time-cycled rotation, audio spectral centroid, horizontal/vertical gradients, plasma variation, perceptually uniform OKLCH rainbow.
|
||||
|
||||
## Coordinate transforms (11)
|
||||
|
||||
UV-space transforms applied before effect evaluation: rotate, scale, skew, tile (with mirror seaming), polar, inverse-polar, twist (rotation increasing with distance), fisheye, wave displacement, Möbius conformal transformation. `make_tgrid()` wraps transformed coordinates into a grid object.
|
||||
|
||||
## Particle systems (9)
|
||||
|
||||
| Type | Behavior |
|
||||
|------|----------|
|
||||
| Explosion | Beat-triggered radial burst with gravity and life decay |
|
||||
| Embers | Rising from bottom with horizontal drift |
|
||||
| Dissolving cloud | Spreading outward with accelerating fade |
|
||||
| Starfield | 3D projected, Z-depth stars approaching with streak trails |
|
||||
| Orbit | Circular/elliptical paths around center |
|
||||
| Gravity well | Attracted toward configurable point sources |
|
||||
| Boid flocking | Separation/alignment/cohesion with spatial hash for O(n) neighbors |
|
||||
| Flow-field | Steered by gradient of any value field |
|
||||
| Trail particles | Fading lines between current and previous positions |
|
||||
|
||||
14 themed particle character sets (energy, spark, leaf, snow, rain, bubble, data, hex, binary, rune, zodiac, dot, dash).
|
||||
|
||||
## Temporal coherence
|
||||
|
||||
10 easing functions (linear, quad, cubic, expo, elastic, bounce — in/out/in-out). Keyframe interpolation with eased transitions. Value field morphing (smooth crossfade between fields). Value field sequencing (cycle through fields with crossfade). Temporal noise (3D noise evolving smoothly in-place).
|
||||
|
||||
## Shader pipeline
|
||||
|
||||
38 composable shaders, applied to the pixel canvas after character rendering. Configurable per section.
|
||||
|
||||
| Category | Shaders |
|
||||
|----------|---------|
|
||||
| Geometry | CRT barrel, pixelate, wave distort, displacement map, kaleidoscope, mirror (h/v/quad/diag) |
|
||||
| Channel | Chromatic aberration (beat-reactive), channel shift, channel swap, RGB split radial |
|
||||
| Color | Invert, posterize, threshold, solarize, hue rotate, saturation, color grade, color wobble, color ramp |
|
||||
| Glow/Blur | Bloom, edge glow, soft focus, radial blur |
|
||||
| Noise | Film grain (beat-reactive), static noise |
|
||||
| Lines/Patterns | Scanlines, halftone |
|
||||
| Tone | Vignette, contrast, gamma, levels, brightness |
|
||||
| Glitch/Data | Glitch bands (beat-reactive), block glitch, pixel sort, data bend |
|
||||
|
||||
12 color tint presets: warm, cool, matrix green, amber, sepia, neon pink, ice, blood, forest, void, sunset, neutral.
|
||||
|
||||
7 mood presets for common shader combos:
|
||||
|
||||
| Mood | Shaders |
|
||||
|------|---------|
|
||||
| Retro terminal | CRT + scanlines + grain + amber/green tint |
|
||||
| Clean modern | Light bloom + subtle vignette |
|
||||
| Glitch art | Heavy chromatic + glitch bands + color wobble |
|
||||
| Cinematic | Bloom + vignette + grain + color grade |
|
||||
| Dreamy | Heavy bloom + soft focus + color wobble |
|
||||
| Harsh/industrial | High contrast + grain + scanlines, no bloom |
|
||||
| Psychedelic | Color wobble + chromatic + kaleidoscope mirror |
|
||||
|
||||
## Blend modes and composition
|
||||
|
||||
20 pixel blend modes for layering canvases: normal, add, subtract, multiply, screen, overlay, softlight, hardlight, difference, exclusion, colordodge, colorburn, linearlight, vividlight, pin_light, hard_mix, lighten, darken, grain_extract, grain_merge. Both sRGB and linear-light blending supported.
|
||||
|
||||
**Feedback buffer.** Temporal recursion — each frame blends with a transformed version of the previous frame. 7 spatial transforms: zoom, shrink, rotate CW/CCW, shift up/down, mirror. Optional per-frame hue shift for rainbow trails. Configurable decay, blend mode, and opacity per scene.
|
||||
|
||||
**Masking.** 16 mask types for spatial compositing: shape masks (circle, rect, ring, gradients), procedural masks (any value field as a mask, text stencils), animated masks (iris open/close, wipe, dissolve), boolean operations (union, intersection, subtraction, invert).
|
||||
|
||||
**Transitions.** Crossfade, directional wipe, radial wipe, dissolve, glitch cut.
|
||||
|
||||
## Scene design patterns
|
||||
|
||||
Compositional patterns for making scenes that look intentional rather than random.
|
||||
|
||||
**Layer hierarchy.** Background (dim atmosphere, dense grid), content (main visual, standard grid), accent (sparse highlights, coarse grid). Three distinct roles, not three competing layers.
|
||||
|
||||
**Directional parameter arcs.** The defining parameter of each scene ramps, accelerates, or builds over its duration. Progress-based formulas (linear, ease-out, step reveal) replace aimless `sin(t)` oscillation.
|
||||
|
||||
**Scene concepts.** Scenes built around visual metaphors (emergence, descent, collision, entropy) with motivated layer/palette/feedback choices. Not named after their effects.
|
||||
|
||||
**Compositional techniques.** Counter-rotating dual systems, wave collision, progressive fragmentation (voronoi cells multiplying over time), entropy (geometry consumed by reaction-diffusion), staggered layer entry (crescendo buildup).
|
||||
|
||||
## Hardware adaptation
|
||||
|
||||
Auto-detects CPU count, RAM, platform, ffmpeg. Adapts worker count, resolution, FPS.
|
||||
|
||||
| Profile | Resolution | FPS | When |
|
||||
|---------|-----------|-----|------|
|
||||
| `draft` | 960x540 | 12 | Check timing/layout |
|
||||
| `preview` | 1280x720 | 15 | Review effects |
|
||||
| `production` | 1920x1080 | 24 | Final output |
|
||||
| `max` | 3840x2160 | 30 | Ultra-high |
|
||||
| `auto` | Detected | 24 | Adapts to hardware + duration |
|
||||
|
||||
`auto` estimates render time and downgrades if it would take over an hour. Low-memory systems drop to 720p automatically.
|
||||
|
||||
### Render times (1080p 24fps, ~180ms/frame/worker)
|
||||
|
||||
| Duration | 4 workers | 8 workers | 16 workers |
|
||||
|----------|-----------|-----------|------------|
|
||||
| 30s | ~3 min | ~2 min | ~1 min |
|
||||
| 2 min | ~13 min | ~7 min | ~4 min |
|
||||
| 5 min | ~33 min | ~17 min | ~9 min |
|
||||
| 10 min | ~65 min | ~33 min | ~17 min |
|
||||
|
||||
720p roughly halves these. 4K roughly quadruples them.
|
||||
|
||||
## Known pitfalls
|
||||
|
||||
**Brightness.** ASCII characters are small bright dots on black. Most frame pixels are background. Linear `* N` multipliers clip highlights and wash out. Use `tonemap()` with per-scene gamma instead. Default gamma 0.75, solarize scenes 0.55, posterize 0.50.
|
||||
|
||||
**Render bottleneck.** The per-cell Python loop compositing font bitmaps runs at ~100-150ms/frame. Unavoidable without Cython/C. Everything else must be vectorized numpy. Python for-loops over rows/cols in effect functions will tank performance.
|
||||
|
||||
**ffmpeg deadlock.** Never `stderr=subprocess.PIPE` on long-running encodes. Buffer fills at ~64KB, process hangs. Redirect stderr to a file.
|
||||
|
||||
**Font cell height.** Pillow's `textbbox()` returns wrong height on macOS. Use `font.getmetrics()` for `ascent + descent`.
|
||||
|
||||
**Font compatibility.** Not all Unicode renders in all fonts. Palettes validated at init, blank glyphs silently removed.
|
||||
|
||||
## Requirements
|
||||
|
||||
◆ Python 3.10+
|
||||
◆ NumPy, Pillow, SciPy (audio modes)
|
||||
◆ ffmpeg on PATH
|
||||
◆ A monospace font (Menlo, Courier, Monaco, auto-detected)
|
||||
◆ Optional: OpenCV, ElevenLabs API key (TTS mode)
|
||||
|
||||
## File structure
|
||||
|
||||
```
|
||||
├── SKILL.md # Modes, workflow, creative direction
|
||||
├── README.md # This file
|
||||
└── references/
|
||||
├── architecture.md # Grid system, fonts, palettes, color, _render_vf()
|
||||
├── effects.md # Value fields, hue fields, backgrounds, particles
|
||||
├── shaders.md # 38 shaders, ShaderChain, tint presets, transitions
|
||||
├── composition.md # Blend modes, multi-grid, tonemap, FeedbackBuffer
|
||||
├── scenes.md # Scene protocol, SCENES table, render_clip(), examples
|
||||
├── design-patterns.md # Layer hierarchy, directional arcs, scene concepts
|
||||
├── inputs.md # Audio analysis, video sampling, text, TTS
|
||||
├── optimization.md # Hardware detection, vectorized patterns, parallelism
|
||||
└── troubleshooting.md # Broadcasting traps, blend pitfalls, diagnostics
|
||||
```
|
||||
|
||||
## Projects built with this
|
||||
|
||||
✦ 85-second highlight reel. 15 scenes (14×5s + 15s crescendo finale), randomized order, directional parameter arcs, layer hierarchy composition. Showcases the full effect vocabulary: fBM, voronoi fragmentation, reaction-diffusion, cellular automata, dual counter-rotating spirals, wave collision, domain warping, tunnel descent, kaleidoscope symmetry, boid flocking, fire simulation, glitch corruption, and a 7-layer crescendo buildup.
|
||||
|
||||
✦ Audio-reactive music visualizer. 3.5 min, 8 sections with distinct effects, beat-triggered particles and glitch, cycling palettes.
|
||||
|
||||
✦ TTS narrated testimonial video. 23 quotes, per-quote ElevenLabs voices, background music at 15% wide stereo, per-clip re-rendering for iterative editing.
|
||||
232
skills/creative/ascii-video/SKILL.md
Normal file
232
skills/creative/ascii-video/SKILL.md
Normal file
@@ -0,0 +1,232 @@
|
||||
---
|
||||
name: ascii-video
|
||||
description: "Production pipeline for ASCII art video — any format. Converts video/audio/images/generative input into colored ASCII character video output (MP4, GIF, image sequence). Covers: video-to-ASCII conversion, audio-reactive music visualizers, generative ASCII art animations, hybrid video+audio reactive, text/lyrics overlays, real-time terminal rendering. Use when users request: ASCII video, text art video, terminal-style video, character art animation, retro text visualization, audio visualizer in ASCII, converting video to ASCII art, matrix-style effects, or any animated ASCII output."
|
||||
---
|
||||
|
||||
# ASCII Video Production Pipeline
|
||||
|
||||
## Creative Standard
|
||||
|
||||
This is visual art. ASCII characters are the medium; cinema is the standard.
|
||||
|
||||
**Before writing a single line of code**, articulate the creative concept. What is the mood? What visual story does this tell? What makes THIS project different from every other ASCII video? The user's prompt is a starting point — interpret it with creative ambition, not literal transcription.
|
||||
|
||||
**First-render excellence is non-negotiable.** The output must be visually striking without requiring revision rounds. If something looks generic, flat, or like "AI-generated ASCII art," it is wrong — rethink the creative concept before shipping.
|
||||
|
||||
**Go beyond the reference vocabulary.** The effect catalogs, shader presets, and palette libraries in the references are a starting vocabulary. For every project, combine, modify, and invent new patterns. The catalog is a palette of paints — you write the painting.
|
||||
|
||||
**Be proactively creative.** Extend the skill's vocabulary when the project calls for it. If the references don't have what the vision demands, build it. Include at least one visual moment the user didn't ask for but will appreciate — a transition, an effect, a color choice that elevates the whole piece.
|
||||
|
||||
**Cohesive aesthetic over technical correctness.** All scenes in a video must feel connected by a unifying visual language — shared color temperature, related character palettes, consistent motion vocabulary. A technically correct video where every scene uses a random different effect is an aesthetic failure.
|
||||
|
||||
**Dense, layered, considered.** Every frame should reward viewing. Never flat black backgrounds. Always multi-grid composition. Always per-scene variation. Always intentional color.
|
||||
|
||||
## Modes
|
||||
|
||||
| Mode | Input | Output | Reference |
|
||||
|------|-------|--------|-----------|
|
||||
| **Video-to-ASCII** | Video file | ASCII recreation of source footage | `references/inputs.md` § Video Sampling |
|
||||
| **Audio-reactive** | Audio file | Generative visuals driven by audio features | `references/inputs.md` § Audio Analysis |
|
||||
| **Generative** | None (or seed params) | Procedural ASCII animation | `references/effects.md` |
|
||||
| **Hybrid** | Video + audio | ASCII video with audio-reactive overlays | Both input refs |
|
||||
| **Lyrics/text** | Audio + text/SRT | Timed text with visual effects | `references/inputs.md` § Text/Lyrics |
|
||||
| **TTS narration** | Text quotes + TTS API | Narrated testimonial/quote video with typed text | `references/inputs.md` § TTS Integration |
|
||||
|
||||
## Stack
|
||||
|
||||
Single self-contained Python script per project. No GPU required.
|
||||
|
||||
| Layer | Tool | Purpose |
|
||||
|-------|------|---------|
|
||||
| Core | Python 3.10+, NumPy | Math, array ops, vectorized effects |
|
||||
| Signal | SciPy | FFT, peak detection (audio modes) |
|
||||
| Imaging | Pillow (PIL) | Font rasterization, frame decoding, image I/O |
|
||||
| Video I/O | ffmpeg (CLI) | Decode input, encode output, mux audio |
|
||||
| Parallel | concurrent.futures | N workers for batch/clip rendering |
|
||||
| TTS | ElevenLabs API (optional) | Generate narration clips |
|
||||
| Optional | OpenCV | Video frame sampling, edge detection |
|
||||
|
||||
## Pipeline Architecture
|
||||
|
||||
Every mode follows the same 6-stage pipeline:
|
||||
|
||||
```
|
||||
INPUT → ANALYZE → SCENE_FN → TONEMAP → SHADE → ENCODE
|
||||
```
|
||||
|
||||
1. **INPUT** — Load/decode source material (video frames, audio samples, images, or nothing)
|
||||
2. **ANALYZE** — Extract per-frame features (audio bands, video luminance/edges, motion vectors)
|
||||
3. **SCENE_FN** — Scene function renders to pixel canvas (`uint8 H,W,3`). Composes multiple character grids via `_render_vf()` + pixel blend modes. See `references/composition.md`
|
||||
4. **TONEMAP** — Percentile-based adaptive brightness normalization. See `references/composition.md` § Adaptive Tonemap
|
||||
5. **SHADE** — Post-processing via `ShaderChain` + `FeedbackBuffer`. See `references/shaders.md`
|
||||
6. **ENCODE** — Pipe raw RGB frames to ffmpeg for H.264/GIF encoding
|
||||
|
||||
## Creative Direction
|
||||
|
||||
### Aesthetic Dimensions
|
||||
|
||||
| Dimension | Options | Reference |
|
||||
|-----------|---------|-----------|
|
||||
| **Character palette** | Density ramps, block elements, symbols, scripts (katakana, Greek, runes, braille), project-specific | `architecture.md` § Palettes |
|
||||
| **Color strategy** | HSV, OKLAB/OKLCH, discrete RGB palettes, auto-generated harmony, monochrome, temperature | `architecture.md` § Color System |
|
||||
| **Background texture** | Sine fields, fBM noise, domain warp, voronoi, reaction-diffusion, cellular automata, video | `effects.md` |
|
||||
| **Primary effects** | Rings, spirals, tunnel, vortex, waves, interference, aurora, fire, SDFs, strange attractors | `effects.md` |
|
||||
| **Particles** | Sparks, snow, rain, bubbles, runes, orbits, flocking boids, flow-field followers, trails | `effects.md` § Particles |
|
||||
| **Shader mood** | Retro CRT, clean modern, glitch art, cinematic, dreamy, industrial, psychedelic | `shaders.md` |
|
||||
| **Grid density** | xs(8px) through xxl(40px), mixed per layer | `architecture.md` § Grid System |
|
||||
| **Coordinate space** | Cartesian, polar, tiled, rotated, fisheye, Möbius, domain-warped | `effects.md` § Transforms |
|
||||
| **Feedback** | Zoom tunnel, rainbow trails, ghostly echo, rotating mandala, color evolution | `composition.md` § Feedback |
|
||||
| **Masking** | Circle, ring, gradient, text stencil, animated iris/wipe/dissolve | `composition.md` § Masking |
|
||||
| **Transitions** | Crossfade, wipe, dissolve, glitch cut, iris, mask-based reveal | `shaders.md` § Transitions |
|
||||
|
||||
### Per-Section Variation
|
||||
|
||||
Never use the same config for the entire video. For each section/scene:
|
||||
- **Different background effect** (or compose 2-3)
|
||||
- **Different character palette** (match the mood)
|
||||
- **Different color strategy** (or at minimum a different hue)
|
||||
- **Vary shader intensity** (more bloom during peaks, more grain during quiet)
|
||||
- **Different particle types** if particles are active
|
||||
|
||||
### Project-Specific Invention
|
||||
|
||||
For every project, invent at least one of:
|
||||
- A custom character palette matching the theme
|
||||
- A custom background effect (combine/modify existing building blocks)
|
||||
- A custom color palette (discrete RGB set matching the brand/mood)
|
||||
- A custom particle character set
|
||||
- A novel scene transition or visual moment
|
||||
|
||||
Don't just pick from the catalog. The catalog is vocabulary — you write the poem.
|
||||
|
||||
## Workflow
|
||||
|
||||
### Step 1: Creative Vision
|
||||
|
||||
Before any code, articulate the creative concept:
|
||||
|
||||
- **Mood/atmosphere**: What should the viewer feel? Energetic, meditative, chaotic, elegant, ominous?
|
||||
- **Visual story**: What happens over the duration? Build tension? Transform? Dissolve?
|
||||
- **Color world**: Warm/cool? Monochrome? Neon? Earth tones? What's the dominant hue?
|
||||
- **Character texture**: Dense data? Sparse stars? Organic dots? Geometric blocks?
|
||||
- **What makes THIS different**: What's the one thing that makes this project unique?
|
||||
- **Emotional arc**: How do scenes progress? Open with energy, build to climax, resolve?
|
||||
|
||||
Map the user's prompt to aesthetic choices. A "chill lo-fi visualizer" demands different everything from a "glitch cyberpunk data stream."
|
||||
|
||||
### Step 2: Technical Design
|
||||
|
||||
- **Mode** — which of the 6 modes above
|
||||
- **Resolution** — landscape 1920x1080 (default), portrait 1080x1920, square 1080x1080 @ 24fps
|
||||
- **Hardware detection** — auto-detect cores/RAM, set quality profile. See `references/optimization.md`
|
||||
- **Sections** — map timestamps to scene functions, each with its own effect/palette/color/shader config
|
||||
- **Output format** — MP4 (default), GIF (640x360 @ 15fps), PNG sequence
|
||||
|
||||
### Step 3: Build the Script
|
||||
|
||||
Single Python file. Components (with references):
|
||||
|
||||
1. **Hardware detection + quality profile** — `references/optimization.md`
|
||||
2. **Input loader** — mode-dependent; `references/inputs.md`
|
||||
3. **Feature analyzer** — audio FFT, video luminance, or synthetic
|
||||
4. **Grid + renderer** — multi-density grids with bitmap cache; `references/architecture.md`
|
||||
5. **Character palettes** — multiple per project; `references/architecture.md` § Palettes
|
||||
6. **Color system** — HSV + discrete RGB + harmony generation; `references/architecture.md` § Color
|
||||
7. **Scene functions** — each returns `canvas (uint8 H,W,3)`; `references/scenes.md`
|
||||
8. **Tonemap** — adaptive brightness normalization; `references/composition.md`
|
||||
9. **Shader pipeline** — `ShaderChain` + `FeedbackBuffer`; `references/shaders.md`
|
||||
10. **Scene table + dispatcher** — time → scene function + config; `references/scenes.md`
|
||||
11. **Parallel encoder** — N-worker clip rendering with ffmpeg pipes
|
||||
12. **Main** — orchestrate full pipeline
|
||||
|
||||
### Step 4: Quality Verification
|
||||
|
||||
- **Test frames first**: render single frames at key timestamps before full render
|
||||
- **Brightness check**: `canvas.mean() > 8` for all ASCII content. If dark, lower gamma
|
||||
- **Visual coherence**: do all scenes feel like they belong to the same video?
|
||||
- **Creative vision check**: does the output match the concept from Step 1? If it looks generic, go back
|
||||
|
||||
## Critical Implementation Notes
|
||||
|
||||
### Brightness — Use `tonemap()`, Not Linear Multipliers
|
||||
|
||||
This is the #1 visual issue. ASCII on black is inherently dark. **Never use `canvas * N` multipliers** — they clip highlights. Use adaptive tonemap:
|
||||
|
||||
```python
|
||||
def tonemap(canvas, gamma=0.75):
|
||||
f = canvas.astype(np.float32)
|
||||
lo, hi = np.percentile(f[::4, ::4], [1, 99.5])
|
||||
if hi - lo < 10: hi = lo + 10
|
||||
f = np.clip((f - lo) / (hi - lo), 0, 1) ** gamma
|
||||
return (f * 255).astype(np.uint8)
|
||||
```
|
||||
|
||||
Pipeline: `scene_fn() → tonemap() → FeedbackBuffer → ShaderChain → ffmpeg`
|
||||
|
||||
Per-scene gamma: default 0.75, solarize 0.55, posterize 0.50, bright scenes 0.85. Use `screen` blend (not `overlay`) for dark layers.
|
||||
|
||||
### Font Cell Height
|
||||
|
||||
macOS Pillow: `textbbox()` returns wrong height. Use `font.getmetrics()`: `cell_height = ascent + descent`. See `references/troubleshooting.md`.
|
||||
|
||||
### ffmpeg Pipe Deadlock
|
||||
|
||||
Never `stderr=subprocess.PIPE` with long-running ffmpeg — buffer fills at 64KB and deadlocks. Redirect to file. See `references/troubleshooting.md`.
|
||||
|
||||
### Font Compatibility
|
||||
|
||||
Not all Unicode chars render in all fonts. Validate palettes at init — render each char, check for blank output. See `references/troubleshooting.md`.
|
||||
|
||||
### Per-Clip Architecture
|
||||
|
||||
For segmented videos (quotes, scenes, chapters), render each as a separate clip file for parallel rendering and selective re-rendering. See `references/scenes.md`.
|
||||
|
||||
## Performance Targets
|
||||
|
||||
| Component | Budget |
|
||||
|-----------|--------|
|
||||
| Feature extraction | 1-5ms |
|
||||
| Effect function | 2-15ms |
|
||||
| Character render | 80-150ms (bottleneck) |
|
||||
| Shader pipeline | 5-25ms |
|
||||
| **Total** | ~100-200ms/frame |
|
||||
|
||||
## References
|
||||
|
||||
| File | Contents |
|
||||
|------|----------|
|
||||
| `references/architecture.md` | Grid system, resolution presets, font selection, character palettes (20+), color system (HSV + OKLAB + discrete RGB + harmony generation), `_render_vf()` helper, GridLayer class |
|
||||
| `references/composition.md` | Pixel blend modes (20 modes), `blend_canvas()`, multi-grid composition, adaptive `tonemap()`, `FeedbackBuffer`, `PixelBlendStack`, masking/stencil system |
|
||||
| `references/effects.md` | Effect building blocks: value field generators, hue fields, noise/fBM/domain warp, voronoi, reaction-diffusion, cellular automata, SDFs, strange attractors, particle systems, coordinate transforms, temporal coherence |
|
||||
| `references/shaders.md` | `ShaderChain`, `_apply_shader_step()` dispatch, 38 shader catalog, audio-reactive scaling, transitions, tint presets, output format encoding, terminal rendering |
|
||||
| `references/scenes.md` | Scene protocol, `Renderer` class, `SCENES` table, `render_clip()`, beat-synced cutting, parallel rendering, design patterns (layer hierarchy, directional arcs, visual metaphors, compositional techniques), complete scene examples at every complexity level, scene design checklist |
|
||||
| `references/inputs.md` | Audio analysis (FFT, bands, beats), video sampling, image conversion, text/lyrics, TTS integration (ElevenLabs, voice assignment, audio mixing) |
|
||||
| `references/optimization.md` | Hardware detection, quality profiles, vectorized patterns, parallel rendering, memory management, performance budgets |
|
||||
| `references/troubleshooting.md` | NumPy broadcasting traps, blend mode pitfalls, multiprocessing/pickling, brightness diagnostics, ffmpeg issues, font problems, common mistakes |
|
||||
|
||||
---
|
||||
|
||||
## Creative Divergence (use only when user requests experimental/creative/unique output)
|
||||
|
||||
If the user asks for creative, experimental, surprising, or unconventional output, select the strategy that best fits and reason through its steps BEFORE generating code.
|
||||
|
||||
- **Forced Connections** — when the user wants cross-domain inspiration ("make it look organic," "industrial aesthetic")
|
||||
- **Conceptual Blending** — when the user names two things to combine ("ocean meets music," "space + calligraphy")
|
||||
- **Oblique Strategies** — when the user is maximally open ("surprise me," "something I've never seen")
|
||||
|
||||
### Forced Connections
|
||||
1. Pick a domain unrelated to the visual goal (weather systems, microbiology, architecture, fluid dynamics, textile weaving)
|
||||
2. List its core visual/structural elements (erosion → gradual reveal; mitosis → splitting duplication; weaving → interlocking patterns)
|
||||
3. Map those elements onto ASCII characters and animation patterns
|
||||
4. Synthesize — what does "erosion" or "crystallization" look like in a character grid?
|
||||
|
||||
### Conceptual Blending
|
||||
1. Name two distinct visual/conceptual spaces (e.g., ocean waves + sheet music)
|
||||
2. Map correspondences (crests = high notes, troughs = rests, foam = staccato)
|
||||
3. Blend selectively — keep the most interesting mappings, discard forced ones
|
||||
4. Develop emergent properties that exist only in the blend
|
||||
|
||||
### Oblique Strategies
|
||||
1. Draw one: "Honor thy error as a hidden intention" / "Use an old idea" / "What would your closest friend do?" / "Emphasize the flaws" / "Turn it upside down" / "Only a part, not the whole" / "Reverse"
|
||||
2. Interpret the directive against the current ASCII animation challenge
|
||||
3. Apply the lateral insight to the visual design before writing code
|
||||
802
skills/creative/ascii-video/references/architecture.md
Normal file
802
skills/creative/ascii-video/references/architecture.md
Normal file
@@ -0,0 +1,802 @@
|
||||
# Architecture Reference
|
||||
|
||||
> **See also:** composition.md · effects.md · scenes.md · shaders.md · inputs.md · optimization.md · troubleshooting.md
|
||||
|
||||
## Grid System
|
||||
|
||||
### Resolution Presets
|
||||
|
||||
```python
|
||||
RESOLUTION_PRESETS = {
|
||||
"landscape": (1920, 1080), # 16:9 — YouTube, default
|
||||
"portrait": (1080, 1920), # 9:16 — TikTok, Reels, Stories
|
||||
"square": (1080, 1080), # 1:1 — Instagram feed
|
||||
"ultrawide": (2560, 1080), # 21:9 — cinematic
|
||||
"landscape4k":(3840, 2160), # 16:9 — 4K
|
||||
"portrait4k": (2160, 3840), # 9:16 — 4K portrait
|
||||
}
|
||||
|
||||
def get_resolution(preset="landscape", custom=None):
|
||||
"""Returns (VW, VH) tuple."""
|
||||
if custom:
|
||||
return custom
|
||||
return RESOLUTION_PRESETS.get(preset, RESOLUTION_PRESETS["landscape"])
|
||||
```
|
||||
|
||||
### Multi-Density Grids
|
||||
|
||||
Pre-initialize multiple grid sizes. Switch per section for visual variety. Grid dimensions auto-compute from resolution:
|
||||
|
||||
**Landscape (1920x1080):**
|
||||
|
||||
| Key | Font Size | Grid (cols x rows) | Use |
|
||||
|-----|-----------|-------------------|-----|
|
||||
| xs | 8 | 400x108 | Ultra-dense data fields |
|
||||
| sm | 10 | 320x83 | Dense detail, rain, starfields |
|
||||
| md | 16 | 192x56 | Default balanced, transitions |
|
||||
| lg | 20 | 160x45 | Quote/lyric text (readable at 1080p) |
|
||||
| xl | 24 | 137x37 | Short quotes, large titles |
|
||||
| xxl | 40 | 80x22 | Giant text, minimal |
|
||||
|
||||
**Portrait (1080x1920):**
|
||||
|
||||
| Key | Font Size | Grid (cols x rows) | Use |
|
||||
|-----|-----------|-------------------|-----|
|
||||
| xs | 8 | 225x192 | Ultra-dense, tall data columns |
|
||||
| sm | 10 | 180x148 | Dense detail, vertical rain |
|
||||
| md | 16 | 112x100 | Default balanced |
|
||||
| lg | 20 | 90x80 | Readable text (~30 chars/line centered) |
|
||||
| xl | 24 | 75x66 | Short quotes, stacked |
|
||||
| xxl | 40 | 45x39 | Giant text, minimal |
|
||||
|
||||
**Square (1080x1080):**
|
||||
|
||||
| Key | Font Size | Grid (cols x rows) | Use |
|
||||
|-----|-----------|-------------------|-----|
|
||||
| sm | 10 | 180x83 | Dense detail |
|
||||
| md | 16 | 112x56 | Default balanced |
|
||||
| lg | 20 | 90x45 | Readable text |
|
||||
|
||||
**Key differences in portrait mode:**
|
||||
- Fewer columns (90 at `lg` vs 160) — lines must be shorter or wrap
|
||||
- Many more rows (80 at `lg` vs 45) — vertical stacking is natural
|
||||
- Aspect ratio correction flips: `asp = cw / ch` still works but the visual emphasis is vertical
|
||||
- Radial effects appear as tall ellipses unless corrected
|
||||
- Vertical effects (rain, embers, fire columns) are naturally enhanced
|
||||
- Horizontal effects (spectrum bars, waveforms) need rotation or compression
|
||||
|
||||
**Grid sizing for text in portrait**: Use `lg` (20px) for 2-3 word lines. Max comfortable line length is ~25-30 chars. For longer quotes, break aggressively into many short lines stacked vertically — portrait has vertical space to spare. `xl` (24px) works for single words or very short phrases.
|
||||
|
||||
Grid dimensions: `cols = VW // cell_width`, `rows = VH // cell_height`.
|
||||
|
||||
### Font Selection
|
||||
|
||||
Don't hardcode a single font. Choose fonts to match the project's mood. Monospace fonts are required for grid alignment but vary widely in personality:
|
||||
|
||||
| Font | Personality | Platform |
|
||||
|------|-------------|----------|
|
||||
| Menlo | Clean, neutral, Apple-native | macOS |
|
||||
| Monaco | Retro terminal, compact | macOS |
|
||||
| Courier New | Classic typewriter, wide | Cross-platform |
|
||||
| SF Mono | Modern, tight spacing | macOS |
|
||||
| Consolas | Windows native, clean | Windows |
|
||||
| JetBrains Mono | Developer, ligature-ready | Install |
|
||||
| Fira Code | Geometric, modern | Install |
|
||||
| IBM Plex Mono | Corporate, authoritative | Install |
|
||||
| Source Code Pro | Adobe, balanced | Install |
|
||||
|
||||
**Font detection at init**: probe available fonts and fall back gracefully:
|
||||
|
||||
```python
|
||||
import platform
|
||||
|
||||
def find_font(preferences):
|
||||
"""Try fonts in order, return first that exists."""
|
||||
for name, path in preferences:
|
||||
if os.path.exists(path):
|
||||
return path
|
||||
raise FileNotFoundError(f"No monospace font found. Tried: {[p for _,p in preferences]}")
|
||||
|
||||
FONT_PREFS_MACOS = [
|
||||
("Menlo", "/System/Library/Fonts/Menlo.ttc"),
|
||||
("Monaco", "/System/Library/Fonts/Monaco.ttf"),
|
||||
("SF Mono", "/System/Library/Fonts/SFNSMono.ttf"),
|
||||
("Courier", "/System/Library/Fonts/Courier.ttc"),
|
||||
]
|
||||
FONT_PREFS_LINUX = [
|
||||
("DejaVu Sans Mono", "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf"),
|
||||
("Liberation Mono", "/usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf"),
|
||||
("Noto Sans Mono", "/usr/share/fonts/truetype/noto/NotoSansMono-Regular.ttf"),
|
||||
("Ubuntu Mono", "/usr/share/fonts/truetype/ubuntu/UbuntuMono-R.ttf"),
|
||||
]
|
||||
FONT_PREFS_WINDOWS = [
|
||||
("Consolas", r"C:\Windows\Fonts\consola.ttf"),
|
||||
("Courier New", r"C:\Windows\Fonts\cour.ttf"),
|
||||
("Lucida Console", r"C:\Windows\Fonts\lucon.ttf"),
|
||||
("Cascadia Code", os.path.expandvars(r"%LOCALAPPDATA%\Microsoft\Windows\Fonts\CascadiaCode.ttf")),
|
||||
("Cascadia Mono", os.path.expandvars(r"%LOCALAPPDATA%\Microsoft\Windows\Fonts\CascadiaMono.ttf")),
|
||||
]
|
||||
|
||||
def _get_font_prefs():
|
||||
s = platform.system()
|
||||
if s == "Darwin":
|
||||
return FONT_PREFS_MACOS
|
||||
elif s == "Windows":
|
||||
return FONT_PREFS_WINDOWS
|
||||
return FONT_PREFS_LINUX
|
||||
|
||||
FONT_PREFS = _get_font_prefs()
|
||||
```
|
||||
|
||||
**Multi-font rendering**: use different fonts for different layers (e.g., monospace for background, a bolder variant for overlay text). Each GridLayer owns its own font:
|
||||
|
||||
```python
|
||||
grid_bg = GridLayer(find_font(FONT_PREFS), 16) # background
|
||||
grid_text = GridLayer(find_font(BOLD_PREFS), 20) # readable text
|
||||
```
|
||||
|
||||
### Collecting All Characters
|
||||
|
||||
Before initializing grids, gather all characters that need bitmap pre-rasterization:
|
||||
|
||||
```python
|
||||
all_chars = set()
|
||||
for pal in [PAL_DEFAULT, PAL_DENSE, PAL_BLOCKS, PAL_RUNE, PAL_KATA,
|
||||
PAL_GREEK, PAL_MATH, PAL_DOTS, PAL_BRAILLE, PAL_STARS,
|
||||
PAL_HALFFILL, PAL_HATCH, PAL_BINARY, PAL_MUSIC, PAL_BOX,
|
||||
PAL_CIRCUIT, PAL_ARROWS, PAL_HERMES]: # ... all palettes used in project
|
||||
all_chars.update(pal)
|
||||
# Add any overlay text characters
|
||||
all_chars.update("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 .,-:;!?/|")
|
||||
all_chars.discard(" ") # space is never rendered
|
||||
```
|
||||
|
||||
### GridLayer Initialization
|
||||
|
||||
Each grid pre-computes coordinate arrays for vectorized effect math. The grid automatically adapts to any resolution (landscape, portrait, square):
|
||||
|
||||
```python
|
||||
class GridLayer:
|
||||
def __init__(self, font_path, font_size, vw=None, vh=None):
|
||||
"""Initialize grid for any resolution.
|
||||
vw, vh: video width/height in pixels. Defaults to global VW, VH."""
|
||||
vw = vw or VW; vh = vh or VH
|
||||
self.vw = vw; self.vh = vh
|
||||
|
||||
self.font = ImageFont.truetype(font_path, font_size)
|
||||
asc, desc = self.font.getmetrics()
|
||||
bbox = self.font.getbbox("M")
|
||||
self.cw = bbox[2] - bbox[0] # character cell width
|
||||
self.ch = asc + desc # CRITICAL: not textbbox height
|
||||
|
||||
self.cols = vw // self.cw
|
||||
self.rows = vh // self.ch
|
||||
self.ox = (vw - self.cols * self.cw) // 2 # centering
|
||||
self.oy = (vh - self.rows * self.ch) // 2
|
||||
|
||||
# Aspect ratio metadata
|
||||
self.aspect = vw / vh # >1 = landscape, <1 = portrait, 1 = square
|
||||
self.is_portrait = vw < vh
|
||||
self.is_landscape = vw > vh
|
||||
|
||||
# Index arrays
|
||||
self.rr = np.arange(self.rows, dtype=np.float32)[:, None]
|
||||
self.cc = np.arange(self.cols, dtype=np.float32)[None, :]
|
||||
|
||||
# Polar coordinates (aspect-corrected)
|
||||
cx, cy = self.cols / 2.0, self.rows / 2.0
|
||||
asp = self.cw / self.ch
|
||||
self.dx = self.cc - cx
|
||||
self.dy = (self.rr - cy) * asp
|
||||
self.dist = np.sqrt(self.dx**2 + self.dy**2)
|
||||
self.angle = np.arctan2(self.dy, self.dx)
|
||||
|
||||
# Normalized (0-1 range) -- for distance falloff
|
||||
self.dx_n = (self.cc - cx) / max(self.cols, 1)
|
||||
self.dy_n = (self.rr - cy) / max(self.rows, 1) * asp
|
||||
self.dist_n = np.sqrt(self.dx_n**2 + self.dy_n**2)
|
||||
|
||||
# Pre-rasterize all characters to float32 bitmaps
|
||||
self.bm = {}
|
||||
for c in all_chars:
|
||||
img = Image.new("L", (self.cw, self.ch), 0)
|
||||
ImageDraw.Draw(img).text((0, 0), c, fill=255, font=self.font)
|
||||
self.bm[c] = np.array(img, dtype=np.float32) / 255.0
|
||||
```
|
||||
|
||||
### Character Render Loop
|
||||
|
||||
The bottleneck. Composites pre-rasterized bitmaps onto pixel canvas:
|
||||
|
||||
```python
|
||||
def render(self, chars, colors, canvas=None):
|
||||
if canvas is None:
|
||||
canvas = np.zeros((VH, VW, 3), dtype=np.uint8)
|
||||
for row in range(self.rows):
|
||||
y = self.oy + row * self.ch
|
||||
if y + self.ch > VH: break
|
||||
for col in range(self.cols):
|
||||
c = chars[row, col]
|
||||
if c == " ": continue
|
||||
x = self.ox + col * self.cw
|
||||
if x + self.cw > VW: break
|
||||
a = self.bm[c] # float32 bitmap
|
||||
canvas[y:y+self.ch, x:x+self.cw] = np.maximum(
|
||||
canvas[y:y+self.ch, x:x+self.cw],
|
||||
(a[:, :, None] * colors[row, col]).astype(np.uint8))
|
||||
return canvas
|
||||
```
|
||||
|
||||
Use `np.maximum` for additive blending (brighter chars overwrite dimmer ones, never darken).
|
||||
|
||||
### Multi-Layer Rendering
|
||||
|
||||
Render multiple grids onto the same canvas for depth:
|
||||
|
||||
```python
|
||||
canvas = np.zeros((VH, VW, 3), dtype=np.uint8)
|
||||
canvas = grid_lg.render(bg_chars, bg_colors, canvas) # background layer
|
||||
canvas = grid_md.render(main_chars, main_colors, canvas) # main layer
|
||||
canvas = grid_sm.render(detail_chars, detail_colors, canvas) # detail overlay
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Character Palettes
|
||||
|
||||
### Design Principles
|
||||
|
||||
Character palettes are the primary visual texture of ASCII video. They control not just brightness mapping but the entire visual feel. Design palettes intentionally:
|
||||
|
||||
- **Visual weight**: characters sorted by the amount of ink/pixels they fill. Space is always index 0.
|
||||
- **Coherence**: characters within a palette should belong to the same visual family.
|
||||
- **Density curve**: the brightness-to-character mapping is nonlinear. Dense palettes (many chars) give smoother gradients; sparse palettes (5-8 chars) give posterized/graphic looks.
|
||||
- **Rendering compatibility**: every character in the palette must exist in the font. Test at init and remove missing glyphs.
|
||||
|
||||
### Palette Library
|
||||
|
||||
Organized by visual family. Mix and match per project -- don't default to PAL_DEFAULT for everything.
|
||||
|
||||
#### Density / Brightness Palettes
|
||||
```python
|
||||
PAL_DEFAULT = " .`'-:;!><=+*^~?/|(){}[]#&$@%" # classic ASCII art
|
||||
PAL_DENSE = " .:;+=xX$#@\u2588" # simple 11-level ramp
|
||||
PAL_MINIMAL = " .:-=+#@" # 8-level, graphic
|
||||
PAL_BINARY = " \u2588" # 2-level, extreme contrast
|
||||
PAL_GRADIENT = " \u2591\u2592\u2593\u2588" # 4-level block gradient
|
||||
```
|
||||
|
||||
#### Unicode Block Elements
|
||||
```python
|
||||
PAL_BLOCKS = " \u2591\u2592\u2593\u2588\u2584\u2580\u2590\u258c" # standard blocks
|
||||
PAL_BLOCKS_EXT = " \u2596\u2597\u2598\u2599\u259a\u259b\u259c\u259d\u259e\u259f\u2591\u2592\u2593\u2588" # quadrant blocks (more detail)
|
||||
PAL_SHADE = " \u2591\u2592\u2593\u2588\u2587\u2586\u2585\u2584\u2583\u2582\u2581" # vertical fill progression
|
||||
```
|
||||
|
||||
#### Symbolic / Thematic
|
||||
```python
|
||||
PAL_MATH = " \u00b7\u2218\u2219\u2022\u00b0\u00b1\u2213\u00d7\u00f7\u2248\u2260\u2261\u2264\u2265\u221e\u222b\u2211\u220f\u221a\u2207\u2202\u2206\u03a9" # math symbols
|
||||
PAL_BOX = " \u2500\u2502\u250c\u2510\u2514\u2518\u251c\u2524\u252c\u2534\u253c\u2550\u2551\u2554\u2557\u255a\u255d\u2560\u2563\u2566\u2569\u256c" # box drawing
|
||||
PAL_CIRCUIT = " .\u00b7\u2500\u2502\u250c\u2510\u2514\u2518\u253c\u25cb\u25cf\u25a1\u25a0\u2206\u2207\u2261" # circuit board
|
||||
PAL_RUNE = " .\u16a0\u16a2\u16a6\u16b1\u16b7\u16c1\u16c7\u16d2\u16d6\u16da\u16de\u16df" # elder futhark runes
|
||||
PAL_ALCHEMIC = " \u2609\u263d\u2640\u2642\u2643\u2644\u2645\u2646\u2647\u2648\u2649\u264a\u264b" # planetary/alchemical symbols
|
||||
PAL_ZODIAC = " \u2648\u2649\u264a\u264b\u264c\u264d\u264e\u264f\u2650\u2651\u2652\u2653" # zodiac
|
||||
PAL_ARROWS = " \u2190\u2191\u2192\u2193\u2194\u2195\u2196\u2197\u2198\u2199\u21a9\u21aa\u21bb\u27a1" # directional arrows
|
||||
PAL_MUSIC = " \u266a\u266b\u266c\u2669\u266d\u266e\u266f\u25cb\u25cf" # musical notation
|
||||
```
|
||||
|
||||
#### Script / Writing System
|
||||
```python
|
||||
PAL_KATA = " \u00b7\uff66\uff67\uff68\uff69\uff6a\uff6b\uff6c\uff6d\uff6e\uff6f\uff70\uff71\uff72\uff73\uff74\uff75\uff76\uff77" # katakana halfwidth (matrix rain)
|
||||
PAL_GREEK = " \u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03c0\u03c1\u03c3\u03c4\u03c6\u03c8\u03c9" # Greek lowercase
|
||||
PAL_CYRILLIC = " \u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448" # Cyrillic lowercase
|
||||
PAL_ARABIC = " \u0627\u0628\u062a\u062b\u062c\u062d\u062e\u062f\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637" # Arabic letters (isolated forms)
|
||||
```
|
||||
|
||||
#### Dot / Point Progressions
|
||||
```python
|
||||
PAL_DOTS = " ⋅∘∙●◉◎◆✦★" # dot size progression
|
||||
PAL_BRAILLE = " ⠁⠂⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌⠍⠎⠏⠐⠑⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜⠝⠞⠟⠿" # braille patterns
|
||||
PAL_STARS = " ·✧✦✩✨★✶✳✸" # star progression
|
||||
PAL_HALFFILL = " ◔◑◕◐◒◓◖◗◙" # directional half-fill progression
|
||||
PAL_HATCH = " ▣▤▥▦▧▨▩" # crosshatch density ramp
|
||||
```
|
||||
|
||||
#### Project-Specific (examples -- invent new ones per project)
|
||||
```python
|
||||
PAL_HERMES = " .\u00b7~=\u2248\u221e\u26a1\u263f\u2726\u2605\u2295\u25ca\u25c6\u25b2\u25bc\u25cf\u25a0" # mythology/tech blend
|
||||
PAL_OCEAN = " ~\u2248\u2248\u2248\u223c\u2307\u2248\u224b\u224c\u2248" # water/wave characters
|
||||
PAL_ORGANIC = " .\u00b0\u2218\u2022\u25e6\u25c9\u2742\u273f\u2741\u2743" # growing/botanical
|
||||
PAL_MACHINE = " _\u2500\u2502\u250c\u2510\u253c\u2261\u25a0\u2588\u2593\u2592\u2591" # mechanical/industrial
|
||||
```
|
||||
|
||||
### Creating Custom Palettes
|
||||
|
||||
When designing for a project, build palettes from the content's theme:
|
||||
|
||||
1. **Choose a visual family** (dots, blocks, symbols, script)
|
||||
2. **Sort by visual weight** -- render each char at target font size, count lit pixels, sort ascending
|
||||
3. **Test at target grid size** -- some chars collapse to blobs at small sizes
|
||||
4. **Validate in font** -- remove chars the font can't render:
|
||||
|
||||
```python
|
||||
def validate_palette(pal, font):
|
||||
"""Remove characters the font can't render."""
|
||||
valid = []
|
||||
for c in pal:
|
||||
if c == " ":
|
||||
valid.append(c)
|
||||
continue
|
||||
img = Image.new("L", (20, 20), 0)
|
||||
ImageDraw.Draw(img).text((0, 0), c, fill=255, font=font)
|
||||
if np.array(img).max() > 0: # char actually rendered something
|
||||
valid.append(c)
|
||||
return "".join(valid)
|
||||
```
|
||||
|
||||
### Mapping Values to Characters
|
||||
|
||||
```python
|
||||
def val2char(v, mask, pal=PAL_DEFAULT):
|
||||
"""Map float array (0-1) to character array using palette."""
|
||||
n = len(pal)
|
||||
idx = np.clip((v * n).astype(int), 0, n - 1)
|
||||
out = np.full(v.shape, " ", dtype="U1")
|
||||
for i, ch in enumerate(pal):
|
||||
out[mask & (idx == i)] = ch
|
||||
return out
|
||||
```
|
||||
|
||||
**Nonlinear mapping** for different visual curves:
|
||||
|
||||
```python
|
||||
def val2char_gamma(v, mask, pal, gamma=1.0):
|
||||
"""Gamma-corrected palette mapping. gamma<1 = brighter, gamma>1 = darker."""
|
||||
v_adj = np.power(np.clip(v, 0, 1), gamma)
|
||||
return val2char(v_adj, mask, pal)
|
||||
|
||||
def val2char_step(v, mask, pal, thresholds):
|
||||
"""Custom threshold mapping. thresholds = list of float breakpoints."""
|
||||
out = np.full(v.shape, pal[0], dtype="U1")
|
||||
for i, thr in enumerate(thresholds):
|
||||
out[mask & (v > thr)] = pal[min(i + 1, len(pal) - 1)]
|
||||
return out
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Color System
|
||||
|
||||
### HSV->RGB (Vectorized)
|
||||
|
||||
All color computation in HSV for intuitive control, converted at render time:
|
||||
|
||||
```python
|
||||
def hsv2rgb(h, s, v):
|
||||
"""Vectorized HSV->RGB. h,s,v are numpy arrays. Returns (R,G,B) uint8 arrays."""
|
||||
h = h % 1.0
|
||||
c = v * s; x = c * (1 - np.abs((h*6) % 2 - 1)); m = v - c
|
||||
# ... 6 sector assignment ...
|
||||
return (np.clip((r+m)*255, 0, 255).astype(np.uint8),
|
||||
np.clip((g+m)*255, 0, 255).astype(np.uint8),
|
||||
np.clip((b+m)*255, 0, 255).astype(np.uint8))
|
||||
```
|
||||
|
||||
### Color Mapping Strategies
|
||||
|
||||
Don't default to a single strategy. Choose based on the visual intent:
|
||||
|
||||
| Strategy | Hue source | Effect | Good for |
|
||||
|----------|------------|--------|----------|
|
||||
| Angle-mapped | `g.angle / (2*pi)` | Rainbow around center | Radial effects, kaleidoscopes |
|
||||
| Distance-mapped | `g.dist_n * 0.3` | Gradient from center | Tunnels, depth effects |
|
||||
| Frequency-mapped | `f["cent"] * 0.2` | Timbral color shifting | Audio-reactive |
|
||||
| Value-mapped | `val * 0.15` | Brightness-dependent hue | Fire, heat maps |
|
||||
| Time-cycled | `t * rate` | Slow color rotation | Ambient, chill |
|
||||
| Source-sampled | Video frame pixel colors | Preserve original color | Video-to-ASCII |
|
||||
| Palette-indexed | Discrete color lookup | Flat graphic style | Retro, pixel art |
|
||||
| Temperature | Blend between warm/cool | Emotional tone | Mood-driven scenes |
|
||||
| Complementary | `hue` and `hue + 0.5` | High contrast | Bold, dramatic |
|
||||
| Triadic | `hue`, `hue + 0.33`, `hue + 0.66` | Vibrant, balanced | Psychedelic |
|
||||
| Analogous | `hue +/- 0.08` | Harmonious, subtle | Elegant, cohesive |
|
||||
| Monochrome | Fixed hue, vary S and V | Restrained, focused | Noir, minimal |
|
||||
|
||||
### Color Palettes (Discrete RGB)
|
||||
|
||||
For non-HSV workflows -- direct RGB color sets for graphic/retro looks:
|
||||
|
||||
```python
|
||||
# Named color palettes -- use for flat/graphic styles or per-character coloring
|
||||
COLORS_NEON = [(255,0,102), (0,255,153), (102,0,255), (255,255,0), (0,204,255)]
|
||||
COLORS_PASTEL = [(255,179,186), (255,223,186), (255,255,186), (186,255,201), (186,225,255)]
|
||||
COLORS_MONO_GREEN = [(0,40,0), (0,80,0), (0,140,0), (0,200,0), (0,255,0)]
|
||||
COLORS_MONO_AMBER = [(40,20,0), (80,50,0), (140,90,0), (200,140,0), (255,191,0)]
|
||||
COLORS_CYBERPUNK = [(255,0,60), (0,255,200), (180,0,255), (255,200,0)]
|
||||
COLORS_VAPORWAVE = [(255,113,206), (1,205,254), (185,103,255), (5,255,161)]
|
||||
COLORS_EARTH = [(86,58,26), (139,90,43), (189,154,91), (222,193,136), (245,230,193)]
|
||||
COLORS_ICE = [(200,230,255), (150,200,240), (100,170,230), (60,130,210), (30,80,180)]
|
||||
COLORS_BLOOD = [(80,0,0), (140,10,10), (200,20,20), (255,50,30), (255,100,80)]
|
||||
COLORS_FOREST = [(10,30,10), (20,60,15), (30,100,20), (50,150,30), (80,200,50)]
|
||||
|
||||
def rgb_palette_map(val, mask, palette):
|
||||
"""Map float array (0-1) to RGB colors from a discrete palette."""
|
||||
n = len(palette)
|
||||
idx = np.clip((val * n).astype(int), 0, n - 1)
|
||||
R = np.zeros(val.shape, dtype=np.uint8)
|
||||
G = np.zeros(val.shape, dtype=np.uint8)
|
||||
B = np.zeros(val.shape, dtype=np.uint8)
|
||||
for i, (r, g, b) in enumerate(palette):
|
||||
m = mask & (idx == i)
|
||||
R[m] = r; G[m] = g; B[m] = b
|
||||
return R, G, B
|
||||
```
|
||||
|
||||
### OKLAB Color Space (Perceptually Uniform)
|
||||
|
||||
HSV hue is perceptually non-uniform: green occupies far more visual range than blue. OKLAB / OKLCH provide perceptually even color steps — hue increments of 0.1 look equally different regardless of starting hue. Use OKLAB for:
|
||||
- Gradient interpolation (no unwanted intermediate hues)
|
||||
- Color harmony generation (perceptually balanced palettes)
|
||||
- Smooth color transitions over time
|
||||
|
||||
```python
|
||||
# --- sRGB <-> Linear sRGB ---
|
||||
|
||||
def srgb_to_linear(c):
|
||||
"""Convert sRGB [0,1] to linear light. c: float32 array."""
|
||||
return np.where(c <= 0.04045, c / 12.92, ((c + 0.055) / 1.055) ** 2.4)
|
||||
|
||||
def linear_to_srgb(c):
|
||||
"""Convert linear light to sRGB [0,1]."""
|
||||
return np.where(c <= 0.0031308, c * 12.92, 1.055 * np.power(np.maximum(c, 0), 1/2.4) - 0.055)
|
||||
|
||||
# --- Linear sRGB <-> OKLAB ---
|
||||
|
||||
def linear_rgb_to_oklab(r, g, b):
|
||||
"""Linear sRGB to OKLAB. r,g,b: float32 arrays [0,1].
|
||||
Returns (L, a, b) where L=[0,1], a,b=[-0.4, 0.4] approx."""
|
||||
l_ = 0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b
|
||||
m_ = 0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b
|
||||
s_ = 0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b
|
||||
l_c = np.cbrt(l_); m_c = np.cbrt(m_); s_c = np.cbrt(s_)
|
||||
L = 0.2104542553 * l_c + 0.7936177850 * m_c - 0.0040720468 * s_c
|
||||
a = 1.9779984951 * l_c - 2.4285922050 * m_c + 0.4505937099 * s_c
|
||||
b_ = 0.0259040371 * l_c + 0.7827717662 * m_c - 0.8086757660 * s_c
|
||||
return L, a, b_
|
||||
|
||||
def oklab_to_linear_rgb(L, a, b):
|
||||
"""OKLAB to linear sRGB. Returns (r, g, b) float32 arrays [0,1]."""
|
||||
l_ = L + 0.3963377774 * a + 0.2158037573 * b
|
||||
m_ = L - 0.1055613458 * a - 0.0638541728 * b
|
||||
s_ = L - 0.0894841775 * a - 1.2914855480 * b
|
||||
l_c = l_ ** 3; m_c = m_ ** 3; s_c = s_ ** 3
|
||||
r = +4.0767416621 * l_c - 3.3077115913 * m_c + 0.2309699292 * s_c
|
||||
g = -1.2684380046 * l_c + 2.6097574011 * m_c - 0.3413193965 * s_c
|
||||
b_ = -0.0041960863 * l_c - 0.7034186147 * m_c + 1.7076147010 * s_c
|
||||
return np.clip(r, 0, 1), np.clip(g, 0, 1), np.clip(b_, 0, 1)
|
||||
|
||||
# --- Convenience: sRGB uint8 <-> OKLAB ---
|
||||
|
||||
def rgb_to_oklab(R, G, B):
|
||||
"""sRGB uint8 arrays to OKLAB."""
|
||||
r = srgb_to_linear(R.astype(np.float32) / 255.0)
|
||||
g = srgb_to_linear(G.astype(np.float32) / 255.0)
|
||||
b = srgb_to_linear(B.astype(np.float32) / 255.0)
|
||||
return linear_rgb_to_oklab(r, g, b)
|
||||
|
||||
def oklab_to_rgb(L, a, b):
|
||||
"""OKLAB to sRGB uint8 arrays."""
|
||||
r, g, b_ = oklab_to_linear_rgb(L, a, b)
|
||||
R = np.clip(linear_to_srgb(r) * 255, 0, 255).astype(np.uint8)
|
||||
G = np.clip(linear_to_srgb(g) * 255, 0, 255).astype(np.uint8)
|
||||
B = np.clip(linear_to_srgb(b_) * 255, 0, 255).astype(np.uint8)
|
||||
return R, G, B
|
||||
|
||||
# --- OKLCH (cylindrical form of OKLAB) ---
|
||||
|
||||
def oklab_to_oklch(L, a, b):
|
||||
"""OKLAB to OKLCH. Returns (L, C, H) where H is in [0, 1] (normalized)."""
|
||||
C = np.sqrt(a**2 + b**2)
|
||||
H = (np.arctan2(b, a) / (2 * np.pi)) % 1.0
|
||||
return L, C, H
|
||||
|
||||
def oklch_to_oklab(L, C, H):
|
||||
"""OKLCH to OKLAB. H in [0, 1]."""
|
||||
angle = H * 2 * np.pi
|
||||
a = C * np.cos(angle)
|
||||
b = C * np.sin(angle)
|
||||
return L, a, b
|
||||
```
|
||||
|
||||
### Gradient Interpolation (OKLAB vs HSV)
|
||||
|
||||
Interpolating colors through OKLAB avoids the hue detours that HSV produces:
|
||||
|
||||
```python
|
||||
def lerp_oklab(color_a, color_b, t_array):
|
||||
"""Interpolate between two sRGB colors through OKLAB.
|
||||
color_a, color_b: (R, G, B) tuples 0-255
|
||||
t_array: float32 array [0,1] — interpolation parameter per pixel.
|
||||
Returns (R, G, B) uint8 arrays."""
|
||||
La, aa, ba = rgb_to_oklab(
|
||||
np.full_like(t_array, color_a[0], dtype=np.uint8),
|
||||
np.full_like(t_array, color_a[1], dtype=np.uint8),
|
||||
np.full_like(t_array, color_a[2], dtype=np.uint8))
|
||||
Lb, ab, bb = rgb_to_oklab(
|
||||
np.full_like(t_array, color_b[0], dtype=np.uint8),
|
||||
np.full_like(t_array, color_b[1], dtype=np.uint8),
|
||||
np.full_like(t_array, color_b[2], dtype=np.uint8))
|
||||
L = La + (Lb - La) * t_array
|
||||
a = aa + (ab - aa) * t_array
|
||||
b = ba + (bb - ba) * t_array
|
||||
return oklab_to_rgb(L, a, b)
|
||||
|
||||
def lerp_oklch(color_a, color_b, t_array, short_path=True):
|
||||
"""Interpolate through OKLCH (preserves chroma, smooth hue path).
|
||||
short_path: take the shorter arc around the hue wheel."""
|
||||
La, aa, ba = rgb_to_oklab(
|
||||
np.full_like(t_array, color_a[0], dtype=np.uint8),
|
||||
np.full_like(t_array, color_a[1], dtype=np.uint8),
|
||||
np.full_like(t_array, color_a[2], dtype=np.uint8))
|
||||
Lb, ab, bb = rgb_to_oklab(
|
||||
np.full_like(t_array, color_b[0], dtype=np.uint8),
|
||||
np.full_like(t_array, color_b[1], dtype=np.uint8),
|
||||
np.full_like(t_array, color_b[2], dtype=np.uint8))
|
||||
L1, C1, H1 = oklab_to_oklch(La, aa, ba)
|
||||
L2, C2, H2 = oklab_to_oklch(Lb, ab, bb)
|
||||
# Shortest hue path
|
||||
if short_path:
|
||||
dh = H2 - H1
|
||||
dh = np.where(dh > 0.5, dh - 1.0, np.where(dh < -0.5, dh + 1.0, dh))
|
||||
H = (H1 + dh * t_array) % 1.0
|
||||
else:
|
||||
H = H1 + (H2 - H1) * t_array
|
||||
L = L1 + (L2 - L1) * t_array
|
||||
C = C1 + (C2 - C1) * t_array
|
||||
Lout, aout, bout = oklch_to_oklab(L, C, H)
|
||||
return oklab_to_rgb(Lout, aout, bout)
|
||||
```
|
||||
|
||||
### Color Harmony Generation
|
||||
|
||||
Auto-generate harmonious palettes from a seed color:
|
||||
|
||||
```python
|
||||
def harmony_complementary(seed_rgb):
|
||||
"""Two colors: seed + opposite hue."""
|
||||
L, a, b = rgb_to_oklab(np.array([seed_rgb[0]]), np.array([seed_rgb[1]]), np.array([seed_rgb[2]]))
|
||||
_, C, H = oklab_to_oklch(L, a, b)
|
||||
return [seed_rgb, _oklch_to_srgb_tuple(L[0], C[0], (H[0] + 0.5) % 1.0)]
|
||||
|
||||
def harmony_triadic(seed_rgb):
|
||||
"""Three colors: seed + two at 120-degree offsets."""
|
||||
L, a, b = rgb_to_oklab(np.array([seed_rgb[0]]), np.array([seed_rgb[1]]), np.array([seed_rgb[2]]))
|
||||
_, C, H = oklab_to_oklch(L, a, b)
|
||||
return [seed_rgb,
|
||||
_oklch_to_srgb_tuple(L[0], C[0], (H[0] + 0.333) % 1.0),
|
||||
_oklch_to_srgb_tuple(L[0], C[0], (H[0] + 0.667) % 1.0)]
|
||||
|
||||
def harmony_analogous(seed_rgb, spread=0.08, n=5):
|
||||
"""N colors spread evenly around seed hue."""
|
||||
L, a, b = rgb_to_oklab(np.array([seed_rgb[0]]), np.array([seed_rgb[1]]), np.array([seed_rgb[2]]))
|
||||
_, C, H = oklab_to_oklch(L, a, b)
|
||||
offsets = np.linspace(-spread * (n-1)/2, spread * (n-1)/2, n)
|
||||
return [_oklch_to_srgb_tuple(L[0], C[0], (H[0] + off) % 1.0) for off in offsets]
|
||||
|
||||
def harmony_split_complementary(seed_rgb, split=0.08):
|
||||
"""Three colors: seed + two flanking the complement."""
|
||||
L, a, b = rgb_to_oklab(np.array([seed_rgb[0]]), np.array([seed_rgb[1]]), np.array([seed_rgb[2]]))
|
||||
_, C, H = oklab_to_oklch(L, a, b)
|
||||
comp = (H[0] + 0.5) % 1.0
|
||||
return [seed_rgb,
|
||||
_oklch_to_srgb_tuple(L[0], C[0], (comp - split) % 1.0),
|
||||
_oklch_to_srgb_tuple(L[0], C[0], (comp + split) % 1.0)]
|
||||
|
||||
def harmony_tetradic(seed_rgb):
|
||||
"""Four colors: two complementary pairs at 90-degree offset."""
|
||||
L, a, b = rgb_to_oklab(np.array([seed_rgb[0]]), np.array([seed_rgb[1]]), np.array([seed_rgb[2]]))
|
||||
_, C, H = oklab_to_oklch(L, a, b)
|
||||
return [seed_rgb,
|
||||
_oklch_to_srgb_tuple(L[0], C[0], (H[0] + 0.25) % 1.0),
|
||||
_oklch_to_srgb_tuple(L[0], C[0], (H[0] + 0.5) % 1.0),
|
||||
_oklch_to_srgb_tuple(L[0], C[0], (H[0] + 0.75) % 1.0)]
|
||||
|
||||
def _oklch_to_srgb_tuple(L, C, H):
|
||||
"""Helper: single OKLCH -> sRGB (R,G,B) int tuple."""
|
||||
La = np.array([L]); Ca = np.array([C]); Ha = np.array([H])
|
||||
Lo, ao, bo = oklch_to_oklab(La, Ca, Ha)
|
||||
R, G, B = oklab_to_rgb(Lo, ao, bo)
|
||||
return (int(R[0]), int(G[0]), int(B[0]))
|
||||
```
|
||||
|
||||
### OKLAB Hue Fields
|
||||
|
||||
Drop-in replacements for `hf_*` generators that produce perceptually uniform hue variation:
|
||||
|
||||
```python
|
||||
def hf_oklch_angle(offset=0.0, chroma=0.12, lightness=0.7):
|
||||
"""OKLCH hue mapped to angle from center. Perceptually uniform rainbow.
|
||||
Returns (R, G, B) uint8 color array instead of a float hue.
|
||||
NOTE: Use with _render_vf_rgb() variant, not standard _render_vf()."""
|
||||
def fn(g, f, t, S):
|
||||
H = (g.angle / (2 * np.pi) + offset + t * 0.05) % 1.0
|
||||
L = np.full_like(H, lightness)
|
||||
C = np.full_like(H, chroma)
|
||||
Lo, ao, bo = oklch_to_oklab(L, C, H)
|
||||
R, G, B = oklab_to_rgb(Lo, ao, bo)
|
||||
return mkc(R, G, B, g.rows, g.cols)
|
||||
return fn
|
||||
```
|
||||
|
||||
### Compositing Helpers
|
||||
|
||||
```python
|
||||
def mkc(R, G, B, rows, cols):
|
||||
"""Pack 3 uint8 arrays into (rows, cols, 3) color array."""
|
||||
o = np.zeros((rows, cols, 3), dtype=np.uint8)
|
||||
o[:,:,0] = R; o[:,:,1] = G; o[:,:,2] = B
|
||||
return o
|
||||
|
||||
def layer_over(base_ch, base_co, top_ch, top_co):
|
||||
"""Composite top layer onto base. Non-space chars overwrite."""
|
||||
m = top_ch != " "
|
||||
base_ch[m] = top_ch[m]; base_co[m] = top_co[m]
|
||||
return base_ch, base_co
|
||||
|
||||
def layer_blend(base_co, top_co, alpha):
|
||||
"""Alpha-blend top color layer onto base. alpha is float array (0-1) or scalar."""
|
||||
if isinstance(alpha, (int, float)):
|
||||
alpha = np.full(base_co.shape[:2], alpha, dtype=np.float32)
|
||||
a = alpha[:,:,None]
|
||||
return np.clip(base_co * (1 - a) + top_co * a, 0, 255).astype(np.uint8)
|
||||
|
||||
def stamp(ch, co, text, row, col, color=(255,255,255)):
|
||||
"""Write text string at position."""
|
||||
for i, c in enumerate(text):
|
||||
cc = col + i
|
||||
if 0 <= row < ch.shape[0] and 0 <= cc < ch.shape[1]:
|
||||
ch[row, cc] = c; co[row, cc] = color
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Section System
|
||||
|
||||
Map time ranges to effect functions + shader configs + grid sizes:
|
||||
|
||||
```python
|
||||
SECTIONS = [
|
||||
(0.0, "void"), (3.94, "starfield"), (21.0, "matrix"),
|
||||
(46.0, "drop"), (130.0, "glitch"), (187.0, "outro"),
|
||||
]
|
||||
|
||||
FX_DISPATCH = {"void": fx_void, "starfield": fx_starfield, ...}
|
||||
SECTION_FX = {"void": {"vignette": 0.3, "bloom": 170}, ...}
|
||||
SECTION_GRID = {"void": "md", "starfield": "sm", "drop": "lg", ...}
|
||||
SECTION_MIRROR = {"drop": "h", "bass_rings": "quad"}
|
||||
|
||||
def get_section(t):
|
||||
sec = SECTIONS[0][1]
|
||||
for ts, name in SECTIONS:
|
||||
if t >= ts: sec = name
|
||||
return sec
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Parallel Encoding
|
||||
|
||||
Split frames across N workers. Each pipes raw RGB to its own ffmpeg subprocess:
|
||||
|
||||
```python
|
||||
def render_batch(batch_id, frame_start, frame_end, features, seg_path):
|
||||
r = Renderer()
|
||||
cmd = ["ffmpeg", "-y", "-f", "rawvideo", "-pix_fmt", "rgb24",
|
||||
"-s", f"{VW}x{VH}", "-r", str(FPS), "-i", "pipe:0",
|
||||
"-c:v", "libx264", "-preset", "fast", "-crf", "18",
|
||||
"-pix_fmt", "yuv420p", seg_path]
|
||||
|
||||
# CRITICAL: stderr to file, not pipe
|
||||
stderr_fh = open(os.path.join(workdir, f"err_{batch_id:02d}.log"), "w")
|
||||
pipe = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
||||
stdout=subprocess.DEVNULL, stderr=stderr_fh)
|
||||
|
||||
for fi in range(frame_start, frame_end):
|
||||
t = fi / FPS
|
||||
sec = get_section(t)
|
||||
f = {k: float(features[k][fi]) for k in features}
|
||||
ch, co = FX_DISPATCH[sec](r, f, t)
|
||||
canvas = r.render(ch, co)
|
||||
canvas = apply_mirror(canvas, sec, f)
|
||||
canvas = apply_shaders(canvas, sec, f, t)
|
||||
pipe.stdin.write(canvas.tobytes())
|
||||
|
||||
pipe.stdin.close()
|
||||
pipe.wait()
|
||||
stderr_fh.close()
|
||||
```
|
||||
|
||||
Concatenate segments + mux audio:
|
||||
|
||||
```python
|
||||
# Write concat file
|
||||
with open(concat_path, "w") as cf:
|
||||
for seg in segments:
|
||||
cf.write(f"file '{seg}'\n")
|
||||
|
||||
subprocess.run(["ffmpeg", "-y", "-f", "concat", "-safe", "0", "-i", concat_path,
|
||||
"-i", audio_path, "-c:v", "copy", "-c:a", "aac", "-b:a", "192k",
|
||||
"-shortest", output_path])
|
||||
```
|
||||
|
||||
## Effect Function Contract
|
||||
|
||||
### v2 Protocol (Current)
|
||||
|
||||
Every scene function: `(r, f, t, S) -> canvas_uint8` — where `r` = Renderer, `f` = features dict, `t` = time float, `S` = persistent state dict
|
||||
|
||||
```python
|
||||
def fx_example(r, f, t, S):
|
||||
"""Scene function returns a full pixel canvas (uint8 H,W,3).
|
||||
Scenes have full control over multi-grid rendering and pixel-level composition.
|
||||
"""
|
||||
# Render multiple layers at different grid densities
|
||||
canvas_a = _render_vf(r, "md", vf_plasma, hf_angle(0.0), PAL_DENSE, f, t, S)
|
||||
canvas_b = _render_vf(r, "sm", vf_vortex, hf_time_cycle(0.1), PAL_RUNE, f, t, S)
|
||||
|
||||
# Pixel-level blend
|
||||
result = blend_canvas(canvas_a, canvas_b, "screen", 0.8)
|
||||
return result
|
||||
```
|
||||
|
||||
See `references/scenes.md` for the full scene protocol, the Renderer class, `_render_vf()` helper, and complete scene examples.
|
||||
|
||||
See `references/composition.md` for blend modes, tone mapping, feedback buffers, and multi-grid composition.
|
||||
|
||||
### v1 Protocol (Legacy)
|
||||
|
||||
Simple scenes that use a single grid can still return `(chars, colors)` and let the caller handle rendering, but the v2 canvas protocol is preferred for all new code.
|
||||
|
||||
```python
|
||||
def fx_simple(r, f, t, S):
|
||||
g = r.get_grid("md")
|
||||
val = np.sin(g.dist * 0.1 - t * 3) * f.get("bass", 0.3) * 2
|
||||
val = np.clip(val, 0, 1); mask = val > 0.03
|
||||
ch = val2char(val, mask, PAL_DEFAULT)
|
||||
R, G, B = hsv2rgb(np.full_like(val, 0.6), np.full_like(val, 0.7), val)
|
||||
co = mkc(R, G, B, g.rows, g.cols)
|
||||
return g.render(ch, co) # returns canvas directly
|
||||
```
|
||||
|
||||
### Persistent State
|
||||
|
||||
Effects that need state across frames (particles, rain columns) use the `S` dict parameter (which is `r.S` — same object, but passed explicitly for clarity):
|
||||
|
||||
```python
|
||||
def fx_with_state(r, f, t, S):
|
||||
if "particles" not in S:
|
||||
S["particles"] = initialize_particles()
|
||||
update_particles(S["particles"])
|
||||
# ...
|
||||
```
|
||||
|
||||
State persists across frames within a single scene/clip. Each worker process (and each scene) gets its own independent state.
|
||||
|
||||
### Helper Functions
|
||||
|
||||
```python
|
||||
def hsv2rgb_scalar(h, s, v):
|
||||
"""Single-value HSV to RGB. Returns (R, G, B) tuple of ints 0-255."""
|
||||
h = h % 1.0
|
||||
c = v * s; x = c * (1 - abs((h * 6) % 2 - 1)); m = v - c
|
||||
if h * 6 < 1: r, g, b = c, x, 0
|
||||
elif h * 6 < 2: r, g, b = x, c, 0
|
||||
elif h * 6 < 3: r, g, b = 0, c, x
|
||||
elif h * 6 < 4: r, g, b = 0, x, c
|
||||
elif h * 6 < 5: r, g, b = x, 0, c
|
||||
else: r, g, b = c, 0, x
|
||||
return (int((r+m)*255), int((g+m)*255), int((b+m)*255))
|
||||
|
||||
def log(msg):
|
||||
"""Print timestamped log message."""
|
||||
print(msg, flush=True)
|
||||
```
|
||||
892
skills/creative/ascii-video/references/composition.md
Normal file
892
skills/creative/ascii-video/references/composition.md
Normal file
@@ -0,0 +1,892 @@
|
||||
# Composition & Brightness Reference
|
||||
|
||||
The composable system is the core of visual complexity. It operates at three levels: pixel-level blend modes, multi-grid composition, and adaptive brightness management. This document covers all three, plus the masking/stencil system for spatial control.
|
||||
|
||||
> **See also:** architecture.md · effects.md · scenes.md · shaders.md · troubleshooting.md
|
||||
|
||||
## Pixel-Level Blend Modes
|
||||
|
||||
### The `blend_canvas()` Function
|
||||
|
||||
All blending operates on full pixel canvases (`uint8 H,W,3`). Internally converts to float32 [0,1] for precision, blends, lerps by opacity, converts back.
|
||||
|
||||
```python
|
||||
def blend_canvas(base, top, mode="normal", opacity=1.0):
|
||||
af = base.astype(np.float32) / 255.0
|
||||
bf = top.astype(np.float32) / 255.0
|
||||
fn = BLEND_MODES.get(mode, BLEND_MODES["normal"])
|
||||
result = fn(af, bf)
|
||||
if opacity < 1.0:
|
||||
result = af * (1 - opacity) + result * opacity
|
||||
return np.clip(result * 255, 0, 255).astype(np.uint8)
|
||||
```
|
||||
|
||||
### 20 Blend Modes
|
||||
|
||||
```python
|
||||
BLEND_MODES = {
|
||||
# Basic arithmetic
|
||||
"normal": lambda a, b: b,
|
||||
"add": lambda a, b: np.clip(a + b, 0, 1),
|
||||
"subtract": lambda a, b: np.clip(a - b, 0, 1),
|
||||
"multiply": lambda a, b: a * b,
|
||||
"screen": lambda a, b: 1 - (1 - a) * (1 - b),
|
||||
|
||||
# Contrast
|
||||
"overlay": lambda a, b: np.where(a < 0.5, 2*a*b, 1 - 2*(1-a)*(1-b)),
|
||||
"softlight": lambda a, b: (1 - 2*b)*a*a + 2*b*a,
|
||||
"hardlight": lambda a, b: np.where(b < 0.5, 2*a*b, 1 - 2*(1-a)*(1-b)),
|
||||
|
||||
# Difference
|
||||
"difference": lambda a, b: np.abs(a - b),
|
||||
"exclusion": lambda a, b: a + b - 2*a*b,
|
||||
|
||||
# Dodge / burn
|
||||
"colordodge": lambda a, b: np.clip(a / (1 - b + 1e-6), 0, 1),
|
||||
"colorburn": lambda a, b: np.clip(1 - (1 - a) / (b + 1e-6), 0, 1),
|
||||
|
||||
# Light
|
||||
"linearlight": lambda a, b: np.clip(a + 2*b - 1, 0, 1),
|
||||
"vividlight": lambda a, b: np.where(b < 0.5,
|
||||
np.clip(1 - (1-a)/(2*b + 1e-6), 0, 1),
|
||||
np.clip(a / (2*(1-b) + 1e-6), 0, 1)),
|
||||
"pin_light": lambda a, b: np.where(b < 0.5,
|
||||
np.minimum(a, 2*b), np.maximum(a, 2*b - 1)),
|
||||
"hard_mix": lambda a, b: np.where(a + b >= 1.0, 1.0, 0.0),
|
||||
|
||||
# Compare
|
||||
"lighten": lambda a, b: np.maximum(a, b),
|
||||
"darken": lambda a, b: np.minimum(a, b),
|
||||
|
||||
# Grain
|
||||
"grain_extract": lambda a, b: np.clip(a - b + 0.5, 0, 1),
|
||||
"grain_merge": lambda a, b: np.clip(a + b - 0.5, 0, 1),
|
||||
}
|
||||
```
|
||||
|
||||
### Blend Mode Selection Guide
|
||||
|
||||
**Modes that brighten** (safe for dark inputs):
|
||||
- `screen` — always brightens. Two 50% gray layers screen to 75%. The go-to safe blend.
|
||||
- `add` — simple addition, clips at white. Good for sparkles, glows, particle overlays.
|
||||
- `colordodge` — extreme brightening at overlap zones. Can blow out. Use low opacity (0.3-0.5).
|
||||
- `linearlight` — aggressive brightening. Similar to add but with offset.
|
||||
|
||||
**Modes that darken** (avoid with dark inputs):
|
||||
- `multiply` — darkens everything. Only use when both layers are already bright.
|
||||
- `overlay` — darkens when base < 0.5, brightens when base > 0.5. Crushes dark inputs: `2 * 0.12 * 0.12 = 0.03`. Use `screen` instead for dark material.
|
||||
- `colorburn` — extreme darkening at overlap zones.
|
||||
|
||||
**Modes that create contrast**:
|
||||
- `softlight` — gentle contrast. Good for subtle texture overlay.
|
||||
- `hardlight` — strong contrast. Like overlay but keyed on the top layer.
|
||||
- `vividlight` — very aggressive contrast. Use sparingly.
|
||||
|
||||
**Modes that create color effects**:
|
||||
- `difference` — XOR-like patterns. Two identical layers difference to black; offset layers create wild colors. Great for psychedelic looks.
|
||||
- `exclusion` — softer version of difference. Creates complementary color patterns.
|
||||
- `hard_mix` — posterizes to pure black/white/saturated color at intersections.
|
||||
|
||||
**Modes for texture blending**:
|
||||
- `grain_extract` / `grain_merge` — extract a texture from one layer, apply it to another.
|
||||
|
||||
### Multi-Layer Chaining
|
||||
|
||||
```python
|
||||
# Pattern: render layers -> blend sequentially
|
||||
canvas_a = _render_vf(r, "md", vf_plasma, hf_angle(0.0), PAL_DENSE, f, t, S)
|
||||
canvas_b = _render_vf(r, "sm", vf_vortex, hf_time_cycle(0.1), PAL_RUNE, f, t, S)
|
||||
canvas_c = _render_vf(r, "lg", vf_rings, hf_distance(), PAL_BLOCKS, f, t, S)
|
||||
|
||||
result = blend_canvas(canvas_a, canvas_b, "screen", 0.8)
|
||||
result = blend_canvas(result, canvas_c, "difference", 0.6)
|
||||
```
|
||||
|
||||
Order matters: `screen(A, B)` is commutative, but `difference(screen(A,B), C)` differs from `difference(A, screen(B,C))`.
|
||||
|
||||
### Linear-Light Blend Modes
|
||||
|
||||
Standard `blend_canvas()` operates in sRGB space — the raw byte values. This is fine for most uses, but sRGB is perceptually non-linear: blending in sRGB darkens midtones and shifts hues slightly. For physically accurate blending (matching how light actually combines), convert to linear light first.
|
||||
|
||||
Uses `srgb_to_linear()` / `linear_to_srgb()` from `architecture.md` § OKLAB Color System.
|
||||
|
||||
```python
|
||||
def blend_canvas_linear(base, top, mode="normal", opacity=1.0):
|
||||
"""Blend in linear light space for physically accurate results.
|
||||
|
||||
Identical API to blend_canvas(), but converts sRGB → linear before
|
||||
blending and linear → sRGB after. More expensive (~2x) due to the
|
||||
gamma conversions, but produces correct results for additive blending,
|
||||
screen, and any mode where brightness matters.
|
||||
"""
|
||||
af = srgb_to_linear(base.astype(np.float32) / 255.0)
|
||||
bf = srgb_to_linear(top.astype(np.float32) / 255.0)
|
||||
fn = BLEND_MODES.get(mode, BLEND_MODES["normal"])
|
||||
result = fn(af, bf)
|
||||
if opacity < 1.0:
|
||||
result = af * (1 - opacity) + result * opacity
|
||||
result = linear_to_srgb(np.clip(result, 0, 1))
|
||||
return np.clip(result * 255, 0, 255).astype(np.uint8)
|
||||
```
|
||||
|
||||
**When to use `blend_canvas_linear()` vs `blend_canvas()`:**
|
||||
|
||||
| Scenario | Use | Why |
|
||||
|----------|-----|-----|
|
||||
| Screen-blending two bright layers | `linear` | sRGB screen over-brightens highlights |
|
||||
| Add mode for glow/bloom effects | `linear` | Additive light follows linear physics |
|
||||
| Blending text overlay at low opacity | `srgb` | Perceptual blending looks more natural for text |
|
||||
| Multiply for shadow/darkening | `srgb` | Differences are minimal for darken ops |
|
||||
| Color-critical work (matching reference) | `linear` | Avoids sRGB hue shifts in midtones |
|
||||
| Performance-critical inner loop | `srgb` | ~2x faster, good enough for most ASCII art |
|
||||
|
||||
**Batch version** for compositing many layers (converts once, blends multiple, converts back):
|
||||
|
||||
```python
|
||||
def blend_many_linear(layers, modes, opacities):
|
||||
"""Blend a stack of layers in linear light space.
|
||||
|
||||
Args:
|
||||
layers: list of uint8 (H,W,3) canvases
|
||||
modes: list of blend mode strings (len = len(layers) - 1)
|
||||
opacities: list of floats (len = len(layers) - 1)
|
||||
Returns:
|
||||
uint8 (H,W,3) canvas
|
||||
"""
|
||||
# Convert all to linear at once
|
||||
linear = [srgb_to_linear(l.astype(np.float32) / 255.0) for l in layers]
|
||||
result = linear[0]
|
||||
for i in range(1, len(linear)):
|
||||
fn = BLEND_MODES.get(modes[i-1], BLEND_MODES["normal"])
|
||||
blended = fn(result, linear[i])
|
||||
op = opacities[i-1]
|
||||
if op < 1.0:
|
||||
blended = result * (1 - op) + blended * op
|
||||
result = np.clip(blended, 0, 1)
|
||||
result = linear_to_srgb(result)
|
||||
return np.clip(result * 255, 0, 255).astype(np.uint8)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Multi-Grid Composition
|
||||
|
||||
This is the core visual technique. Rendering the same conceptual scene at different grid densities (character sizes) creates natural texture interference, because characters at different scales overlap at different spatial frequencies.
|
||||
|
||||
### Why It Works
|
||||
|
||||
- `sm` grid (10pt font): 320x83 characters. Fine detail, dense texture.
|
||||
- `md` grid (16pt): 192x56 characters. Medium density.
|
||||
- `lg` grid (20pt): 160x45 characters. Coarse, chunky characters.
|
||||
|
||||
When you render a plasma field on `sm` and a vortex on `lg`, then screen-blend them, the fine plasma texture shows through the gaps in the coarse vortex characters. The result has more visual complexity than either layer alone.
|
||||
|
||||
### The `_render_vf()` Helper
|
||||
|
||||
This is the workhorse function. It takes a value field + hue field + palette + grid, renders to a complete pixel canvas:
|
||||
|
||||
```python
|
||||
def _render_vf(r, grid_key, val_fn, hue_fn, pal, f, t, S, sat=0.8, threshold=0.03):
|
||||
"""Render a value field + hue field to a pixel canvas via a named grid.
|
||||
|
||||
Args:
|
||||
r: Renderer instance (has .get_grid())
|
||||
grid_key: "xs", "sm", "md", "lg", "xl", "xxl"
|
||||
val_fn: (g, f, t, S) -> float32 [0,1] array (rows, cols)
|
||||
hue_fn: callable (g, f, t, S) -> float32 hue array, OR float scalar
|
||||
pal: character palette string
|
||||
f: feature dict
|
||||
t: time in seconds
|
||||
S: persistent state dict
|
||||
sat: HSV saturation (0-1)
|
||||
threshold: minimum value to render (below = space)
|
||||
|
||||
Returns:
|
||||
uint8 array (VH, VW, 3) — full pixel canvas
|
||||
"""
|
||||
g = r.get_grid(grid_key)
|
||||
val = np.clip(val_fn(g, f, t, S), 0, 1)
|
||||
mask = val > threshold
|
||||
ch = val2char(val, mask, pal)
|
||||
|
||||
# Hue: either a callable or a fixed float
|
||||
if callable(hue_fn):
|
||||
h = hue_fn(g, f, t, S) % 1.0
|
||||
else:
|
||||
h = np.full((g.rows, g.cols), float(hue_fn), dtype=np.float32)
|
||||
|
||||
# CRITICAL: broadcast to full shape and copy (see Troubleshooting)
|
||||
h = np.broadcast_to(h, (g.rows, g.cols)).copy()
|
||||
|
||||
R, G, B = hsv2rgb(h, np.full_like(val, sat), val)
|
||||
co = mkc(R, G, B, g.rows, g.cols)
|
||||
return g.render(ch, co)
|
||||
```
|
||||
|
||||
### Grid Combination Strategies
|
||||
|
||||
| Combination | Effect | Good For |
|
||||
|-------------|--------|----------|
|
||||
| `sm` + `lg` | Maximum contrast between fine detail and chunky blocks | Bold, graphic looks |
|
||||
| `sm` + `md` | Subtle texture layering, similar scales | Organic, flowing looks |
|
||||
| `md` + `lg` + `xs` | Three-scale interference, maximum complexity | Psychedelic, dense |
|
||||
| `sm` + `sm` (different effects) | Same scale, pattern interference only | Moire, interference |
|
||||
|
||||
### Complete Multi-Grid Scene Example
|
||||
|
||||
```python
|
||||
def fx_psychedelic(r, f, t, S):
|
||||
"""Three-layer multi-grid scene with beat-reactive kaleidoscope."""
|
||||
# Layer A: plasma on medium grid with rainbow hue
|
||||
canvas_a = _render_vf(r, "md",
|
||||
lambda g, f, t, S: vf_plasma(g, f, t, S) * 1.3,
|
||||
hf_angle(0.0), PAL_DENSE, f, t, S, sat=0.8)
|
||||
|
||||
# Layer B: vortex on small grid with cycling hue
|
||||
canvas_b = _render_vf(r, "sm",
|
||||
lambda g, f, t, S: vf_vortex(g, f, t, S, twist=5.0) * 1.2,
|
||||
hf_time_cycle(0.1), PAL_RUNE, f, t, S, sat=0.7)
|
||||
|
||||
# Layer C: rings on large grid with distance hue
|
||||
canvas_c = _render_vf(r, "lg",
|
||||
lambda g, f, t, S: vf_rings(g, f, t, S, n_base=8, spacing_base=3) * 1.4,
|
||||
hf_distance(0.3, 0.02), PAL_BLOCKS, f, t, S, sat=0.9)
|
||||
|
||||
# Blend: A screened with B, then difference with C
|
||||
result = blend_canvas(canvas_a, canvas_b, "screen", 0.8)
|
||||
result = blend_canvas(result, canvas_c, "difference", 0.6)
|
||||
|
||||
# Beat-triggered kaleidoscope
|
||||
if f.get("bdecay", 0) > 0.3:
|
||||
result = sh_kaleidoscope(result.copy(), folds=6)
|
||||
|
||||
return result
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Adaptive Tone Mapping
|
||||
|
||||
### The Brightness Problem
|
||||
|
||||
ASCII characters are small bright dots on a black background. Most pixels in any frame are background (black). This means:
|
||||
- Mean frame brightness is inherently low (often 5-30 out of 255)
|
||||
- Different effect combinations produce wildly different brightness levels
|
||||
- A spiral scene might be 50 mean, while a fire scene is 9 mean
|
||||
- Linear multipliers (e.g., `canvas * 2.0`) either leave dark scenes dark or blow out bright scenes
|
||||
|
||||
### The `tonemap()` Function
|
||||
|
||||
Replaces linear brightness multipliers with adaptive per-frame normalization + gamma correction:
|
||||
|
||||
```python
|
||||
def tonemap(canvas, target_mean=90, gamma=0.75, black_point=2, white_point=253):
|
||||
"""Adaptive tone-mapping: normalizes + gamma-corrects so no frame is
|
||||
fully dark or washed out.
|
||||
|
||||
1. Compute 1st and 99.5th percentile on 4x subsample (16x fewer values,
|
||||
negligible accuracy loss, major speedup at 1080p+)
|
||||
2. Stretch that range to [0, 1]
|
||||
3. Apply gamma curve (< 1 lifts shadows, > 1 darkens)
|
||||
4. Rescale to [black_point, white_point]
|
||||
"""
|
||||
f = canvas.astype(np.float32)
|
||||
sub = f[::4, ::4] # 4x subsample: ~390K values vs ~6.2M at 1080p
|
||||
lo = np.percentile(sub, 1)
|
||||
hi = np.percentile(sub, 99.5)
|
||||
if hi - lo < 10:
|
||||
hi = max(hi, lo + 10) # near-uniform frame fallback
|
||||
f = np.clip((f - lo) / (hi - lo), 0.0, 1.0)
|
||||
np.power(f, gamma, out=f) # in-place: avoids allocation
|
||||
np.multiply(f, (white_point - black_point), out=f)
|
||||
np.add(f, black_point, out=f)
|
||||
return np.clip(f, 0, 255).astype(np.uint8)
|
||||
```
|
||||
|
||||
### Why Gamma, Not Linear
|
||||
|
||||
Linear multiplier `* 2.0`:
|
||||
```
|
||||
input 10 -> output 20 (still dark)
|
||||
input 100 -> output 200 (ok)
|
||||
input 200 -> output 255 (clipped, lost detail)
|
||||
```
|
||||
|
||||
Gamma 0.75 after normalization:
|
||||
```
|
||||
input 0.04 -> output 0.08 (lifted from invisible to visible)
|
||||
input 0.39 -> output 0.50 (moderate lift)
|
||||
input 0.78 -> output 0.84 (gentle lift, no clipping)
|
||||
```
|
||||
|
||||
Gamma < 1 compresses the highlights and expands the shadows. This is exactly what we need: lift dark ASCII content into visibility without blowing out the bright parts.
|
||||
|
||||
### Pipeline Ordering
|
||||
|
||||
The pipeline in `render_clip()` is:
|
||||
|
||||
```
|
||||
scene_fn(r, f, t, S) -> canvas
|
||||
|
|
||||
tonemap(canvas, gamma=scene_gamma)
|
||||
|
|
||||
FeedbackBuffer.apply(canvas, ...)
|
||||
|
|
||||
ShaderChain.apply(canvas, f=f, t=t)
|
||||
|
|
||||
ffmpeg pipe
|
||||
```
|
||||
|
||||
Tonemap runs BEFORE feedback and shaders. This means:
|
||||
- Feedback operates on normalized data (consistent behavior regardless of scene brightness)
|
||||
- Shaders like solarize, posterize, contrast operate on properly-ranged data
|
||||
- The brightness shader in the chain is no longer needed (tonemap handles it)
|
||||
|
||||
### Per-Scene Gamma Tuning
|
||||
|
||||
Default gamma is 0.75. Scenes that apply destructive post-processing need more aggressive lift because the destruction happens after tonemap:
|
||||
|
||||
| Scene Type | Recommended Gamma | Why |
|
||||
|------------|-------------------|-----|
|
||||
| Standard effects | 0.75 | Default, works for most scenes |
|
||||
| Solarize post-process | 0.50-0.60 | Solarize inverts bright pixels, reducing overall brightness |
|
||||
| Posterize post-process | 0.50-0.55 | Posterize quantizes, often crushing mid-values to black |
|
||||
| Heavy difference blending | 0.60-0.70 | Difference mode creates many near-zero pixels |
|
||||
| Already bright scenes | 0.85-1.0 | Don't over-boost scenes that are naturally bright |
|
||||
|
||||
Configure via the scene table:
|
||||
|
||||
```python
|
||||
SCENES = [
|
||||
{"start": 9.17, "end": 11.25, "name": "fire", "gamma": 0.55,
|
||||
"fx": fx_fire, "shaders": [("solarize", {"threshold": 200}), ...]},
|
||||
{"start": 25.96, "end": 27.29, "name": "diamond", "gamma": 0.5,
|
||||
"fx": fx_diamond, "shaders": [("bloom", {"thr": 90}), ...]},
|
||||
]
|
||||
```
|
||||
|
||||
### Brightness Verification
|
||||
|
||||
After rendering, spot-check frame brightness:
|
||||
|
||||
```python
|
||||
# In test-frame mode
|
||||
canvas = scene["fx"](r, feat, t, r.S)
|
||||
canvas = tonemap(canvas, gamma=scene.get("gamma", 0.75))
|
||||
chain = ShaderChain()
|
||||
for sn, kw in scene.get("shaders", []):
|
||||
chain.add(sn, **kw)
|
||||
canvas = chain.apply(canvas, f=feat, t=t)
|
||||
print(f"Mean brightness: {canvas.astype(float).mean():.1f}, max: {canvas.max()}")
|
||||
```
|
||||
|
||||
Target ranges after tonemap + shaders:
|
||||
- Quiet/ambient scenes: mean 30-60
|
||||
- Active scenes: mean 40-100
|
||||
- Climax/peak scenes: mean 60-150
|
||||
- If mean < 20: gamma is too high or a shader is destroying brightness
|
||||
- If mean > 180: gamma is too low or add is stacking too much
|
||||
|
||||
---
|
||||
|
||||
## FeedbackBuffer Spatial Transforms
|
||||
|
||||
The feedback buffer stores the previous frame and blends it into the current frame with decay. Spatial transforms applied to the buffer before blending create the illusion of motion in the feedback trail.
|
||||
|
||||
### Implementation
|
||||
|
||||
```python
|
||||
class FeedbackBuffer:
|
||||
def __init__(self):
|
||||
self.buf = None
|
||||
|
||||
def apply(self, canvas, decay=0.85, blend="screen", opacity=0.5,
|
||||
transform=None, transform_amt=0.02, hue_shift=0.0):
|
||||
if self.buf is None:
|
||||
self.buf = canvas.astype(np.float32) / 255.0
|
||||
return canvas
|
||||
|
||||
# Decay old buffer
|
||||
self.buf *= decay
|
||||
|
||||
# Spatial transform
|
||||
if transform:
|
||||
self.buf = self._transform(self.buf, transform, transform_amt)
|
||||
|
||||
# Hue shift the feedback for rainbow trails
|
||||
if hue_shift > 0:
|
||||
self.buf = self._hue_shift(self.buf, hue_shift)
|
||||
|
||||
# Blend feedback into current frame
|
||||
result = blend_canvas(canvas,
|
||||
np.clip(self.buf * 255, 0, 255).astype(np.uint8),
|
||||
blend, opacity)
|
||||
|
||||
# Update buffer with current frame
|
||||
self.buf = result.astype(np.float32) / 255.0
|
||||
return result
|
||||
|
||||
def _transform(self, buf, transform, amt):
|
||||
h, w = buf.shape[:2]
|
||||
if transform == "zoom":
|
||||
# Zoom in: sample from slightly inside (creates expanding tunnel)
|
||||
m = int(h * amt); n = int(w * amt)
|
||||
if m > 0 and n > 0:
|
||||
cropped = buf[m:-m or None, n:-n or None]
|
||||
# Resize back to full (nearest-neighbor for speed)
|
||||
buf = np.array(Image.fromarray(
|
||||
np.clip(cropped * 255, 0, 255).astype(np.uint8)
|
||||
).resize((w, h), Image.NEAREST)).astype(np.float32) / 255.0
|
||||
elif transform == "shrink":
|
||||
# Zoom out: pad edges, shrink center
|
||||
m = int(h * amt); n = int(w * amt)
|
||||
small = np.array(Image.fromarray(
|
||||
np.clip(buf * 255, 0, 255).astype(np.uint8)
|
||||
).resize((w - 2*n, h - 2*m), Image.NEAREST))
|
||||
new = np.zeros((h, w, 3), dtype=np.uint8)
|
||||
new[m:m+small.shape[0], n:n+small.shape[1]] = small
|
||||
buf = new.astype(np.float32) / 255.0
|
||||
elif transform == "rotate_cw":
|
||||
# Small clockwise rotation via affine
|
||||
angle = amt * 10 # amt=0.005 -> 0.05 degrees per frame
|
||||
cy, cx = h / 2, w / 2
|
||||
Y = np.arange(h, dtype=np.float32)[:, None]
|
||||
X = np.arange(w, dtype=np.float32)[None, :]
|
||||
cos_a, sin_a = np.cos(angle), np.sin(angle)
|
||||
sx = (X - cx) * cos_a + (Y - cy) * sin_a + cx
|
||||
sy = -(X - cx) * sin_a + (Y - cy) * cos_a + cy
|
||||
sx = np.clip(sx.astype(int), 0, w - 1)
|
||||
sy = np.clip(sy.astype(int), 0, h - 1)
|
||||
buf = buf[sy, sx]
|
||||
elif transform == "rotate_ccw":
|
||||
angle = -amt * 10
|
||||
cy, cx = h / 2, w / 2
|
||||
Y = np.arange(h, dtype=np.float32)[:, None]
|
||||
X = np.arange(w, dtype=np.float32)[None, :]
|
||||
cos_a, sin_a = np.cos(angle), np.sin(angle)
|
||||
sx = (X - cx) * cos_a + (Y - cy) * sin_a + cx
|
||||
sy = -(X - cx) * sin_a + (Y - cy) * cos_a + cy
|
||||
sx = np.clip(sx.astype(int), 0, w - 1)
|
||||
sy = np.clip(sy.astype(int), 0, h - 1)
|
||||
buf = buf[sy, sx]
|
||||
elif transform == "shift_up":
|
||||
pixels = max(1, int(h * amt))
|
||||
buf = np.roll(buf, -pixels, axis=0)
|
||||
buf[-pixels:] = 0 # black fill at bottom
|
||||
elif transform == "shift_down":
|
||||
pixels = max(1, int(h * amt))
|
||||
buf = np.roll(buf, pixels, axis=0)
|
||||
buf[:pixels] = 0
|
||||
elif transform == "mirror_h":
|
||||
buf = buf[:, ::-1]
|
||||
return buf
|
||||
|
||||
def _hue_shift(self, buf, amount):
|
||||
"""Rotate hues of the feedback buffer. Operates on float32 [0,1]."""
|
||||
rgb = np.clip(buf * 255, 0, 255).astype(np.uint8)
|
||||
hsv = np.zeros_like(buf)
|
||||
# Simple approximate RGB->HSV->shift->RGB
|
||||
r, g, b = buf[:,:,0], buf[:,:,1], buf[:,:,2]
|
||||
mx = np.maximum(np.maximum(r, g), b)
|
||||
mn = np.minimum(np.minimum(r, g), b)
|
||||
delta = mx - mn + 1e-10
|
||||
# Hue
|
||||
h = np.where(mx == r, ((g - b) / delta) % 6,
|
||||
np.where(mx == g, (b - r) / delta + 2, (r - g) / delta + 4))
|
||||
h = (h / 6 + amount) % 1.0
|
||||
# Reconstruct with shifted hue (simplified)
|
||||
s = delta / (mx + 1e-10)
|
||||
v = mx
|
||||
c = v * s; x = c * (1 - np.abs((h * 6) % 2 - 1)); m = v - c
|
||||
ro = np.zeros_like(h); go = np.zeros_like(h); bo = np.zeros_like(h)
|
||||
for lo, hi, rv, gv, bv in [(0,1,c,x,0),(1,2,x,c,0),(2,3,0,c,x),
|
||||
(3,4,0,x,c),(4,5,x,0,c),(5,6,c,0,x)]:
|
||||
mask = ((h*6) >= lo) & ((h*6) < hi)
|
||||
ro[mask] = rv[mask] if not isinstance(rv, (int,float)) else rv
|
||||
go[mask] = gv[mask] if not isinstance(gv, (int,float)) else gv
|
||||
bo[mask] = bv[mask] if not isinstance(bv, (int,float)) else bv
|
||||
return np.stack([ro+m, go+m, bo+m], axis=2)
|
||||
```
|
||||
|
||||
### Feedback Presets
|
||||
|
||||
| Preset | Config | Visual Effect |
|
||||
|--------|--------|---------------|
|
||||
| Infinite zoom tunnel | `decay=0.8, blend="screen", transform="zoom", transform_amt=0.015` | Expanding ring patterns |
|
||||
| Rainbow trails | `decay=0.7, blend="screen", transform="zoom", transform_amt=0.01, hue_shift=0.02` | Psychedelic color trails |
|
||||
| Ghostly echo | `decay=0.9, blend="add", opacity=0.15, transform="shift_up", transform_amt=0.01` | Faint upward smearing |
|
||||
| Kaleidoscopic recursion | `decay=0.75, blend="screen", transform="rotate_cw", transform_amt=0.005, hue_shift=0.01` | Rotating mandala feedback |
|
||||
| Color evolution | `decay=0.8, blend="difference", opacity=0.4, hue_shift=0.03` | Frame-to-frame color XOR |
|
||||
| Rising heat haze | `decay=0.5, blend="add", opacity=0.2, transform="shift_up", transform_amt=0.02` | Hot air shimmer |
|
||||
|
||||
---
|
||||
|
||||
## Masking / Stencil System
|
||||
|
||||
Masks are float32 arrays `(rows, cols)` or `(VH, VW)` in range [0, 1]. They control where effects are visible: 1.0 = fully visible, 0.0 = fully hidden. Use masks to create figure/ground relationships, focal points, and shaped reveals.
|
||||
|
||||
### Shape Masks
|
||||
|
||||
```python
|
||||
def mask_circle(g, cx_frac=0.5, cy_frac=0.5, radius=0.3, feather=0.05):
|
||||
"""Circular mask centered at (cx_frac, cy_frac) in normalized coords.
|
||||
feather: width of soft edge (0 = hard cutoff)."""
|
||||
asp = g.cw / g.ch if hasattr(g, 'cw') else 1.0
|
||||
dx = (g.cc / g.cols - cx_frac)
|
||||
dy = (g.rr / g.rows - cy_frac) * asp
|
||||
d = np.sqrt(dx**2 + dy**2)
|
||||
if feather > 0:
|
||||
return np.clip(1.0 - (d - radius) / feather, 0, 1)
|
||||
return (d <= radius).astype(np.float32)
|
||||
|
||||
def mask_rect(g, x0=0.2, y0=0.2, x1=0.8, y1=0.8, feather=0.03):
|
||||
"""Rectangular mask. Coordinates in [0,1] normalized."""
|
||||
dx = np.maximum(x0 - g.cc / g.cols, g.cc / g.cols - x1)
|
||||
dy = np.maximum(y0 - g.rr / g.rows, g.rr / g.rows - y1)
|
||||
d = np.maximum(dx, dy)
|
||||
if feather > 0:
|
||||
return np.clip(1.0 - d / feather, 0, 1)
|
||||
return (d <= 0).astype(np.float32)
|
||||
|
||||
def mask_ring(g, cx_frac=0.5, cy_frac=0.5, inner_r=0.15, outer_r=0.35,
|
||||
feather=0.03):
|
||||
"""Ring / annulus mask."""
|
||||
inner = mask_circle(g, cx_frac, cy_frac, inner_r, feather)
|
||||
outer = mask_circle(g, cx_frac, cy_frac, outer_r, feather)
|
||||
return outer - inner
|
||||
|
||||
def mask_gradient_h(g, start=0.0, end=1.0):
|
||||
"""Left-to-right gradient mask."""
|
||||
return np.clip((g.cc / g.cols - start) / (end - start + 1e-10), 0, 1).astype(np.float32)
|
||||
|
||||
def mask_gradient_v(g, start=0.0, end=1.0):
|
||||
"""Top-to-bottom gradient mask."""
|
||||
return np.clip((g.rr / g.rows - start) / (end - start + 1e-10), 0, 1).astype(np.float32)
|
||||
|
||||
def mask_gradient_radial(g, cx_frac=0.5, cy_frac=0.5, inner=0.0, outer=0.5):
|
||||
"""Radial gradient mask — bright at center, dark at edges."""
|
||||
d = np.sqrt((g.cc / g.cols - cx_frac)**2 + (g.rr / g.rows - cy_frac)**2)
|
||||
return np.clip(1.0 - (d - inner) / (outer - inner + 1e-10), 0, 1)
|
||||
```
|
||||
|
||||
### Value Field as Mask
|
||||
|
||||
Use any `vf_*` function's output as a spatial mask:
|
||||
|
||||
```python
|
||||
def mask_from_vf(vf_result, threshold=0.5, feather=0.1):
|
||||
"""Convert a value field to a mask by thresholding.
|
||||
feather: smooth edge width around threshold."""
|
||||
if feather > 0:
|
||||
return np.clip((vf_result - threshold + feather) / (2 * feather), 0, 1)
|
||||
return (vf_result > threshold).astype(np.float32)
|
||||
|
||||
def mask_select(mask, vf_a, vf_b):
|
||||
"""Spatial conditional: show vf_a where mask is 1, vf_b where mask is 0.
|
||||
mask: float32 [0,1] array. Intermediate values blend."""
|
||||
return vf_a * mask + vf_b * (1 - mask)
|
||||
```
|
||||
|
||||
### Text Stencil
|
||||
|
||||
Render text to a mask. Effects are visible only through the letterforms:
|
||||
|
||||
```python
|
||||
def mask_text(grid, text, row_frac=0.5, font=None, font_size=None):
|
||||
"""Render text string as a float32 mask [0,1] at grid resolution.
|
||||
Characters = 1.0, background = 0.0.
|
||||
|
||||
row_frac: vertical position as fraction of grid height.
|
||||
font: PIL ImageFont (defaults to grid's font if None).
|
||||
font_size: override font size for the mask text (for larger stencil text).
|
||||
"""
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
f = font or grid.font
|
||||
if font_size and font != grid.font:
|
||||
f = ImageFont.truetype(font.path, font_size)
|
||||
|
||||
# Render text to image at pixel resolution, then downsample to grid
|
||||
img = Image.new("L", (grid.cols * grid.cw, grid.ch), 0)
|
||||
draw = ImageDraw.Draw(img)
|
||||
bbox = draw.textbbox((0, 0), text, font=f)
|
||||
tw = bbox[2] - bbox[0]
|
||||
x = (grid.cols * grid.cw - tw) // 2
|
||||
draw.text((x, 0), text, fill=255, font=f)
|
||||
row_mask = np.array(img, dtype=np.float32) / 255.0
|
||||
|
||||
# Place in full grid mask
|
||||
mask = np.zeros((grid.rows, grid.cols), dtype=np.float32)
|
||||
target_row = int(grid.rows * row_frac)
|
||||
# Downsample rendered text to grid cells
|
||||
for c in range(grid.cols):
|
||||
px = c * grid.cw
|
||||
if px + grid.cw <= row_mask.shape[1]:
|
||||
cell = row_mask[:, px:px + grid.cw]
|
||||
if cell.mean() > 0.1:
|
||||
mask[target_row, c] = cell.mean()
|
||||
return mask
|
||||
|
||||
def mask_text_block(grid, lines, start_row_frac=0.3, font=None):
|
||||
"""Multi-line text stencil. Returns full grid mask."""
|
||||
mask = np.zeros((grid.rows, grid.cols), dtype=np.float32)
|
||||
for i, line in enumerate(lines):
|
||||
row_frac = start_row_frac + i / grid.rows
|
||||
line_mask = mask_text(grid, line, row_frac, font)
|
||||
mask = np.maximum(mask, line_mask)
|
||||
return mask
|
||||
```
|
||||
|
||||
### Animated Masks
|
||||
|
||||
Masks that change over time for reveals, wipes, and morphing:
|
||||
|
||||
```python
|
||||
def mask_iris(g, t, t_start, t_end, cx_frac=0.5, cy_frac=0.5,
|
||||
max_radius=0.7, ease_fn=None):
|
||||
"""Iris open/close: circle that grows from 0 to max_radius.
|
||||
ease_fn: easing function (default: ease_in_out_cubic from effects.md)."""
|
||||
if ease_fn is None:
|
||||
ease_fn = lambda x: x * x * (3 - 2 * x) # smoothstep fallback
|
||||
progress = np.clip((t - t_start) / (t_end - t_start), 0, 1)
|
||||
radius = ease_fn(progress) * max_radius
|
||||
return mask_circle(g, cx_frac, cy_frac, radius, feather=0.03)
|
||||
|
||||
def mask_wipe_h(g, t, t_start, t_end, direction="right"):
|
||||
"""Horizontal wipe reveal."""
|
||||
progress = np.clip((t - t_start) / (t_end - t_start), 0, 1)
|
||||
if direction == "left":
|
||||
progress = 1 - progress
|
||||
return mask_gradient_h(g, start=progress - 0.05, end=progress + 0.05)
|
||||
|
||||
def mask_wipe_v(g, t, t_start, t_end, direction="down"):
|
||||
"""Vertical wipe reveal."""
|
||||
progress = np.clip((t - t_start) / (t_end - t_start), 0, 1)
|
||||
if direction == "up":
|
||||
progress = 1 - progress
|
||||
return mask_gradient_v(g, start=progress - 0.05, end=progress + 0.05)
|
||||
|
||||
def mask_dissolve(g, t, t_start, t_end, seed=42):
|
||||
"""Random pixel dissolve — noise threshold sweeps from 0 to 1."""
|
||||
progress = np.clip((t - t_start) / (t_end - t_start), 0, 1)
|
||||
rng = np.random.RandomState(seed)
|
||||
noise = rng.random((g.rows, g.cols)).astype(np.float32)
|
||||
return (noise < progress).astype(np.float32)
|
||||
```
|
||||
|
||||
### Mask Boolean Operations
|
||||
|
||||
```python
|
||||
def mask_union(a, b):
|
||||
"""OR — visible where either mask is active."""
|
||||
return np.maximum(a, b)
|
||||
|
||||
def mask_intersect(a, b):
|
||||
"""AND — visible only where both masks are active."""
|
||||
return np.minimum(a, b)
|
||||
|
||||
def mask_subtract(a, b):
|
||||
"""A minus B — visible where A is active but B is not."""
|
||||
return np.clip(a - b, 0, 1)
|
||||
|
||||
def mask_invert(m):
|
||||
"""NOT — flip mask."""
|
||||
return 1.0 - m
|
||||
```
|
||||
|
||||
### Applying Masks to Canvases
|
||||
|
||||
```python
|
||||
def apply_mask_canvas(canvas, mask, bg_canvas=None):
|
||||
"""Apply a grid-resolution mask to a pixel canvas.
|
||||
Expands mask from (rows, cols) to (VH, VW) via nearest-neighbor.
|
||||
|
||||
canvas: uint8 (VH, VW, 3)
|
||||
mask: float32 (rows, cols) [0,1]
|
||||
bg_canvas: what shows through where mask=0. None = black.
|
||||
"""
|
||||
# Expand mask to pixel resolution
|
||||
mask_px = np.repeat(np.repeat(mask, canvas.shape[0] // mask.shape[0] + 1, axis=0),
|
||||
canvas.shape[1] // mask.shape[1] + 1, axis=1)
|
||||
mask_px = mask_px[:canvas.shape[0], :canvas.shape[1]]
|
||||
|
||||
if bg_canvas is not None:
|
||||
return np.clip(canvas * mask_px[:, :, None] +
|
||||
bg_canvas * (1 - mask_px[:, :, None]), 0, 255).astype(np.uint8)
|
||||
return np.clip(canvas * mask_px[:, :, None], 0, 255).astype(np.uint8)
|
||||
|
||||
def apply_mask_vf(vf_a, vf_b, mask):
|
||||
"""Apply mask at value-field level — blend two value fields spatially.
|
||||
All arrays are (rows, cols) float32."""
|
||||
return vf_a * mask + vf_b * (1 - mask)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## PixelBlendStack
|
||||
|
||||
Higher-level wrapper for multi-layer compositing:
|
||||
|
||||
```python
|
||||
class PixelBlendStack:
|
||||
def __init__(self):
|
||||
self.layers = []
|
||||
|
||||
def add(self, canvas, mode="normal", opacity=1.0):
|
||||
self.layers.append((canvas, mode, opacity))
|
||||
return self
|
||||
|
||||
def composite(self):
|
||||
if not self.layers:
|
||||
return np.zeros((VH, VW, 3), dtype=np.uint8)
|
||||
result = self.layers[0][0]
|
||||
for canvas, mode, opacity in self.layers[1:]:
|
||||
result = blend_canvas(result, canvas, mode, opacity)
|
||||
return result
|
||||
```
|
||||
|
||||
## Text Backdrop (Readability Mask)
|
||||
|
||||
When placing readable text over busy multi-grid ASCII backgrounds, the text will blend into the background and become illegible. **Always apply a dark backdrop behind text regions.**
|
||||
|
||||
The technique: compute the bounding box of all text glyphs, create a gaussian-blurred dark mask covering that area with padding, and multiply the background by `(1 - mask * darkness)` before rendering text on top.
|
||||
|
||||
```python
|
||||
from scipy.ndimage import gaussian_filter
|
||||
|
||||
def apply_text_backdrop(canvas, glyphs, padding=80, darkness=0.75):
|
||||
"""Darken the background behind text for readability.
|
||||
|
||||
Call AFTER rendering background, BEFORE rendering text.
|
||||
|
||||
Args:
|
||||
canvas: (VH, VW, 3) uint8 background
|
||||
glyphs: list of {"x": float, "y": float, ...} glyph positions
|
||||
padding: pixel padding around text bounding box
|
||||
darkness: 0.0 = no darkening, 1.0 = fully black
|
||||
Returns:
|
||||
darkened canvas (uint8)
|
||||
"""
|
||||
if not glyphs:
|
||||
return canvas
|
||||
xs = [g['x'] for g in glyphs]
|
||||
ys = [g['y'] for g in glyphs]
|
||||
x0 = max(0, int(min(xs)) - padding)
|
||||
y0 = max(0, int(min(ys)) - padding)
|
||||
x1 = min(VW, int(max(xs)) + padding + 50) # extra for char width
|
||||
y1 = min(VH, int(max(ys)) + padding + 60) # extra for char height
|
||||
|
||||
# Soft dark mask with gaussian blur for feathered edges
|
||||
mask = np.zeros((VH, VW), dtype=np.float32)
|
||||
mask[y0:y1, x0:x1] = 1.0
|
||||
mask = gaussian_filter(mask, sigma=padding * 0.6)
|
||||
|
||||
factor = 1.0 - mask * darkness
|
||||
return (canvas.astype(np.float32) * factor[:, :, np.newaxis]).astype(np.uint8)
|
||||
```
|
||||
|
||||
### Usage in render pipeline
|
||||
|
||||
Insert between background rendering and text rendering:
|
||||
|
||||
```python
|
||||
# 1. Render background (multi-grid ASCII effects)
|
||||
bg = render_background(cfg, t)
|
||||
|
||||
# 2. Darken behind text region
|
||||
bg = apply_text_backdrop(bg, frame_glyphs, padding=80, darkness=0.75)
|
||||
|
||||
# 3. Render text on top (now readable against dark backdrop)
|
||||
bg = text_renderer.render(bg, frame_glyphs, color=(255, 255, 255))
|
||||
```
|
||||
|
||||
Combine with **reverse vignette** (see shaders.md) for scenes where text is always centered — the reverse vignette provides a persistent center-dark zone, while the backdrop handles per-frame glyph positions.
|
||||
|
||||
## External Layout Oracle Pattern
|
||||
|
||||
For text-heavy videos where text needs to dynamically reflow around obstacles (shapes, icons, other text), use an external layout engine to pre-compute glyph positions and feed them into the Python renderer via JSON.
|
||||
|
||||
### Architecture
|
||||
|
||||
```
|
||||
Layout Engine (browser/Node.js) → layouts.json → Python ASCII Renderer
|
||||
↑ ↑
|
||||
Computes per-frame Reads glyph positions,
|
||||
glyph (x,y) positions renders as ASCII chars
|
||||
with obstacle-aware reflow with full effect pipeline
|
||||
```
|
||||
|
||||
### JSON interchange format
|
||||
|
||||
```json
|
||||
{
|
||||
"meta": {
|
||||
"canvas_width": 1080, "canvas_height": 1080,
|
||||
"fps": 24, "total_frames": 1248,
|
||||
"fonts": {
|
||||
"body": {"charW": 12.04, "charH": 24, "fontSize": 20},
|
||||
"hero": {"charW": 24.08, "charH": 48, "fontSize": 40}
|
||||
}
|
||||
},
|
||||
"scenes": [
|
||||
{
|
||||
"id": "scene_name",
|
||||
"start_frame": 0, "end_frame": 96,
|
||||
"frames": {
|
||||
"0": {
|
||||
"glyphs": [
|
||||
{"char": "H", "x": 287.1, "y": 400.0, "alpha": 1.0},
|
||||
{"char": "e", "x": 311.2, "y": 400.0, "alpha": 1.0}
|
||||
],
|
||||
"obstacles": [
|
||||
{"type": "circle", "cx": 540, "cy": 540, "r": 80},
|
||||
{"type": "rect", "x": 300, "y": 500, "w": 120, "h": 80}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### When to use
|
||||
|
||||
- Text that dynamically reflows around moving objects
|
||||
- Per-glyph animation (reveal, scatter, physics)
|
||||
- Variable typography that needs precise measurement
|
||||
- Any case where Python's Pillow text layout is insufficient
|
||||
|
||||
### When NOT to use
|
||||
|
||||
- Static centered text (just use PIL `draw.text()` directly)
|
||||
- Text that only fades in/out without spatial animation
|
||||
- Simple typewriter effects (handle in Python with a character counter)
|
||||
|
||||
### Running the oracle
|
||||
|
||||
Use Playwright to run the layout engine in a headless browser:
|
||||
|
||||
```javascript
|
||||
// extract.mjs
|
||||
import { chromium } from 'playwright';
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const page = await browser.newPage();
|
||||
await page.goto(`file://${oraclePath}`);
|
||||
await page.waitForFunction(() => window.__ORACLE_DONE__ === true, null, { timeout: 60000 });
|
||||
const result = await page.evaluate(() => window.__ORACLE_RESULT__);
|
||||
writeFileSync('layouts.json', JSON.stringify(result));
|
||||
await browser.close();
|
||||
```
|
||||
|
||||
### Consuming in Python
|
||||
|
||||
```python
|
||||
# In the renderer, map pixel positions to the canvas:
|
||||
for glyph in frame_data['glyphs']:
|
||||
char, px, py = glyph['char'], glyph['x'], glyph['y']
|
||||
alpha = glyph.get('alpha', 1.0)
|
||||
# Render using PIL draw.text() at exact pixel position
|
||||
draw.text((px, py), char, fill=(int(255*alpha),)*3, font=font)
|
||||
```
|
||||
|
||||
Obstacles from the JSON can also be rendered as glowing ASCII shapes (circles, rectangles) to visualize the reflow zones.
|
||||
1865
skills/creative/ascii-video/references/effects.md
Normal file
1865
skills/creative/ascii-video/references/effects.md
Normal file
File diff suppressed because it is too large
Load Diff
685
skills/creative/ascii-video/references/inputs.md
Normal file
685
skills/creative/ascii-video/references/inputs.md
Normal file
@@ -0,0 +1,685 @@
|
||||
# Input Sources
|
||||
|
||||
> **See also:** architecture.md · effects.md · scenes.md · shaders.md · optimization.md · troubleshooting.md
|
||||
|
||||
## Audio Analysis
|
||||
|
||||
### Loading
|
||||
|
||||
```python
|
||||
tmp = tempfile.mktemp(suffix=".wav")
|
||||
subprocess.run(["ffmpeg", "-y", "-i", input_path, "-ac", "1", "-ar", "22050",
|
||||
"-sample_fmt", "s16", tmp], capture_output=True, check=True)
|
||||
with wave.open(tmp) as wf:
|
||||
sr = wf.getframerate()
|
||||
raw = wf.readframes(wf.getnframes())
|
||||
samples = np.frombuffer(raw, dtype=np.int16).astype(np.float32) / 32768.0
|
||||
```
|
||||
|
||||
### Per-Frame FFT
|
||||
|
||||
```python
|
||||
hop = sr // fps # samples per frame
|
||||
win = hop * 2 # analysis window (2x hop for overlap)
|
||||
window = np.hanning(win)
|
||||
freqs = rfftfreq(win, 1.0 / sr)
|
||||
|
||||
bands = {
|
||||
"sub": (freqs >= 20) & (freqs < 80),
|
||||
"bass": (freqs >= 80) & (freqs < 250),
|
||||
"lomid": (freqs >= 250) & (freqs < 500),
|
||||
"mid": (freqs >= 500) & (freqs < 2000),
|
||||
"himid": (freqs >= 2000)& (freqs < 6000),
|
||||
"hi": (freqs >= 6000),
|
||||
}
|
||||
```
|
||||
|
||||
For each frame: extract chunk, apply window, FFT, compute band energies.
|
||||
|
||||
### Feature Set
|
||||
|
||||
| Feature | Formula | Controls |
|
||||
|---------|---------|----------|
|
||||
| `rms` | `sqrt(mean(chunk²))` | Overall loudness/energy |
|
||||
| `sub`..`hi` | `sqrt(mean(band_magnitudes²))` | Per-band energy |
|
||||
| `centroid` | `sum(freq*mag) / sum(mag)` | Brightness/timbre |
|
||||
| `flatness` | `geomean(mag) / mean(mag)` | Noise vs tone |
|
||||
| `flux` | `sum(max(0, mag - prev_mag))` | Transient strength |
|
||||
| `sub_r`..`hi_r` | `band / sum(all_bands)` | Spectral shape (volume-independent) |
|
||||
| `cent_d` | `abs(gradient(centroid))` | Timbral change rate |
|
||||
| `beat` | Flux peak detection | Binary beat onset |
|
||||
| `bdecay` | Exponential decay from beats | Smooth beat pulse (0→1→0) |
|
||||
|
||||
**Band ratios are critical** — they decouple spectral shape from volume, so a quiet bass section and a loud bass section both read as "bassy" rather than just "loud" vs "quiet".
|
||||
|
||||
### Smoothing
|
||||
|
||||
EMA prevents visual jitter:
|
||||
|
||||
```python
|
||||
def ema(arr, alpha):
|
||||
out = np.empty_like(arr); out[0] = arr[0]
|
||||
for i in range(1, len(arr)):
|
||||
out[i] = alpha * arr[i] + (1 - alpha) * out[i-1]
|
||||
return out
|
||||
|
||||
# Slow-moving features (alpha=0.12): centroid, flatness, band ratios, cent_d
|
||||
# Fast-moving features (alpha=0.3): rms, flux, raw bands
|
||||
```
|
||||
|
||||
### Beat Detection
|
||||
|
||||
```python
|
||||
flux_smooth = np.convolve(flux, np.ones(5)/5, mode="same")
|
||||
peaks, _ = signal.find_peaks(flux_smooth, height=0.15, distance=fps//5, prominence=0.05)
|
||||
|
||||
beat = np.zeros(n_frames)
|
||||
bdecay = np.zeros(n_frames, dtype=np.float32)
|
||||
for p in peaks:
|
||||
beat[p] = 1.0
|
||||
for d in range(fps // 2):
|
||||
if p + d < n_frames:
|
||||
bdecay[p + d] = max(bdecay[p + d], math.exp(-d * 2.5 / (fps // 2)))
|
||||
```
|
||||
|
||||
`bdecay` gives smooth 0→1→0 pulse per beat, decaying over ~0.5s. Use for flash/glitch/mirror triggers.
|
||||
|
||||
### Normalization
|
||||
|
||||
After computing all frames, normalize each feature to 0-1:
|
||||
|
||||
```python
|
||||
for k in features:
|
||||
a = features[k]
|
||||
lo, hi = a.min(), a.max()
|
||||
features[k] = (a - lo) / (hi - lo + 1e-10)
|
||||
```
|
||||
|
||||
## Video Sampling
|
||||
|
||||
### Frame Extraction
|
||||
|
||||
```python
|
||||
# Method 1: ffmpeg pipe (memory efficient)
|
||||
cmd = ["ffmpeg", "-i", input_video, "-f", "rawvideo", "-pix_fmt", "rgb24",
|
||||
"-s", f"{target_w}x{target_h}", "-r", str(fps), "-"]
|
||||
pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
||||
frame_size = target_w * target_h * 3
|
||||
for fi in range(n_frames):
|
||||
raw = pipe.stdout.read(frame_size)
|
||||
if len(raw) < frame_size: break
|
||||
frame = np.frombuffer(raw, dtype=np.uint8).reshape(target_h, target_w, 3)
|
||||
# process frame...
|
||||
|
||||
# Method 2: OpenCV (if available)
|
||||
cap = cv2.VideoCapture(input_video)
|
||||
```
|
||||
|
||||
### Luminance-to-Character Mapping
|
||||
|
||||
Convert video pixels to ASCII characters based on brightness:
|
||||
|
||||
```python
|
||||
def frame_to_ascii(frame_rgb, grid, pal=PAL_DEFAULT):
|
||||
"""Convert video frame to character + color arrays."""
|
||||
rows, cols = grid.rows, grid.cols
|
||||
# Resize frame to grid dimensions
|
||||
small = np.array(Image.fromarray(frame_rgb).resize((cols, rows), Image.LANCZOS))
|
||||
# Luminance
|
||||
lum = (0.299 * small[:,:,0] + 0.587 * small[:,:,1] + 0.114 * small[:,:,2]) / 255.0
|
||||
# Map to chars
|
||||
chars = val2char(lum, lum > 0.02, pal)
|
||||
# Colors: use source pixel colors, scaled by luminance for visibility
|
||||
colors = np.clip(small * np.clip(lum[:,:,None] * 1.5 + 0.3, 0.3, 1), 0, 255).astype(np.uint8)
|
||||
return chars, colors
|
||||
```
|
||||
|
||||
### Edge-Weighted Character Mapping
|
||||
|
||||
Use edge detection for more detail in contour regions:
|
||||
|
||||
```python
|
||||
def frame_to_ascii_edges(frame_rgb, grid, pal=PAL_DEFAULT, edge_pal=PAL_BOX):
|
||||
gray = np.mean(frame_rgb, axis=2)
|
||||
small_gray = resize(gray, (grid.rows, grid.cols))
|
||||
lum = small_gray / 255.0
|
||||
|
||||
# Sobel edge detection
|
||||
gx = np.abs(small_gray[:, 2:] - small_gray[:, :-2])
|
||||
gy = np.abs(small_gray[2:, :] - small_gray[:-2, :])
|
||||
edge = np.zeros_like(small_gray)
|
||||
edge[:, 1:-1] += gx; edge[1:-1, :] += gy
|
||||
edge = np.clip(edge / edge.max(), 0, 1)
|
||||
|
||||
# Edge regions get box drawing chars, flat regions get brightness chars
|
||||
is_edge = edge > 0.15
|
||||
chars = val2char(lum, lum > 0.02, pal)
|
||||
edge_chars = val2char(edge, is_edge, edge_pal)
|
||||
chars[is_edge] = edge_chars[is_edge]
|
||||
|
||||
return chars, colors
|
||||
```
|
||||
|
||||
### Motion Detection
|
||||
|
||||
Detect pixel changes between frames for motion-reactive effects:
|
||||
|
||||
```python
|
||||
prev_frame = None
|
||||
def compute_motion(frame):
|
||||
global prev_frame
|
||||
if prev_frame is None:
|
||||
prev_frame = frame.astype(np.float32)
|
||||
return np.zeros(frame.shape[:2])
|
||||
diff = np.abs(frame.astype(np.float32) - prev_frame).mean(axis=2)
|
||||
prev_frame = frame.astype(np.float32) * 0.7 + prev_frame * 0.3 # smoothed
|
||||
return np.clip(diff / 30.0, 0, 1) # normalized motion map
|
||||
```
|
||||
|
||||
Use motion map to drive particle emission, glitch intensity, or character density.
|
||||
|
||||
### Video Feature Extraction
|
||||
|
||||
Per-frame features analogous to audio features, for driving effects:
|
||||
|
||||
```python
|
||||
def analyze_video_frame(frame_rgb):
|
||||
gray = np.mean(frame_rgb, axis=2)
|
||||
return {
|
||||
"brightness": gray.mean() / 255.0,
|
||||
"contrast": gray.std() / 128.0,
|
||||
"edge_density": compute_edge_density(gray),
|
||||
"motion": compute_motion(frame_rgb).mean(),
|
||||
"dominant_hue": compute_dominant_hue(frame_rgb),
|
||||
"color_variance": compute_color_variance(frame_rgb),
|
||||
}
|
||||
```
|
||||
|
||||
## Image Sequence
|
||||
|
||||
### Static Image to ASCII
|
||||
|
||||
Same as single video frame conversion. For animated sequences:
|
||||
|
||||
```python
|
||||
import glob
|
||||
frames = sorted(glob.glob("frames/*.png"))
|
||||
for fi, path in enumerate(frames):
|
||||
img = np.array(Image.open(path).resize((VW, VH)))
|
||||
chars, colors = frame_to_ascii(img, grid, pal)
|
||||
```
|
||||
|
||||
### Image as Texture Source
|
||||
|
||||
Use an image as a background texture that effects modulate:
|
||||
|
||||
```python
|
||||
def load_texture(path, grid):
|
||||
img = np.array(Image.open(path).resize((grid.cols, grid.rows)))
|
||||
lum = np.mean(img, axis=2) / 255.0
|
||||
return lum, img # luminance for char mapping, RGB for colors
|
||||
```
|
||||
|
||||
## Text / Lyrics
|
||||
|
||||
### SRT Parsing
|
||||
|
||||
```python
|
||||
import re
|
||||
def parse_srt(path):
|
||||
"""Returns [(start_sec, end_sec, text), ...]"""
|
||||
entries = []
|
||||
with open(path) as f:
|
||||
content = f.read()
|
||||
blocks = content.strip().split("\n\n")
|
||||
for block in blocks:
|
||||
lines = block.strip().split("\n")
|
||||
if len(lines) >= 3:
|
||||
times = lines[1]
|
||||
m = re.match(r"(\d+):(\d+):(\d+),(\d+) --> (\d+):(\d+):(\d+),(\d+)", times)
|
||||
if m:
|
||||
g = [int(x) for x in m.groups()]
|
||||
start = g[0]*3600 + g[1]*60 + g[2] + g[3]/1000
|
||||
end = g[4]*3600 + g[5]*60 + g[6] + g[7]/1000
|
||||
text = " ".join(lines[2:])
|
||||
entries.append((start, end, text))
|
||||
return entries
|
||||
```
|
||||
|
||||
### Lyrics Display Modes
|
||||
|
||||
- **Typewriter**: characters appear left-to-right over the time window
|
||||
- **Fade-in**: whole line fades from dark to bright
|
||||
- **Flash**: appear instantly on beat, fade out
|
||||
- **Scatter**: characters start at random positions, converge to final position
|
||||
- **Wave**: text follows a sine wave path
|
||||
|
||||
```python
|
||||
def lyrics_typewriter(ch, co, text, row, col, t, t_start, t_end, color):
|
||||
"""Reveal characters progressively over time window."""
|
||||
progress = np.clip((t - t_start) / (t_end - t_start), 0, 1)
|
||||
n_visible = int(len(text) * progress)
|
||||
stamp(ch, co, text[:n_visible], row, col, color)
|
||||
```
|
||||
|
||||
## Generative (No Input)
|
||||
|
||||
For pure generative ASCII art, the "features" dict is synthesized from time:
|
||||
|
||||
```python
|
||||
def synthetic_features(t, bpm=120):
|
||||
"""Generate audio-like features from time alone."""
|
||||
beat_period = 60.0 / bpm
|
||||
beat_phase = (t % beat_period) / beat_period
|
||||
return {
|
||||
"rms": 0.5 + 0.3 * math.sin(t * 0.5),
|
||||
"bass": 0.5 + 0.4 * math.sin(t * 2 * math.pi / beat_period),
|
||||
"sub": 0.3 + 0.3 * math.sin(t * 0.8),
|
||||
"mid": 0.4 + 0.3 * math.sin(t * 1.3),
|
||||
"hi": 0.3 + 0.2 * math.sin(t * 2.1),
|
||||
"cent": 0.5 + 0.2 * math.sin(t * 0.3),
|
||||
"flat": 0.4,
|
||||
"flux": 0.3 + 0.2 * math.sin(t * 3),
|
||||
"beat": 1.0 if beat_phase < 0.05 else 0.0,
|
||||
"bdecay": max(0, 1.0 - beat_phase * 4),
|
||||
# ratios
|
||||
"sub_r": 0.2, "bass_r": 0.25, "lomid_r": 0.15,
|
||||
"mid_r": 0.2, "himid_r": 0.12, "hi_r": 0.08,
|
||||
"cent_d": 0.1,
|
||||
}
|
||||
```
|
||||
|
||||
## TTS Integration
|
||||
|
||||
For narrated videos (testimonials, quotes, storytelling), generate speech audio per segment and mix with background music.
|
||||
|
||||
### ElevenLabs Voice Generation
|
||||
|
||||
```python
|
||||
import requests, time, os
|
||||
|
||||
def generate_tts(text, voice_id, api_key, output_path, model="eleven_multilingual_v2"):
|
||||
"""Generate TTS audio via ElevenLabs API. Streams response to disk."""
|
||||
# Skip if already generated (idempotent re-runs)
|
||||
if os.path.exists(output_path) and os.path.getsize(output_path) > 1000:
|
||||
return
|
||||
|
||||
url = f"https://api.elevenlabs.io/v1/text-to-speech/{voice_id}"
|
||||
headers = {"xi-api-key": api_key, "Content-Type": "application/json"}
|
||||
data = {
|
||||
"text": text,
|
||||
"model_id": model,
|
||||
"voice_settings": {
|
||||
"stability": 0.65,
|
||||
"similarity_boost": 0.80,
|
||||
"style": 0.15,
|
||||
"use_speaker_boost": True,
|
||||
},
|
||||
}
|
||||
resp = requests.post(url, json=data, headers=headers, stream=True)
|
||||
resp.raise_for_status()
|
||||
with open(output_path, "wb") as f:
|
||||
for chunk in resp.iter_content(chunk_size=4096):
|
||||
f.write(chunk)
|
||||
time.sleep(0.3) # rate limit: avoid 429s on batch generation
|
||||
```
|
||||
|
||||
Voice settings notes:
|
||||
- `stability` 0.65 gives natural variation without drift. Lower (0.3-0.5) for more expressive reads, higher (0.7-0.9) for monotone/narration.
|
||||
- `similarity_boost` 0.80 keeps it close to the voice profile. Lower for more generic sound.
|
||||
- `style` 0.15 adds slight stylistic variation. Keep low (0-0.2) for straightforward reads.
|
||||
- `use_speaker_boost` True improves clarity at the cost of slightly more processing time.
|
||||
|
||||
### Voice Pool
|
||||
|
||||
ElevenLabs has ~20 built-in voices. Use multiple voices for variety across quotes. Reference pool:
|
||||
|
||||
```python
|
||||
VOICE_POOL = [
|
||||
("JBFqnCBsd6RMkjVDRZzb", "George"),
|
||||
("nPczCjzI2devNBz1zQrb", "Brian"),
|
||||
("pqHfZKP75CvOlQylNhV4", "Bill"),
|
||||
("CwhRBWXzGAHq8TQ4Fs17", "Roger"),
|
||||
("cjVigY5qzO86Huf0OWal", "Eric"),
|
||||
("onwK4e9ZLuTAKqWW03F9", "Daniel"),
|
||||
("IKne3meq5aSn9XLyUdCD", "Charlie"),
|
||||
("iP95p4xoKVk53GoZ742B", "Chris"),
|
||||
("bIHbv24MWmeRgasZH58o", "Will"),
|
||||
("TX3LPaxmHKxFdv7VOQHJ", "Liam"),
|
||||
("SAz9YHcvj6GT2YYXdXww", "River"),
|
||||
("EXAVITQu4vr4xnSDxMaL", "Sarah"),
|
||||
("Xb7hH8MSUJpSbSDYk0k2", "Alice"),
|
||||
("pFZP5JQG7iQjIQuC4Bku", "Lily"),
|
||||
("XrExE9yKIg1WjnnlVkGX", "Matilda"),
|
||||
("FGY2WhTYpPnrIDTdsKH5", "Laura"),
|
||||
("SOYHLrjzK2X1ezoPC6cr", "Harry"),
|
||||
("hpp4J3VqNfWAUOO0d1Us", "Bella"),
|
||||
("N2lVS1w4EtoT3dr4eOWO", "Callum"),
|
||||
("cgSgspJ2msm6clMCkdW9", "Jessica"),
|
||||
("pNInz6obpgDQGcFmaJgB", "Adam"),
|
||||
]
|
||||
```
|
||||
|
||||
### Voice Assignment
|
||||
|
||||
Shuffle deterministically so re-runs produce the same voice mapping:
|
||||
|
||||
```python
|
||||
import random as _rng
|
||||
|
||||
def assign_voices(n_quotes, voice_pool, seed=42):
|
||||
"""Assign a different voice to each quote, cycling if needed."""
|
||||
r = _rng.Random(seed)
|
||||
ids = [v[0] for v in voice_pool]
|
||||
r.shuffle(ids)
|
||||
return [ids[i % len(ids)] for i in range(n_quotes)]
|
||||
```
|
||||
|
||||
### Pronunciation Control
|
||||
|
||||
TTS text must be separate from display text. The display text has line breaks for visual layout; the TTS text is a flat sentence with phonetic fixes.
|
||||
|
||||
Common fixes:
|
||||
- Brand names: spell phonetically ("Nous" -> "Noose", "nginx" -> "engine-x")
|
||||
- Abbreviations: expand ("API" -> "A P I", "CLI" -> "C L I")
|
||||
- Technical terms: add phonetic hints
|
||||
- Punctuation for pacing: periods create pauses, commas create slight pauses
|
||||
|
||||
```python
|
||||
# Display text: line breaks control visual layout
|
||||
QUOTES = [
|
||||
("It can do far more than the Claws,\nand you don't need to buy a Mac Mini.\nNous Research has a winner here.", "Brian Roemmele"),
|
||||
]
|
||||
|
||||
# TTS text: flat, phonetically corrected for speech
|
||||
QUOTES_TTS = [
|
||||
"It can do far more than the Claws, and you don't need to buy a Mac Mini. Noose Research has a winner here.",
|
||||
]
|
||||
# Keep both arrays in sync -- same indices
|
||||
```
|
||||
|
||||
### Audio Pipeline
|
||||
|
||||
1. Generate individual TTS clips (MP3 per quote, skipping existing)
|
||||
2. Convert each to WAV (mono, 22050 Hz) for duration measurement and concatenation
|
||||
3. Calculate timing: intro pad + speech + gaps + outro pad = target duration
|
||||
4. Concatenate into single TTS track with silence padding
|
||||
5. Mix with background music
|
||||
|
||||
```python
|
||||
def build_tts_track(tts_clips, target_duration, intro_pad=5.0, outro_pad=4.0):
|
||||
"""Concatenate TTS clips with calculated gaps, pad to target duration.
|
||||
|
||||
Returns:
|
||||
timing: list of (start_time, end_time, quote_index) tuples
|
||||
"""
|
||||
sr = 22050
|
||||
|
||||
# Convert MP3s to WAV for duration and sample-level concatenation
|
||||
durations = []
|
||||
for clip in tts_clips:
|
||||
wav = clip.replace(".mp3", ".wav")
|
||||
subprocess.run(
|
||||
["ffmpeg", "-y", "-i", clip, "-ac", "1", "-ar", str(sr),
|
||||
"-sample_fmt", "s16", wav],
|
||||
capture_output=True, check=True)
|
||||
result = subprocess.run(
|
||||
["ffprobe", "-v", "error", "-show_entries", "format=duration",
|
||||
"-of", "csv=p=0", wav],
|
||||
capture_output=True, text=True)
|
||||
durations.append(float(result.stdout.strip()))
|
||||
|
||||
# Calculate gap to fill target duration
|
||||
total_speech = sum(durations)
|
||||
n_gaps = len(tts_clips) - 1
|
||||
remaining = target_duration - total_speech - intro_pad - outro_pad
|
||||
gap = max(1.0, remaining / max(1, n_gaps))
|
||||
|
||||
# Build timing and concatenate samples
|
||||
timing = []
|
||||
t = intro_pad
|
||||
all_audio = [np.zeros(int(sr * intro_pad), dtype=np.int16)]
|
||||
|
||||
for i, dur in enumerate(durations):
|
||||
wav = tts_clips[i].replace(".mp3", ".wav")
|
||||
with wave.open(wav) as wf:
|
||||
samples = np.frombuffer(wf.readframes(wf.getnframes()), dtype=np.int16)
|
||||
timing.append((t, t + dur, i))
|
||||
all_audio.append(samples)
|
||||
t += dur
|
||||
if i < len(tts_clips) - 1:
|
||||
all_audio.append(np.zeros(int(sr * gap), dtype=np.int16))
|
||||
t += gap
|
||||
|
||||
all_audio.append(np.zeros(int(sr * outro_pad), dtype=np.int16))
|
||||
|
||||
# Pad or trim to exactly target_duration
|
||||
full = np.concatenate(all_audio)
|
||||
target_samples = int(sr * target_duration)
|
||||
if len(full) < target_samples:
|
||||
full = np.pad(full, (0, target_samples - len(full)))
|
||||
else:
|
||||
full = full[:target_samples]
|
||||
|
||||
# Write concatenated TTS track
|
||||
with wave.open("tts_full.wav", "w") as wf:
|
||||
wf.setnchannels(1)
|
||||
wf.setsampwidth(2)
|
||||
wf.setframerate(sr)
|
||||
wf.writeframes(full.tobytes())
|
||||
|
||||
return timing
|
||||
```
|
||||
|
||||
### Audio Mixing
|
||||
|
||||
Mix TTS (center) with background music (wide stereo, low volume). The filter chain:
|
||||
1. TTS mono duplicated to both channels (centered)
|
||||
2. BGM loudness-normalized, volume reduced to 15%, stereo widened with `extrastereo`
|
||||
3. Mixed together with dropout transition for smooth endings
|
||||
|
||||
```python
|
||||
def mix_audio(tts_path, bgm_path, output_path, bgm_volume=0.15):
|
||||
"""Mix TTS centered with BGM panned wide stereo."""
|
||||
filter_complex = (
|
||||
# TTS: mono -> stereo center
|
||||
"[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=mono,"
|
||||
"pan=stereo|c0=c0|c1=c0[tts];"
|
||||
# BGM: normalize loudness, reduce volume, widen stereo
|
||||
f"[1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,"
|
||||
f"loudnorm=I=-16:TP=-1.5:LRA=11,"
|
||||
f"volume={bgm_volume},"
|
||||
f"extrastereo=m=2.5[bgm];"
|
||||
# Mix with smooth dropout at end
|
||||
"[tts][bgm]amix=inputs=2:duration=longest:dropout_transition=3,"
|
||||
"aformat=sample_fmts=s16:sample_rates=44100:channel_layouts=stereo[out]"
|
||||
)
|
||||
cmd = [
|
||||
"ffmpeg", "-y",
|
||||
"-i", tts_path,
|
||||
"-i", bgm_path,
|
||||
"-filter_complex", filter_complex,
|
||||
"-map", "[out]", output_path,
|
||||
]
|
||||
subprocess.run(cmd, capture_output=True, check=True)
|
||||
```
|
||||
|
||||
### Per-Quote Visual Style
|
||||
|
||||
Cycle through visual presets per quote for variety. Each preset defines a background effect, color scheme, and text color:
|
||||
|
||||
```python
|
||||
QUOTE_STYLES = [
|
||||
{"hue": 0.08, "accent": 0.7, "bg": "spiral", "text_rgb": (255, 220, 140)}, # warm gold
|
||||
{"hue": 0.55, "accent": 0.6, "bg": "rings", "text_rgb": (180, 220, 255)}, # cool blue
|
||||
{"hue": 0.75, "accent": 0.7, "bg": "wave", "text_rgb": (220, 180, 255)}, # purple
|
||||
{"hue": 0.35, "accent": 0.6, "bg": "matrix", "text_rgb": (140, 255, 180)}, # green
|
||||
{"hue": 0.95, "accent": 0.8, "bg": "fire", "text_rgb": (255, 180, 160)}, # red/coral
|
||||
{"hue": 0.12, "accent": 0.5, "bg": "interference", "text_rgb": (255, 240, 200)}, # amber
|
||||
{"hue": 0.60, "accent": 0.7, "bg": "tunnel", "text_rgb": (160, 210, 255)}, # cyan
|
||||
{"hue": 0.45, "accent": 0.6, "bg": "aurora", "text_rgb": (180, 255, 220)}, # teal
|
||||
]
|
||||
|
||||
style = QUOTE_STYLES[quote_index % len(QUOTE_STYLES)]
|
||||
```
|
||||
|
||||
This guarantees no two adjacent quotes share the same look, even without randomness.
|
||||
|
||||
### Typewriter Text Rendering
|
||||
|
||||
Display quote text character-by-character synced to speech progress. Recently revealed characters are brighter, creating a "just typed" glow:
|
||||
|
||||
```python
|
||||
def render_typewriter(ch, co, lines, block_start, cols, progress, total_chars, text_rgb, t):
|
||||
"""Overlay typewriter text onto character/color grids.
|
||||
progress: 0.0 (nothing visible) to 1.0 (all text visible)."""
|
||||
chars_visible = int(total_chars * min(1.0, progress * 1.2)) # slight overshoot for snappy feel
|
||||
tr, tg, tb = text_rgb
|
||||
char_count = 0
|
||||
for li, line in enumerate(lines):
|
||||
row = block_start + li
|
||||
col = (cols - len(line)) // 2
|
||||
for ci, c in enumerate(line):
|
||||
if char_count < chars_visible:
|
||||
age = chars_visible - char_count
|
||||
bri_factor = min(1.0, 0.5 + 0.5 / (1 + age * 0.015)) # newer = brighter
|
||||
hue_shift = math.sin(char_count * 0.3 + t * 2) * 0.05
|
||||
stamp(ch, co, c, row, col + ci,
|
||||
(int(min(255, tr * bri_factor * (1.0 + hue_shift))),
|
||||
int(min(255, tg * bri_factor)),
|
||||
int(min(255, tb * bri_factor * (1.0 - hue_shift)))))
|
||||
char_count += 1
|
||||
|
||||
# Blinking cursor at insertion point
|
||||
if progress < 1.0 and int(t * 3) % 2 == 0:
|
||||
# Find cursor position (char_count == chars_visible)
|
||||
cc = 0
|
||||
for li, line in enumerate(lines):
|
||||
for ci, c in enumerate(line):
|
||||
if cc == chars_visible:
|
||||
stamp(ch, co, "\u258c", block_start + li,
|
||||
(cols - len(line)) // 2 + ci, (255, 220, 100))
|
||||
return
|
||||
cc += 1
|
||||
```
|
||||
|
||||
### Feature Analysis on Mixed Audio
|
||||
|
||||
Run the standard audio analysis (FFT, beat detection) on the final mixed track so visual effects react to both TTS and music:
|
||||
|
||||
```python
|
||||
# Analyze mixed_final.wav (not individual tracks)
|
||||
features = analyze_audio("mixed_final.wav", fps=24)
|
||||
```
|
||||
|
||||
Visuals pulse with both the music beats and the speech energy.
|
||||
|
||||
---
|
||||
|
||||
## Audio-Video Sync Verification
|
||||
|
||||
After rendering, verify that visual beat markers align with actual audio beats. Drift accumulates from frame timing errors, ffmpeg concat boundaries, and rounding in `fi / fps`.
|
||||
|
||||
### Beat Timestamp Extraction
|
||||
|
||||
```python
|
||||
def extract_beat_timestamps(features, fps, threshold=0.5):
|
||||
"""Extract timestamps where beat feature exceeds threshold."""
|
||||
beat = features["beat"]
|
||||
timestamps = []
|
||||
for fi in range(len(beat)):
|
||||
if beat[fi] > threshold:
|
||||
timestamps.append(fi / fps)
|
||||
return timestamps
|
||||
|
||||
def extract_visual_beat_timestamps(video_path, fps, brightness_jump=30):
|
||||
"""Detect visual beats by brightness jumps between consecutive frames.
|
||||
Returns timestamps where mean brightness increases by more than threshold."""
|
||||
import subprocess
|
||||
cmd = ["ffmpeg", "-i", video_path, "-f", "rawvideo", "-pix_fmt", "gray", "-"]
|
||||
proc = subprocess.run(cmd, capture_output=True)
|
||||
frames = np.frombuffer(proc.stdout, dtype=np.uint8)
|
||||
# Infer frame dimensions from total byte count
|
||||
n_pixels = len(frames)
|
||||
# For 1080p: 1920*1080 pixels per frame
|
||||
# Auto-detect from video metadata is more robust:
|
||||
probe = subprocess.run(
|
||||
["ffprobe", "-v", "error", "-select_streams", "v:0",
|
||||
"-show_entries", "stream=width,height",
|
||||
"-of", "csv=p=0", video_path],
|
||||
capture_output=True, text=True)
|
||||
w, h = map(int, probe.stdout.strip().split(","))
|
||||
ppf = w * h # pixels per frame
|
||||
n_frames = n_pixels // ppf
|
||||
frames = frames[:n_frames * ppf].reshape(n_frames, ppf)
|
||||
means = frames.mean(axis=1)
|
||||
|
||||
timestamps = []
|
||||
for i in range(1, len(means)):
|
||||
if means[i] - means[i-1] > brightness_jump:
|
||||
timestamps.append(i / fps)
|
||||
return timestamps
|
||||
```
|
||||
|
||||
### Sync Report
|
||||
|
||||
```python
|
||||
def sync_report(audio_beats, visual_beats, tolerance_ms=50):
|
||||
"""Compare audio beat timestamps to visual beat timestamps.
|
||||
|
||||
Args:
|
||||
audio_beats: list of timestamps (seconds) from audio analysis
|
||||
visual_beats: list of timestamps (seconds) from video brightness analysis
|
||||
tolerance_ms: max acceptable drift in milliseconds
|
||||
|
||||
Returns:
|
||||
dict with matched/unmatched/drift statistics
|
||||
"""
|
||||
tolerance = tolerance_ms / 1000.0
|
||||
matched = []
|
||||
unmatched_audio = []
|
||||
unmatched_visual = list(visual_beats)
|
||||
|
||||
for at in audio_beats:
|
||||
best_match = None
|
||||
best_delta = float("inf")
|
||||
for vt in unmatched_visual:
|
||||
delta = abs(at - vt)
|
||||
if delta < best_delta:
|
||||
best_delta = delta
|
||||
best_match = vt
|
||||
if best_match is not None and best_delta < tolerance:
|
||||
matched.append({"audio": at, "visual": best_match, "drift_ms": best_delta * 1000})
|
||||
unmatched_visual.remove(best_match)
|
||||
else:
|
||||
unmatched_audio.append(at)
|
||||
|
||||
drifts = [m["drift_ms"] for m in matched]
|
||||
return {
|
||||
"matched": len(matched),
|
||||
"unmatched_audio": len(unmatched_audio),
|
||||
"unmatched_visual": len(unmatched_visual),
|
||||
"total_audio_beats": len(audio_beats),
|
||||
"total_visual_beats": len(visual_beats),
|
||||
"mean_drift_ms": np.mean(drifts) if drifts else 0,
|
||||
"max_drift_ms": np.max(drifts) if drifts else 0,
|
||||
"p95_drift_ms": np.percentile(drifts, 95) if len(drifts) > 1 else 0,
|
||||
}
|
||||
|
||||
# Usage:
|
||||
audio_beats = extract_beat_timestamps(features, fps=24)
|
||||
visual_beats = extract_visual_beat_timestamps("output.mp4", fps=24)
|
||||
report = sync_report(audio_beats, visual_beats)
|
||||
print(f"Matched: {report['matched']}/{report['total_audio_beats']} beats")
|
||||
print(f"Mean drift: {report['mean_drift_ms']:.1f}ms, Max: {report['max_drift_ms']:.1f}ms")
|
||||
# Target: mean drift < 20ms, max drift < 42ms (1 frame at 24fps)
|
||||
```
|
||||
|
||||
### Common Sync Issues
|
||||
|
||||
| Symptom | Cause | Fix |
|
||||
|---------|-------|-----|
|
||||
| Consistent late visual beats | ffmpeg concat adds frames at boundaries | Use `-vsync cfr` flag; pad segments to exact frame count |
|
||||
| Drift increases over time | Floating-point accumulation in `t = fi / fps` | Use integer frame counter, compute `t` fresh each frame |
|
||||
| Random missed beats | Beat threshold too high / feature smoothing too aggressive | Lower threshold; reduce EMA alpha for beat feature |
|
||||
| Beats land on wrong frame | Off-by-one in frame indexing | Verify: frame 0 = t=0, frame 1 = t=1/fps (not t=0) |
|
||||
688
skills/creative/ascii-video/references/optimization.md
Normal file
688
skills/creative/ascii-video/references/optimization.md
Normal file
@@ -0,0 +1,688 @@
|
||||
# Optimization Reference
|
||||
|
||||
> **See also:** architecture.md · composition.md · scenes.md · shaders.md · inputs.md · troubleshooting.md
|
||||
|
||||
## Hardware Detection
|
||||
|
||||
Detect the user's hardware at script startup and adapt rendering parameters automatically. Never hardcode worker counts or resolution.
|
||||
|
||||
### CPU and Memory Detection
|
||||
|
||||
```python
|
||||
import multiprocessing
|
||||
import platform
|
||||
import shutil
|
||||
import os
|
||||
|
||||
def detect_hardware():
|
||||
"""Detect hardware capabilities and return render config."""
|
||||
cpu_count = multiprocessing.cpu_count()
|
||||
|
||||
# Leave 1-2 cores free for OS + ffmpeg encoding
|
||||
if cpu_count >= 16:
|
||||
workers = cpu_count - 2
|
||||
elif cpu_count >= 8:
|
||||
workers = cpu_count - 1
|
||||
elif cpu_count >= 4:
|
||||
workers = cpu_count - 1
|
||||
else:
|
||||
workers = max(1, cpu_count)
|
||||
|
||||
# Memory detection (platform-specific)
|
||||
try:
|
||||
if platform.system() == "Darwin":
|
||||
import subprocess
|
||||
mem_bytes = int(subprocess.check_output(["sysctl", "-n", "hw.memsize"]).strip())
|
||||
elif platform.system() == "Linux":
|
||||
with open("/proc/meminfo") as f:
|
||||
for line in f:
|
||||
if line.startswith("MemTotal"):
|
||||
mem_bytes = int(line.split()[1]) * 1024
|
||||
break
|
||||
else:
|
||||
mem_bytes = 8 * 1024**3 # assume 8GB on unknown
|
||||
except Exception:
|
||||
mem_bytes = 8 * 1024**3
|
||||
|
||||
mem_gb = mem_bytes / (1024**3)
|
||||
|
||||
# Each worker uses ~50-150MB depending on grid sizes
|
||||
# Cap workers if memory is tight
|
||||
mem_per_worker_mb = 150
|
||||
max_workers_by_mem = int(mem_gb * 1024 * 0.6 / mem_per_worker_mb) # use 60% of RAM
|
||||
workers = min(workers, max_workers_by_mem)
|
||||
|
||||
# ffmpeg availability and codec support
|
||||
has_ffmpeg = shutil.which("ffmpeg") is not None
|
||||
|
||||
return {
|
||||
"cpu_count": cpu_count,
|
||||
"workers": workers,
|
||||
"mem_gb": mem_gb,
|
||||
"platform": platform.system(),
|
||||
"arch": platform.machine(),
|
||||
"has_ffmpeg": has_ffmpeg,
|
||||
}
|
||||
```
|
||||
|
||||
### Adaptive Quality Profiles
|
||||
|
||||
Scale resolution, FPS, CRF, and grid density based on hardware:
|
||||
|
||||
```python
|
||||
def quality_profile(hw, target_duration_s, user_preference="auto"):
|
||||
"""
|
||||
Returns render settings adapted to hardware.
|
||||
user_preference: "auto", "draft", "preview", "production", "max"
|
||||
"""
|
||||
if user_preference == "draft":
|
||||
return {"vw": 960, "vh": 540, "fps": 12, "crf": 28, "workers": min(4, hw["workers"]),
|
||||
"grid_scale": 0.5, "shaders": "minimal", "particles_max": 200}
|
||||
|
||||
if user_preference == "preview":
|
||||
return {"vw": 1280, "vh": 720, "fps": 15, "crf": 25, "workers": hw["workers"],
|
||||
"grid_scale": 0.75, "shaders": "standard", "particles_max": 500}
|
||||
|
||||
if user_preference == "max":
|
||||
return {"vw": 3840, "vh": 2160, "fps": 30, "crf": 15, "workers": hw["workers"],
|
||||
"grid_scale": 2.0, "shaders": "full", "particles_max": 3000}
|
||||
|
||||
# "production" or "auto"
|
||||
# Auto-detect: estimate render time, downgrade if it would take too long
|
||||
n_frames = int(target_duration_s * 24)
|
||||
est_seconds_per_frame = 0.18 # ~180ms at 1080p
|
||||
est_total_s = n_frames * est_seconds_per_frame / max(1, hw["workers"])
|
||||
|
||||
if hw["mem_gb"] < 4 or hw["cpu_count"] <= 2:
|
||||
# Low-end: 720p, 15fps
|
||||
return {"vw": 1280, "vh": 720, "fps": 15, "crf": 23, "workers": hw["workers"],
|
||||
"grid_scale": 0.75, "shaders": "standard", "particles_max": 500}
|
||||
|
||||
if est_total_s > 3600: # would take over an hour
|
||||
# Downgrade to 720p to speed up
|
||||
return {"vw": 1280, "vh": 720, "fps": 24, "crf": 20, "workers": hw["workers"],
|
||||
"grid_scale": 0.75, "shaders": "standard", "particles_max": 800}
|
||||
|
||||
# Standard production: 1080p 24fps
|
||||
return {"vw": 1920, "vh": 1080, "fps": 24, "crf": 20, "workers": hw["workers"],
|
||||
"grid_scale": 1.0, "shaders": "full", "particles_max": 1200}
|
||||
|
||||
|
||||
def apply_quality_profile(profile):
|
||||
"""Set globals from quality profile."""
|
||||
global VW, VH, FPS, N_WORKERS
|
||||
VW = profile["vw"]
|
||||
VH = profile["vh"]
|
||||
FPS = profile["fps"]
|
||||
N_WORKERS = profile["workers"]
|
||||
# Grid sizes scale with resolution
|
||||
# CRF passed to ffmpeg encoder
|
||||
# Shader set determines which post-processing is active
|
||||
```
|
||||
|
||||
### CLI Integration
|
||||
|
||||
```python
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--quality", choices=["draft", "preview", "production", "max", "auto"],
|
||||
default="auto", help="Render quality preset")
|
||||
parser.add_argument("--aspect", choices=["landscape", "portrait", "square"],
|
||||
default="landscape", help="Aspect ratio preset")
|
||||
parser.add_argument("--workers", type=int, default=0, help="Override worker count (0=auto)")
|
||||
parser.add_argument("--resolution", type=str, default="", help="Override resolution e.g. 1280x720")
|
||||
args = parser.parse_args()
|
||||
|
||||
hw = detect_hardware()
|
||||
if args.workers > 0:
|
||||
hw["workers"] = args.workers
|
||||
profile = quality_profile(hw, target_duration, args.quality)
|
||||
|
||||
# Apply aspect ratio preset (before manual resolution override)
|
||||
ASPECT_PRESETS = {
|
||||
"landscape": (1920, 1080),
|
||||
"portrait": (1080, 1920),
|
||||
"square": (1080, 1080),
|
||||
}
|
||||
if args.aspect != "landscape" and not args.resolution:
|
||||
profile["vw"], profile["vh"] = ASPECT_PRESETS[args.aspect]
|
||||
|
||||
if args.resolution:
|
||||
w, h = args.resolution.split("x")
|
||||
profile["vw"], profile["vh"] = int(w), int(h)
|
||||
apply_quality_profile(profile)
|
||||
|
||||
log(f"Hardware: {hw['cpu_count']} cores, {hw['mem_gb']:.1f}GB RAM, {hw['platform']}")
|
||||
log(f"Render: {profile['vw']}x{profile['vh']} @{profile['fps']}fps, "
|
||||
f"CRF {profile['crf']}, {profile['workers']} workers")
|
||||
```
|
||||
|
||||
### Portrait Mode Considerations
|
||||
|
||||
Portrait (1080x1920) has the same pixel count as landscape 1080p, so performance is equivalent. But composition patterns differ:
|
||||
|
||||
| Concern | Landscape | Portrait |
|
||||
|---------|-----------|----------|
|
||||
| Grid cols at `lg` | 160 | 90 |
|
||||
| Grid rows at `lg` | 45 | 80 |
|
||||
| Max text line chars | ~50 centered | ~25-30 centered |
|
||||
| Vertical rain | Short travel | Long, dramatic travel |
|
||||
| Horizontal spectrum | Full width | Needs rotation or compression |
|
||||
| Radial effects | Natural circles | Tall ellipses (aspect correction handles this) |
|
||||
| Particle explosions | Wide spread | Tall spread |
|
||||
| Text stacking | 3-4 lines comfortable | 8-10 lines comfortable |
|
||||
| Quote layout | 2-3 wide lines | 5-6 short lines |
|
||||
|
||||
**Portrait-optimized patterns:**
|
||||
- Vertical rain/matrix effects are naturally enhanced — longer column travel
|
||||
- Fire columns rise through more screen space
|
||||
- Rising embers/particles have more vertical runway
|
||||
- Text can be stacked more aggressively with more lines
|
||||
- Radial effects work if aspect correction is applied (GridLayer handles this automatically)
|
||||
- Spectrum bars can be rotated 90 degrees (vertical bars from bottom)
|
||||
|
||||
**Portrait text layout:**
|
||||
```python
|
||||
def layout_text_portrait(text, max_chars_per_line=25, grid=None):
|
||||
"""Break text into short lines for portrait display."""
|
||||
words = text.split()
|
||||
lines = []; current = ""
|
||||
for w in words:
|
||||
if len(current) + len(w) + 1 > max_chars_per_line:
|
||||
lines.append(current.strip())
|
||||
current = w + " "
|
||||
else:
|
||||
current += w + " "
|
||||
if current.strip():
|
||||
lines.append(current.strip())
|
||||
return lines
|
||||
```
|
||||
|
||||
## Performance Budget
|
||||
|
||||
Target: 100-200ms per frame (5-10 fps single-threaded, 40-80 fps across 8 workers).
|
||||
|
||||
| Component | Time | Notes |
|
||||
|-----------|------|-------|
|
||||
| Feature extraction | 1-5ms | Pre-computed for all frames before render |
|
||||
| Effect function | 2-15ms | Vectorized numpy, avoid Python loops |
|
||||
| Character render | 80-150ms | **Bottleneck** -- per-cell Python loop |
|
||||
| Shader pipeline | 5-25ms | Depends on active shaders |
|
||||
| ffmpeg encode | ~5ms | Amortized by pipe buffering |
|
||||
|
||||
## Bitmap Pre-Rasterization
|
||||
|
||||
Rasterize every character at init, not per-frame:
|
||||
|
||||
```python
|
||||
# At init time -- done once
|
||||
for c in all_characters:
|
||||
img = Image.new("L", (cell_w, cell_h), 0)
|
||||
ImageDraw.Draw(img).text((0, 0), c, fill=255, font=font)
|
||||
bitmaps[c] = np.array(img, dtype=np.float32) / 255.0 # float32 for fast multiply
|
||||
|
||||
# At render time -- fast lookup
|
||||
bitmap = bitmaps[char]
|
||||
canvas[y:y+ch, x:x+cw] = np.maximum(canvas[y:y+ch, x:x+cw],
|
||||
(bitmap[:,:,None] * color).astype(np.uint8))
|
||||
```
|
||||
|
||||
Collect all characters from all palettes + overlay text into the init set. Lazy-init for any missed characters.
|
||||
|
||||
## Pre-Rendered Background Textures
|
||||
|
||||
Alternative to `_render_vf()` for backgrounds where characters don't need to change every frame. Pre-bake a static ASCII texture once at init, then multiply by a per-cell color field each frame. One matrix multiply vs thousands of bitmap blits.
|
||||
|
||||
Use when: background layer uses a fixed character palette and only color/brightness varies per frame. NOT suitable for layers where character selection depends on a changing value field.
|
||||
|
||||
### Init: Bake the Texture
|
||||
|
||||
```python
|
||||
# In GridLayer.__init__:
|
||||
self._bg_row_idx = np.clip(
|
||||
(np.arange(VH) - self.oy) // self.ch, 0, self.rows - 1
|
||||
)
|
||||
self._bg_col_idx = np.clip(
|
||||
(np.arange(VW) - self.ox) // self.cw, 0, self.cols - 1
|
||||
)
|
||||
self._bg_textures = {}
|
||||
|
||||
def make_bg_texture(self, palette):
|
||||
"""Pre-render a static ASCII texture (grayscale float32) once."""
|
||||
if palette not in self._bg_textures:
|
||||
texture = np.zeros((VH, VW), dtype=np.float32)
|
||||
rng = random.Random(12345)
|
||||
ch_list = [c for c in palette if c != " " and c in self.bm]
|
||||
if not ch_list:
|
||||
ch_list = list(self.bm.keys())[:5]
|
||||
for row in range(self.rows):
|
||||
y = self.oy + row * self.ch
|
||||
if y + self.ch > VH:
|
||||
break
|
||||
for col in range(self.cols):
|
||||
x = self.ox + col * self.cw
|
||||
if x + self.cw > VW:
|
||||
break
|
||||
bm = self.bm[rng.choice(ch_list)]
|
||||
texture[y:y+self.ch, x:x+self.cw] = bm
|
||||
self._bg_textures[palette] = texture
|
||||
return self._bg_textures[palette]
|
||||
```
|
||||
|
||||
### Render: Color Field x Cached Texture
|
||||
|
||||
```python
|
||||
def render_bg(self, color_field, palette=PAL_CIRCUIT):
|
||||
"""Fast background: pre-rendered ASCII texture * per-cell color field.
|
||||
color_field: (rows, cols, 3) uint8. Returns (VH, VW, 3) uint8."""
|
||||
texture = self.make_bg_texture(palette)
|
||||
# Expand cell colors to pixel coords via pre-computed index maps
|
||||
color_px = color_field[
|
||||
self._bg_row_idx[:, None], self._bg_col_idx[None, :]
|
||||
].astype(np.float32)
|
||||
return (texture[:, :, None] * color_px).astype(np.uint8)
|
||||
```
|
||||
|
||||
### Usage in a Scene
|
||||
|
||||
```python
|
||||
# Build per-cell color from effect fields (cheap — rows*cols, not VH*VW)
|
||||
hue = ((t * 0.05 + val * 0.2) % 1.0).astype(np.float32)
|
||||
R, G, B = hsv2rgb(hue, np.full_like(val, 0.5), val)
|
||||
color_field = mkc(R, G, B, g.rows, g.cols) # (rows, cols, 3) uint8
|
||||
|
||||
# Render background — single matrix multiply, no per-cell loop
|
||||
canvas_bg = g.render_bg(color_field, PAL_DENSE)
|
||||
```
|
||||
|
||||
The texture init loop runs once and is cached per palette. Per-frame cost is one fancy-index lookup + one broadcast multiply — orders of magnitude faster than the per-cell bitmap blit loop in `render()` for dense backgrounds.
|
||||
|
||||
## Coordinate Array Caching
|
||||
|
||||
Pre-compute all grid-relative coordinate arrays at init, not per-frame:
|
||||
|
||||
```python
|
||||
# These are O(rows*cols) and used in every effect
|
||||
self.rr = np.arange(rows)[:, None] # row indices
|
||||
self.cc = np.arange(cols)[None, :] # col indices
|
||||
self.dist = np.sqrt(dx**2 + dy**2) # distance from center
|
||||
self.angle = np.arctan2(dy, dx) # angle from center
|
||||
self.dist_n = ... # normalized distance
|
||||
```
|
||||
|
||||
## Vectorized Effect Patterns
|
||||
|
||||
### Avoid Per-Cell Python Loops in Effects
|
||||
|
||||
The render loop (compositing bitmaps) is unavoidably per-cell. But effect functions must be fully vectorized numpy -- never iterate over rows/cols in Python.
|
||||
|
||||
Bad (O(rows*cols) Python loop):
|
||||
```python
|
||||
for r in range(rows):
|
||||
for c in range(cols):
|
||||
val[r, c] = math.sin(c * 0.1 + t) * math.cos(r * 0.1 - t)
|
||||
```
|
||||
|
||||
Good (vectorized):
|
||||
```python
|
||||
val = np.sin(g.cc * 0.1 + t) * np.cos(g.rr * 0.1 - t)
|
||||
```
|
||||
|
||||
### Vectorized Matrix Rain
|
||||
|
||||
The naive per-column per-trail-pixel loop is the second biggest bottleneck after the render loop. Use numpy fancy indexing:
|
||||
|
||||
```python
|
||||
# Instead of nested Python loops over columns and trail pixels:
|
||||
# Build row index arrays for all active trail pixels at once
|
||||
all_rows = []
|
||||
all_cols = []
|
||||
all_fades = []
|
||||
for c in range(cols):
|
||||
head = int(S["ry"][c])
|
||||
trail_len = S["rln"][c]
|
||||
for i in range(trail_len):
|
||||
row = head - i
|
||||
if 0 <= row < rows:
|
||||
all_rows.append(row)
|
||||
all_cols.append(c)
|
||||
all_fades.append(1.0 - i / trail_len)
|
||||
|
||||
# Vectorized assignment
|
||||
ar = np.array(all_rows)
|
||||
ac = np.array(all_cols)
|
||||
af = np.array(all_fades, dtype=np.float32)
|
||||
# Assign chars and colors in bulk using fancy indexing
|
||||
ch[ar, ac] = ... # vectorized char assignment
|
||||
co[ar, ac, 1] = (af * bri * 255).astype(np.uint8) # green channel
|
||||
```
|
||||
|
||||
### Vectorized Fire Columns
|
||||
|
||||
Same pattern -- accumulate index arrays, assign in bulk:
|
||||
|
||||
```python
|
||||
fire_val = np.zeros((rows, cols), dtype=np.float32)
|
||||
for fi in range(n_cols):
|
||||
fx_c = int((fi * cols / n_cols + np.sin(t * 2 + fi * 0.7) * 3) % cols)
|
||||
height = int(energy * rows * 0.7)
|
||||
dy = np.arange(min(height, rows))
|
||||
fr = rows - 1 - dy
|
||||
frac = dy / max(height, 1)
|
||||
# Width spread: base columns wider at bottom
|
||||
for dx in range(-1, 2): # 3-wide columns
|
||||
c = fx_c + dx
|
||||
if 0 <= c < cols:
|
||||
fire_val[fr, c] = np.maximum(fire_val[fr, c],
|
||||
(1 - frac * 0.6) * (0.5 + rms * 0.5))
|
||||
# Now map fire_val to chars and colors in one vectorized pass
|
||||
```
|
||||
|
||||
## PIL String Rendering for Text-Heavy Scenes
|
||||
|
||||
Alternative to per-cell bitmap blitting when rendering many long text strings (scrolling tickers, typewriter sequences, idea floods). Uses PIL's native `ImageDraw.text()` which renders an entire string in one C call, vs one Python-loop bitmap blit per character.
|
||||
|
||||
Typical win: a scene with 56 ticker rows renders 56 PIL `text()` calls instead of ~10K individual bitmap blits.
|
||||
|
||||
Use when: scene renders many rows of readable text strings. NOT suitable for sparse or spatially-scattered single characters (use normal `render()` for those).
|
||||
|
||||
```python
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
def render_text_layer(grid, rows_data, font):
|
||||
"""Render dense text rows via PIL instead of per-cell bitmap blitting.
|
||||
|
||||
Args:
|
||||
grid: GridLayer instance (for oy, ch, ox, font metrics)
|
||||
rows_data: list of (row_index, text_string, rgb_tuple) — one per row
|
||||
font: PIL ImageFont instance (grid.font)
|
||||
|
||||
Returns:
|
||||
uint8 array (VH, VW, 3) — canvas with rendered text
|
||||
"""
|
||||
img = Image.new("RGB", (VW, VH), (0, 0, 0))
|
||||
draw = ImageDraw.Draw(img)
|
||||
for row_idx, text, color in rows_data:
|
||||
y = grid.oy + row_idx * grid.ch
|
||||
if y + grid.ch > VH:
|
||||
break
|
||||
draw.text((grid.ox, y), text, fill=color, font=font)
|
||||
return np.array(img)
|
||||
```
|
||||
|
||||
### Usage in a Ticker Scene
|
||||
|
||||
```python
|
||||
# Build ticker data (text + color per row)
|
||||
rows_data = []
|
||||
for row in range(n_tickers):
|
||||
text = build_ticker_text(row, t) # scrolling substring
|
||||
color = hsv2rgb_scalar(hue, 0.85, bri) # (R, G, B) tuple
|
||||
rows_data.append((row, text, color))
|
||||
|
||||
# One PIL pass instead of thousands of bitmap blits
|
||||
canvas_tickers = render_text_layer(g_md, rows_data, g_md.font)
|
||||
|
||||
# Blend with other layers normally
|
||||
result = blend_canvas(canvas_bg, canvas_tickers, "screen", 0.9)
|
||||
```
|
||||
|
||||
This is purely a rendering optimization — same visual output, fewer draw calls. The grid's `render()` method is still needed for sparse character fields where characters are placed individually based on value fields.
|
||||
|
||||
## Bloom Optimization
|
||||
|
||||
**Do NOT use `scipy.ndimage.uniform_filter`** -- measured at 424ms/frame.
|
||||
|
||||
Use 4x downsample + manual box blur instead -- 84ms/frame (5x faster):
|
||||
|
||||
```python
|
||||
sm = canvas[::4, ::4].astype(np.float32) # 4x downsample
|
||||
br = np.where(sm > threshold, sm, 0)
|
||||
for _ in range(3): # 3-pass manual box blur
|
||||
p = np.pad(br, ((1,1),(1,1),(0,0)), mode='edge')
|
||||
br = (p[:-2,:-2] + p[:-2,1:-1] + p[:-2,2:] +
|
||||
p[1:-1,:-2] + p[1:-1,1:-1] + p[1:-1,2:] +
|
||||
p[2:,:-2] + p[2:,1:-1] + p[2:,2:]) / 9.0
|
||||
bl = np.repeat(np.repeat(br, 4, axis=0), 4, axis=1)[:H, :W]
|
||||
```
|
||||
|
||||
## Vignette Caching
|
||||
|
||||
Distance field is resolution- and strength-dependent, never changes per frame:
|
||||
|
||||
```python
|
||||
_vig_cache = {}
|
||||
def sh_vignette(canvas, strength):
|
||||
key = (canvas.shape[0], canvas.shape[1], round(strength, 2))
|
||||
if key not in _vig_cache:
|
||||
Y = np.linspace(-1, 1, H)[:, None]
|
||||
X = np.linspace(-1, 1, W)[None, :]
|
||||
_vig_cache[key] = np.clip(1.0 - np.sqrt(X**2+Y**2) * strength, 0.15, 1).astype(np.float32)
|
||||
return np.clip(canvas * _vig_cache[key][:,:,None], 0, 255).astype(np.uint8)
|
||||
```
|
||||
|
||||
Same pattern for CRT barrel distortion (cache remap coordinates).
|
||||
|
||||
## Film Grain Optimization
|
||||
|
||||
Generate noise at half resolution, tile up:
|
||||
|
||||
```python
|
||||
noise = np.random.randint(-amt, amt+1, (H//2, W//2, 1), dtype=np.int16)
|
||||
noise = np.repeat(np.repeat(noise, 2, axis=0), 2, axis=1)[:H, :W]
|
||||
```
|
||||
|
||||
2x blocky grain looks like film grain and costs 1/4 the random generation.
|
||||
|
||||
## Parallel Rendering
|
||||
|
||||
### Worker Architecture
|
||||
|
||||
```python
|
||||
hw = detect_hardware()
|
||||
N_WORKERS = hw["workers"]
|
||||
|
||||
# Batch splitting (for non-clip architectures)
|
||||
batch_size = (n_frames + N_WORKERS - 1) // N_WORKERS
|
||||
batches = [(i, i*batch_size, min((i+1)*batch_size, n_frames), features, seg_path) ...]
|
||||
|
||||
with multiprocessing.Pool(N_WORKERS) as pool:
|
||||
segments = pool.starmap(render_batch, batches)
|
||||
```
|
||||
|
||||
### Per-Clip Parallelism (Preferred for Segmented Videos)
|
||||
|
||||
```python
|
||||
from concurrent.futures import ProcessPoolExecutor, as_completed
|
||||
|
||||
with ProcessPoolExecutor(max_workers=N_WORKERS) as pool:
|
||||
futures = {pool.submit(render_clip, seg, features, path): seg["id"]
|
||||
for seg, path in clip_args}
|
||||
for fut in as_completed(futures):
|
||||
clip_id = futures[fut]
|
||||
try:
|
||||
fut.result()
|
||||
log(f" {clip_id} done")
|
||||
except Exception as e:
|
||||
log(f" {clip_id} FAILED: {e}")
|
||||
```
|
||||
|
||||
### Worker Isolation
|
||||
|
||||
Each worker:
|
||||
- Creates its own `Renderer` instance (with full grid + bitmap init)
|
||||
- Opens its own ffmpeg subprocess
|
||||
- Has independent random seed (`random.seed(batch_id * 10000)`)
|
||||
- Writes to its own segment file and stderr log
|
||||
|
||||
### ffmpeg Pipe Safety
|
||||
|
||||
**CRITICAL**: Never `stderr=subprocess.PIPE` with long-running ffmpeg. The stderr buffer fills at ~64KB and deadlocks:
|
||||
|
||||
```python
|
||||
# WRONG -- will deadlock
|
||||
pipe = subprocess.Popen(cmd, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
# RIGHT -- stderr to file
|
||||
stderr_fh = open(err_path, "w")
|
||||
pipe = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.DEVNULL, stderr=stderr_fh)
|
||||
# ... write all frames ...
|
||||
pipe.stdin.close()
|
||||
pipe.wait()
|
||||
stderr_fh.close()
|
||||
```
|
||||
|
||||
### Concatenation
|
||||
|
||||
```python
|
||||
with open(concat_file, "w") as cf:
|
||||
for seg in segments:
|
||||
cf.write(f"file '{seg}'\n")
|
||||
|
||||
cmd = ["ffmpeg", "-y", "-f", "concat", "-safe", "0", "-i", concat_file]
|
||||
if audio_path:
|
||||
cmd += ["-i", audio_path, "-c:v", "copy", "-c:a", "aac", "-b:a", "192k", "-shortest"]
|
||||
else:
|
||||
cmd += ["-c:v", "copy"]
|
||||
cmd.append(output_path)
|
||||
subprocess.run(cmd, capture_output=True, check=True)
|
||||
```
|
||||
|
||||
## Particle System Performance
|
||||
|
||||
Cap particle counts based on quality profile:
|
||||
|
||||
| System | Low | Standard | High |
|
||||
|--------|-----|----------|------|
|
||||
| Explosion | 300 | 1000 | 2500 |
|
||||
| Embers | 500 | 1500 | 3000 |
|
||||
| Starfield | 300 | 800 | 1500 |
|
||||
| Dissolve | 200 | 600 | 1200 |
|
||||
|
||||
Cull by truncating lists:
|
||||
```python
|
||||
MAX_PARTICLES = profile.get("particles_max", 1200)
|
||||
if len(S["px"]) > MAX_PARTICLES:
|
||||
for k in ("px", "py", "vx", "vy", "life", "char"):
|
||||
S[k] = S[k][-MAX_PARTICLES:] # keep newest
|
||||
```
|
||||
|
||||
## Memory Management
|
||||
|
||||
- Feature arrays: pre-computed for all frames, shared across workers via fork semantics (COW)
|
||||
- Canvas: allocated once per worker, reused (`np.zeros(...)`)
|
||||
- Character arrays: allocated per frame (cheap -- rows*cols U1 strings)
|
||||
- Bitmap cache: ~500KB per grid size, initialized once per worker
|
||||
|
||||
Total memory per worker: ~50-150MB. Total: ~400-800MB for 8 workers.
|
||||
|
||||
For low-memory systems (< 4GB), reduce worker count and use smaller grids.
|
||||
|
||||
## Brightness Verification
|
||||
|
||||
After render, spot-check brightness at sample timestamps:
|
||||
|
||||
```python
|
||||
for t in [2, 30, 60, 120, 180]:
|
||||
cmd = ["ffmpeg", "-ss", str(t), "-i", output_path,
|
||||
"-frames:v", "1", "-f", "rawvideo", "-pix_fmt", "rgb24", "-"]
|
||||
r = subprocess.run(cmd, capture_output=True)
|
||||
arr = np.frombuffer(r.stdout, dtype=np.uint8)
|
||||
print(f"t={t}s mean={arr.mean():.1f} max={arr.max()}")
|
||||
```
|
||||
|
||||
Target: mean > 5 for quiet sections, mean > 15 for active sections. If consistently below, increase brightness floor in effects and/or global boost multiplier.
|
||||
|
||||
## Render Time Estimates
|
||||
|
||||
Scale with hardware. Baseline: 1080p, 24fps, ~180ms/frame/worker.
|
||||
|
||||
| Duration | Frames | 4 workers | 8 workers | 16 workers |
|
||||
|----------|--------|-----------|-----------|------------|
|
||||
| 30s | 720 | ~3 min | ~2 min | ~1 min |
|
||||
| 2 min | 2,880 | ~13 min | ~7 min | ~4 min |
|
||||
| 3.5 min | 5,040 | ~23 min | ~12 min | ~6 min |
|
||||
| 5 min | 7,200 | ~33 min | ~17 min | ~9 min |
|
||||
| 10 min | 14,400 | ~65 min | ~33 min | ~17 min |
|
||||
|
||||
At 720p: multiply times by ~0.5. At 4K: multiply by ~4.
|
||||
|
||||
Heavier effects (many particles, dense grids, extra shader passes) add ~20-50%.
|
||||
|
||||
---
|
||||
|
||||
## Temp File Cleanup
|
||||
|
||||
Rendering generates intermediate files that accumulate across runs. Clean up after the final concat/mux step.
|
||||
|
||||
### Files to Clean
|
||||
|
||||
| File type | Source | Location |
|
||||
|-----------|--------|----------|
|
||||
| WAV extracts | `ffmpeg -i input.mp3 ... tmp.wav` | `tempfile.mktemp()` or project dir |
|
||||
| Segment clips | `render_clip()` output | `segments/seg_00.mp4` etc. |
|
||||
| Concat list | ffmpeg concat demuxer input | `segments/concat.txt` |
|
||||
| ffmpeg stderr logs | piped to file for debugging | `*.log` in project dir |
|
||||
| Feature cache | pickled numpy arrays | `*.pkl` or `*.npz` |
|
||||
|
||||
### Cleanup Function
|
||||
|
||||
```python
|
||||
import glob
|
||||
import tempfile
|
||||
import shutil
|
||||
|
||||
def cleanup_render_artifacts(segments_dir="segments", keep_final=True):
|
||||
"""Remove intermediate files after successful render.
|
||||
|
||||
Call this AFTER verifying the final output exists and plays correctly.
|
||||
|
||||
Args:
|
||||
segments_dir: directory containing segment clips and concat list
|
||||
keep_final: if True, only delete intermediates (not the final output)
|
||||
"""
|
||||
removed = []
|
||||
|
||||
# 1. Segment clips
|
||||
if os.path.isdir(segments_dir):
|
||||
shutil.rmtree(segments_dir)
|
||||
removed.append(f"directory: {segments_dir}")
|
||||
|
||||
# 2. Temporary WAV files
|
||||
for wav in glob.glob("*.wav"):
|
||||
if wav.startswith("tmp") or wav.startswith("extracted_"):
|
||||
os.remove(wav)
|
||||
removed.append(wav)
|
||||
|
||||
# 3. ffmpeg stderr logs
|
||||
for log in glob.glob("ffmpeg_*.log"):
|
||||
os.remove(log)
|
||||
removed.append(log)
|
||||
|
||||
# 4. Feature cache (optional — useful to keep for re-renders)
|
||||
# for cache in glob.glob("features_*.npz"):
|
||||
# os.remove(cache)
|
||||
# removed.append(cache)
|
||||
|
||||
print(f"Cleaned {len(removed)} artifacts: {removed}")
|
||||
return removed
|
||||
```
|
||||
|
||||
### Integration with Render Pipeline
|
||||
|
||||
Call cleanup at the end of the main render script, after the final output is verified:
|
||||
|
||||
```python
|
||||
# At end of main()
|
||||
if os.path.exists(output_path) and os.path.getsize(output_path) > 1000:
|
||||
cleanup_render_artifacts(segments_dir="segments")
|
||||
print(f"Done. Output: {output_path}")
|
||||
else:
|
||||
print("WARNING: final output missing or empty — skipping cleanup")
|
||||
```
|
||||
|
||||
### Temp File Best Practices
|
||||
|
||||
- Use `tempfile.mkdtemp()` for segment directories — avoids polluting the project dir
|
||||
- Name WAV extracts with `tempfile.mktemp(suffix=".wav")` so they're in the OS temp dir
|
||||
- For debugging, set `KEEP_INTERMEDIATES=1` env var to skip cleanup
|
||||
- Feature caches (`.npz`) are cheap to store and expensive to recompute — default to keeping them
|
||||
1011
skills/creative/ascii-video/references/scenes.md
Normal file
1011
skills/creative/ascii-video/references/scenes.md
Normal file
File diff suppressed because it is too large
Load Diff
1385
skills/creative/ascii-video/references/shaders.md
Normal file
1385
skills/creative/ascii-video/references/shaders.md
Normal file
File diff suppressed because it is too large
Load Diff
367
skills/creative/ascii-video/references/troubleshooting.md
Normal file
367
skills/creative/ascii-video/references/troubleshooting.md
Normal file
@@ -0,0 +1,367 @@
|
||||
# Troubleshooting Reference
|
||||
|
||||
> **See also:** composition.md · architecture.md · shaders.md · scenes.md · optimization.md
|
||||
|
||||
## Quick Diagnostic
|
||||
|
||||
| Symptom | Likely Cause | Fix |
|
||||
|---------|-------------|-----|
|
||||
| All black output | tonemap gamma too high or no effects rendering | Lower gamma to 0.5, check scene_fn returns non-zero canvas |
|
||||
| Washed out / too bright | Linear brightness multiplier instead of tonemap | Replace `canvas * N` with `tonemap(canvas, gamma=0.75)` |
|
||||
| ffmpeg hangs mid-render | stderr=subprocess.PIPE deadlock | Redirect stderr to file |
|
||||
| "read-only" array error | broadcast_to view without .copy() | Add `.copy()` after broadcast_to |
|
||||
| PicklingError | Lambda or closure in SCENES table | Define all fx_* at module level |
|
||||
| Random dark holes in output | Font missing Unicode glyphs | Validate palettes at init |
|
||||
| Audio-visual desync | Frame timing accumulation | Use integer frame counter, compute t fresh each frame |
|
||||
| Single-color flat output | Hue field shape mismatch | Ensure h,s,v arrays all (rows,cols) before hsv2rgb |
|
||||
| Text unreadable over busy bg | No contrast between text and background | Use `apply_text_backdrop()` (composition.md) + `reverse_vignette` shader (shaders.md) |
|
||||
| Text garbled/mirrored | Kaleidoscope or mirror shader applied to text scene | **Never apply kaleidoscope, mirror_h/v/quad/diag to scenes with readable text** — radial folding destroys legibility. Apply these only to background layers or text-free scenes |
|
||||
|
||||
Common bugs, gotchas, and platform-specific issues encountered during ASCII video development.
|
||||
|
||||
## NumPy Broadcasting
|
||||
|
||||
### The `broadcast_to().copy()` Trap
|
||||
|
||||
Hue field generators often return arrays that are broadcast views — they have shape `(1, cols)` or `(rows, 1)` that numpy broadcasts to `(rows, cols)`. These views are **read-only**. If any downstream code tries to modify them in-place (e.g., `h %= 1.0`), numpy raises:
|
||||
|
||||
```
|
||||
ValueError: output array is read-only
|
||||
```
|
||||
|
||||
**Fix**: Always `.copy()` after `broadcast_to()`:
|
||||
|
||||
```python
|
||||
h = np.broadcast_to(h, (g.rows, g.cols)).copy()
|
||||
```
|
||||
|
||||
This is especially important in `_render_vf()` where hue arrays flow through `hsv2rgb()`.
|
||||
|
||||
### The `+=` vs `+` Trap
|
||||
|
||||
Broadcasting also fails with in-place operators when operand shapes don't match exactly:
|
||||
|
||||
```python
|
||||
# FAILS if result is (rows,1) and operand is (rows, cols)
|
||||
val += np.sin(g.cc * 0.02 + t * 0.3) * 0.5
|
||||
|
||||
# WORKS — creates a new array
|
||||
val = val + np.sin(g.cc * 0.02 + t * 0.3) * 0.5
|
||||
```
|
||||
|
||||
The `vf_plasma()` function had this bug. Use `+` instead of `+=` when mixing different-shaped arrays.
|
||||
|
||||
### Shape Mismatch in `hsv2rgb()`
|
||||
|
||||
`hsv2rgb(h, s, v)` requires all three arrays to have identical shapes. If `h` is `(1, cols)` and `s` is `(rows, cols)`, the function crashes or produces wrong output.
|
||||
|
||||
**Fix**: Ensure all inputs are broadcast and copied to `(rows, cols)` before calling.
|
||||
|
||||
---
|
||||
|
||||
## Blend Mode Pitfalls
|
||||
|
||||
### Overlay Crushes Dark Inputs
|
||||
|
||||
`overlay(a, b) = 2*a*b` when `a < 0.5`. Two values of 0.12 produce `2 * 0.12 * 0.12 = 0.03`. The result is darker than either input.
|
||||
|
||||
**Impact**: If both layers are dark (which ASCII art usually is), overlay produces near-black output.
|
||||
|
||||
**Fix**: Use `screen` for dark source material. Screen always brightens: `1 - (1-a)*(1-b)`.
|
||||
|
||||
### Colordodge Division by Zero
|
||||
|
||||
`colordodge(a, b) = a / (1 - b)`. When `b = 1.0` (pure white pixels), this divides by zero.
|
||||
|
||||
**Fix**: Add epsilon: `a / (1 - b + 1e-6)`. The implementation in `BLEND_MODES` should include this.
|
||||
|
||||
### Colorburn Division by Zero
|
||||
|
||||
`colorburn(a, b) = 1 - (1-a) / b`. When `b = 0` (pure black pixels), this divides by zero.
|
||||
|
||||
**Fix**: Add epsilon: `1 - (1-a) / (b + 1e-6)`.
|
||||
|
||||
### Multiply Always Darkens
|
||||
|
||||
`multiply(a, b) = a * b`. Since both operands are [0,1], the result is always <= min(a,b). Never use multiply as a feedback blend mode — the frame goes black within a few frames.
|
||||
|
||||
**Fix**: Use `screen` for feedback, or `add` with low opacity.
|
||||
|
||||
---
|
||||
|
||||
## Multiprocessing
|
||||
|
||||
### Pickling Constraints
|
||||
|
||||
`ProcessPoolExecutor` serializes function arguments via pickle. This constrains what you can pass to workers:
|
||||
|
||||
| Can Pickle | Cannot Pickle |
|
||||
|-----------|---------------|
|
||||
| Module-level functions (`def fx_foo():`) | Lambdas (`lambda x: x + 1`) |
|
||||
| Dicts, lists, numpy arrays | Closures (functions defined inside functions) |
|
||||
| Class instances (with `__reduce__`) | Instance methods |
|
||||
| Strings, numbers | File handles, sockets |
|
||||
|
||||
**Impact**: All scene functions referenced in the SCENES table must be defined at module level with `def`. If you use a lambda or closure, you get:
|
||||
|
||||
```
|
||||
_pickle.PicklingError: Can't pickle <function <lambda> at 0x...>
|
||||
```
|
||||
|
||||
**Fix**: Define all scene functions at module top level. Lambdas used inside `_render_vf()` as val_fn/hue_fn are fine because they execute within the worker process — they're not pickled across process boundaries.
|
||||
|
||||
### macOS spawn vs Linux fork
|
||||
|
||||
On macOS, `multiprocessing` defaults to `spawn` (full serialization). On Linux, it defaults to `fork` (copy-on-write). This means:
|
||||
|
||||
- **macOS**: Feature arrays are serialized per worker (~57KB for 30s video, but scales with duration). Each worker re-imports the entire module.
|
||||
- **Linux**: Feature arrays are shared via COW. Workers inherit the parent's memory.
|
||||
|
||||
**Impact**: On macOS, module-level code (like `detect_hardware()`) runs in every worker process. If it has side effects (e.g., subprocess calls), those happen N+1 times.
|
||||
|
||||
### Per-Worker State Isolation
|
||||
|
||||
Each worker creates its own:
|
||||
- `Renderer` instance (with fresh grid cache)
|
||||
- `FeedbackBuffer` (feedback doesn't cross scene boundaries)
|
||||
- Random seed (`random.seed(hash(seg_id) + 42)`)
|
||||
|
||||
This means:
|
||||
- Particle state doesn't carry between scenes (expected)
|
||||
- Feedback trails reset at scene cuts (expected)
|
||||
- `np.random` state is NOT seeded by `random.seed()` — they use separate RNGs
|
||||
|
||||
**Fix for deterministic noise**: Use `np.random.RandomState(seed)` explicitly:
|
||||
|
||||
```python
|
||||
rng = np.random.RandomState(hash(seg_id) + 42)
|
||||
noise = rng.random((rows, cols))
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Brightness Issues
|
||||
|
||||
### Dark Scenes After Tonemap
|
||||
|
||||
If a scene is still dark after tonemap, check:
|
||||
|
||||
1. **Gamma too high**: Lower gamma (0.5-0.6) for scenes with destructive post-processing
|
||||
2. **Shader destroying brightness**: Solarize, posterize, or contrast adjustments in the shader chain can undo tonemap's work. Move destructive shaders earlier in the chain, or increase gamma to compensate.
|
||||
3. **Feedback with multiply**: Multiply feedback darkens every frame. Switch to screen or add.
|
||||
4. **Overlay blend in scene**: If the scene function uses `blend_canvas(..., "overlay", ...)` with dark layers, switch to screen.
|
||||
|
||||
### Diagnostic: Test-Frame Brightness
|
||||
|
||||
```bash
|
||||
python reel.py --test-frame 10.0
|
||||
# Output: Mean brightness: 44.3, max: 255
|
||||
```
|
||||
|
||||
If mean < 20, the scene needs attention. Common fixes:
|
||||
- Lower gamma in the SCENES entry
|
||||
- Change internal blend modes from overlay/multiply to screen/add
|
||||
- Increase value field multipliers (e.g., `vf_plasma(...) * 1.5`)
|
||||
- Check that the shader chain doesn't have an aggressive solarize or threshold
|
||||
|
||||
### v1 Brightness Pattern (Deprecated)
|
||||
|
||||
The old pattern used a linear multiplier:
|
||||
|
||||
```python
|
||||
# OLD — don't use
|
||||
canvas = np.clip(canvas.astype(np.float32) * 2.0, 0, 255).astype(np.uint8)
|
||||
```
|
||||
|
||||
This fails because:
|
||||
- Dark scenes (mean 8): `8 * 2.0 = 16` — still dark
|
||||
- Bright scenes (mean 130): `130 * 2.0 = 255` — clipped, lost detail
|
||||
|
||||
Use `tonemap()` instead. See `composition.md` § Adaptive Tone Mapping.
|
||||
|
||||
---
|
||||
|
||||
## ffmpeg Issues
|
||||
|
||||
### Pipe Deadlock
|
||||
|
||||
The #1 production bug. If you use `stderr=subprocess.PIPE`:
|
||||
|
||||
```python
|
||||
# DEADLOCK — stderr buffer fills at 64KB, blocks ffmpeg, blocks your writes
|
||||
pipe = subprocess.Popen(cmd, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
```
|
||||
|
||||
**Fix**: Always redirect stderr to a file:
|
||||
|
||||
```python
|
||||
stderr_fh = open(err_path, "w")
|
||||
pipe = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
||||
stdout=subprocess.DEVNULL, stderr=stderr_fh)
|
||||
```
|
||||
|
||||
### Frame Count Mismatch
|
||||
|
||||
If the number of frames written to the pipe doesn't match what ffmpeg expects (based on `-r` and duration), the output may have:
|
||||
- Missing frames at the end
|
||||
- Incorrect duration
|
||||
- Audio-video desync
|
||||
|
||||
**Fix**: Calculate frame count explicitly: `n_frames = int(duration * FPS)`. Don't use `range(int(start*FPS), int(end*FPS))` without verifying the total matches.
|
||||
|
||||
### Concat Fails with "unsafe file name"
|
||||
|
||||
```
|
||||
[concat @ ...] Unsafe file name
|
||||
```
|
||||
|
||||
**Fix**: Always use `-safe 0`:
|
||||
```python
|
||||
["ffmpeg", "-f", "concat", "-safe", "0", "-i", concat_path, ...]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Font Issues
|
||||
|
||||
### Cell Height (macOS Pillow)
|
||||
|
||||
`textbbox()` and `getbbox()` return incorrect heights on some macOS Pillow versions. Use `getmetrics()`:
|
||||
|
||||
```python
|
||||
ascent, descent = font.getmetrics()
|
||||
cell_height = ascent + descent # correct
|
||||
# NOT: font.getbbox("M")[3] # wrong on some versions
|
||||
```
|
||||
|
||||
### Missing Unicode Glyphs
|
||||
|
||||
Not all fonts render all Unicode characters. If a palette character isn't in the font, the glyph renders as a blank or tofu box, appearing as a dark hole in the output.
|
||||
|
||||
**Fix**: Validate at init:
|
||||
|
||||
```python
|
||||
all_chars = set()
|
||||
for pal in [PAL_DEFAULT, PAL_DENSE, PAL_RUNE, ...]:
|
||||
all_chars.update(pal)
|
||||
|
||||
valid_chars = set()
|
||||
for c in all_chars:
|
||||
if c == " ":
|
||||
valid_chars.add(c)
|
||||
continue
|
||||
img = Image.new("L", (20, 20), 0)
|
||||
ImageDraw.Draw(img).text((0, 0), c, fill=255, font=font)
|
||||
if np.array(img).max() > 0:
|
||||
valid_chars.add(c)
|
||||
else:
|
||||
log(f"WARNING: '{c}' (U+{ord(c):04X}) missing from font")
|
||||
```
|
||||
|
||||
### Platform Font Paths
|
||||
|
||||
| Platform | Common Paths |
|
||||
|----------|-------------|
|
||||
| macOS | `/System/Library/Fonts/Menlo.ttc`, `/System/Library/Fonts/Monaco.ttf` |
|
||||
| Linux | `/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf` |
|
||||
| Windows | `C:\Windows\Fonts\consola.ttf` (Consolas) |
|
||||
|
||||
Always probe multiple paths and fall back gracefully. See `architecture.md` § Font Selection.
|
||||
|
||||
---
|
||||
|
||||
## Performance
|
||||
|
||||
### Slow Shaders
|
||||
|
||||
Some shaders use Python loops and are very slow at 1080p:
|
||||
|
||||
| Shader | Issue | Fix |
|
||||
|--------|-------|-----|
|
||||
| `wave_distort` | Per-row Python loop | Use vectorized fancy indexing |
|
||||
| `halftone` | Triple-nested loop | Vectorize with block reduction |
|
||||
| `matrix rain` | Per-column per-trail loop | Accumulate index arrays, bulk assign |
|
||||
|
||||
### Render Time Scaling
|
||||
|
||||
If render is taking much longer than expected:
|
||||
1. Check grid count — each extra grid adds ~100-150ms/frame for init
|
||||
2. Check particle count — cap at quality-appropriate limits
|
||||
3. Check shader count — each shader adds 2-25ms
|
||||
4. Check for accidental Python loops in effects (should be numpy only)
|
||||
|
||||
---
|
||||
|
||||
## Common Mistakes
|
||||
|
||||
### Using `r.S` vs the `S` Parameter
|
||||
|
||||
The v2 scene protocol passes `S` (the state dict) as an explicit parameter. But `S` IS `r.S` — they're the same object. Both work:
|
||||
|
||||
```python
|
||||
def fx_scene(r, f, t, S):
|
||||
S["counter"] = S.get("counter", 0) + 1 # via parameter (preferred)
|
||||
r.S["counter"] = r.S.get("counter", 0) + 1 # via renderer (also works)
|
||||
```
|
||||
|
||||
Use the `S` parameter for clarity. The explicit parameter makes it obvious that the function has persistent state.
|
||||
|
||||
### Forgetting to Handle Empty Feature Values
|
||||
|
||||
Audio features default to 0.0 if the audio is silent. Use `.get()` with sensible defaults:
|
||||
|
||||
```python
|
||||
energy = f.get("bass", 0.3) # default to 0.3, not 0
|
||||
```
|
||||
|
||||
If you default to 0, effects go blank during silence.
|
||||
|
||||
### Writing New Files Instead of Editing Existing State
|
||||
|
||||
A common bug in particle systems: creating new arrays every frame instead of updating persistent state.
|
||||
|
||||
```python
|
||||
# WRONG — particles reset every frame
|
||||
S["px"] = []
|
||||
for _ in range(100):
|
||||
S["px"].append(random.random())
|
||||
|
||||
# RIGHT — only initialize once, update each frame
|
||||
if "px" not in S:
|
||||
S["px"] = []
|
||||
# ... emit new particles based on beats
|
||||
# ... update existing particles
|
||||
```
|
||||
|
||||
### Not Clipping Value Fields
|
||||
|
||||
Value fields should be [0, 1]. If they exceed this range, `val2char()` produces index errors:
|
||||
|
||||
```python
|
||||
# WRONG — vf_plasma() * 1.5 can exceed 1.0
|
||||
val = vf_plasma(g, f, t, S) * 1.5
|
||||
|
||||
# RIGHT — clip after scaling
|
||||
val = np.clip(vf_plasma(g, f, t, S) * 1.5, 0, 1)
|
||||
```
|
||||
|
||||
The `_render_vf()` helper clips automatically, but if you're building custom scenes, clip explicitly.
|
||||
|
||||
## Brightness Best Practices
|
||||
|
||||
- Dense animated backgrounds — never flat black, always fill the grid
|
||||
- Vignette minimum clamped to 0.15 (not 0.12)
|
||||
- Bloom threshold 130 (not 170) so more pixels contribute to glow
|
||||
- Use `screen` blend mode (not `overlay`) for dark ASCII layers — overlay squares dark values: `2 * 0.12 * 0.12 = 0.03`
|
||||
- FeedbackBuffer decay minimum 0.5 — below that, feedback disappears too fast to see
|
||||
- Value field floor: `vf * 0.8 + 0.05` ensures no cell is truly zero
|
||||
- Per-scene gamma overrides: default 0.75, solarize 0.55, posterize 0.50, bright scenes 0.85
|
||||
- Test frames early: render single frames at key timestamps before committing to full render
|
||||
|
||||
**Quick checklist before full render:**
|
||||
1. Render 3 test frames (start, middle, end)
|
||||
2. Check `canvas.mean() > 8` after tonemap
|
||||
3. Check no scene is visually flat black
|
||||
4. Verify per-section variation (different bg/palette/color per scene)
|
||||
5. Confirm shader chain includes bloom (threshold 130)
|
||||
6. Confirm vignette strength ≤ 0.25
|
||||
147
skills/creative/creative-ideation/SKILL.md
Normal file
147
skills/creative/creative-ideation/SKILL.md
Normal file
@@ -0,0 +1,147 @@
|
||||
---
|
||||
name: ideation
|
||||
title: Creative Ideation — Constraint-Driven Project Generation
|
||||
description: "Generate project ideas through creative constraints. Use when the user says 'I want to build something', 'give me a project idea', 'I'm bored', 'what should I make', 'inspire me', or any variant of 'I have tools but no direction'. Works for code, art, hardware, writing, tools, and anything that can be made."
|
||||
version: 1.0.0
|
||||
author: SHL0MS
|
||||
license: MIT
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [Creative, Ideation, Projects, Brainstorming, Inspiration]
|
||||
category: creative
|
||||
requires_toolsets: []
|
||||
---
|
||||
|
||||
# Creative Ideation
|
||||
|
||||
Generate project ideas through creative constraints. Constraint + direction = creativity.
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **Pick a constraint** from the library below — random, or matched to the user's domain/mood
|
||||
2. **Interpret it broadly** — a coding prompt can become a hardware project, an art prompt can become a CLI tool
|
||||
3. **Generate 3 concrete project ideas** that satisfy the constraint
|
||||
4. **If they pick one, build it** — create the project, write the code, ship it
|
||||
|
||||
## The Rule
|
||||
|
||||
Every prompt is interpreted as broadly as possible. "Does this include X?" → Yes. The prompts provide direction and mild constraint. Without either, there is no creativity.
|
||||
|
||||
## Constraint Library
|
||||
|
||||
### For Developers
|
||||
|
||||
**Solve your own itch:**
|
||||
Build the tool you wished existed this week. Under 50 lines. Ship it today.
|
||||
|
||||
**Automate the annoying thing:**
|
||||
What's the most tedious part of your workflow? Script it away. Two hours to fix a problem that costs you five minutes a day.
|
||||
|
||||
**The CLI tool that should exist:**
|
||||
Think of a command you've wished you could type. `git undo-that-thing-i-just-did`. `docker why-is-this-broken`. `npm explain-yourself`. Now build it.
|
||||
|
||||
**Nothing new except glue:**
|
||||
Make something entirely from existing APIs, libraries, and datasets. The only original contribution is how you connect them.
|
||||
|
||||
**Frankenstein week:**
|
||||
Take something that does X and make it do Y. A git repo that plays music. A Dockerfile that generates poetry. A cron job that sends compliments.
|
||||
|
||||
**Subtract:**
|
||||
How much can you remove from a codebase before it breaks? Strip a tool to its minimum viable function. Delete until only the essence remains.
|
||||
|
||||
**High concept, low effort:**
|
||||
A deep idea, lazily executed. The concept should be brilliant. The implementation should take an afternoon. If it takes longer, you're overthinking it.
|
||||
|
||||
### For Makers & Artists
|
||||
|
||||
**Blatantly copy something:**
|
||||
Pick something you admire — a tool, an artwork, an interface. Recreate it from scratch. The learning is in the gap between your version and theirs.
|
||||
|
||||
**One million of something:**
|
||||
One million is both a lot and not that much. One million pixels is a 1MB photo. One million API calls is a Tuesday. One million of anything becomes interesting at scale.
|
||||
|
||||
**Make something that dies:**
|
||||
A website that loses a feature every day. A chatbot that forgets. A countdown to nothing. An exercise in rot, killing, or letting go.
|
||||
|
||||
**Do a lot of math:**
|
||||
Generative geometry, shader golf, mathematical art, computational origami. Time to re-learn what an arcsin is.
|
||||
|
||||
### For Anyone
|
||||
|
||||
**Text is the universal interface:**
|
||||
Build something where text is the only interface. No buttons, no graphics, just words in and words out. Text can go in and out of almost anything.
|
||||
|
||||
**Start at the punchline:**
|
||||
Think of something that would be a funny sentence. Work backwards to make it real. "I taught my thermostat to gaslight me" → now build it.
|
||||
|
||||
**Hostile UI:**
|
||||
Make something intentionally painful to use. A password field that requires 47 conditions. A form where every label lies. A CLI that judges your commands.
|
||||
|
||||
**Take two:**
|
||||
Remember an old project. Do it again from scratch. No looking at the original. See what changed about how you think.
|
||||
|
||||
See `references/full-prompt-library.md` for 30+ additional constraints across communication, scale, philosophy, transformation, and more.
|
||||
|
||||
## Matching Constraints to Users
|
||||
|
||||
| User says | Pick from |
|
||||
|-----------|-----------|
|
||||
| "I want to build something" (no direction) | Random — any constraint |
|
||||
| "I'm learning [language]" | Blatantly copy something, Automate the annoying thing |
|
||||
| "I want something weird" | Hostile UI, Frankenstein week, Start at the punchline |
|
||||
| "I want something useful" | Solve your own itch, The CLI that should exist, Automate the annoying thing |
|
||||
| "I want something beautiful" | Do a lot of math, One million of something |
|
||||
| "I'm burned out" | High concept low effort, Make something that dies |
|
||||
| "Weekend project" | Nothing new except glue, Start at the punchline |
|
||||
| "I want a challenge" | One million of something, Subtract, Take two |
|
||||
|
||||
## Output Format
|
||||
|
||||
```
|
||||
## Constraint: [Name]
|
||||
> [The constraint, one sentence]
|
||||
|
||||
### Ideas
|
||||
|
||||
1. **[One-line pitch]**
|
||||
[2-3 sentences: what you'd build and why it's interesting]
|
||||
⏱ [weekend / week / month] • 🔧 [stack]
|
||||
|
||||
2. **[One-line pitch]**
|
||||
[2-3 sentences]
|
||||
⏱ ... • 🔧 ...
|
||||
|
||||
3. **[One-line pitch]**
|
||||
[2-3 sentences]
|
||||
⏱ ... • 🔧 ...
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```
|
||||
## Constraint: The CLI tool that should exist
|
||||
> Think of a command you've wished you could type. Now build it.
|
||||
|
||||
### Ideas
|
||||
|
||||
1. **`git whatsup` — show what happened while you were away**
|
||||
Compares your last active commit to HEAD and summarizes what changed,
|
||||
who committed, and what PRs merged. Like a morning standup from your repo.
|
||||
⏱ weekend • 🔧 Python, GitPython, click
|
||||
|
||||
2. **`explain 503` — HTTP status codes for humans**
|
||||
Pipe any status code or error message and get a plain-English explanation
|
||||
with common causes and fixes. Pulls from a curated database, not an LLM.
|
||||
⏱ weekend • 🔧 Rust or Go, static dataset
|
||||
|
||||
3. **`deps why <package>` — why is this in my dependency tree**
|
||||
Traces a transitive dependency back to the direct dependency that pulled
|
||||
it in. Answers "why do I have 47 copies of lodash" in one command.
|
||||
⏱ weekend • 🔧 Node.js, npm/yarn lockfile parsing
|
||||
```
|
||||
|
||||
After the user picks one, start building — create the project, write the code, iterate.
|
||||
|
||||
## Attribution
|
||||
|
||||
Constraint approach inspired by [wttdotm.com/prompts.html](https://wttdotm.com/prompts.html). Adapted and expanded for software development and general-purpose ideation.
|
||||
@@ -0,0 +1,110 @@
|
||||
# Full Prompt Library
|
||||
|
||||
Extended constraint library beyond the core set in SKILL.md. Load these when the user wants more variety or a specific category.
|
||||
|
||||
## Communication & Connection
|
||||
|
||||
**Create a means of distribution:**
|
||||
The project works when you can use what you made to give something to somebody else.
|
||||
|
||||
**Make a way to communicate:**
|
||||
The project works when you can hold a conversation with someone else using what you created. Not chat — something weirder.
|
||||
|
||||
**Write a love letter:**
|
||||
To a person, a programming language, a game, a place, a tool. On paper, in code, in music, in light. Mail it.
|
||||
|
||||
**Mail chess / Asynchronous games:**
|
||||
Something turn-based played with no time limit. No requirement to be there at the same time. The game happens in the gaps.
|
||||
|
||||
**Twitch plays X:**
|
||||
A group of people share control over something. Collective input, emergent behavior.
|
||||
|
||||
## Screens & Interfaces
|
||||
|
||||
**Something for your desktop:**
|
||||
You spend a lot of time there. Spruce it up. A custom clock, a pet that lives in your terminal, a wallpaper that changes based on your git activity.
|
||||
|
||||
**One screen, two screen, old screen, new screen:**
|
||||
Take something you associate with one screen and put it on a very different one. DOOM on a smart fridge. A spreadsheet on a watch. A terminal in a painting.
|
||||
|
||||
**Make a mirror:**
|
||||
Something that reflects the viewer back at themselves. A website that shows your browsing history. A CLI that prints your git sins.
|
||||
|
||||
## Philosophy & Concept
|
||||
|
||||
**Code as koan, koan as code:**
|
||||
What is the sound of one hand clapping? A program that answers a question it wasn't asked. A function that returns before it's called.
|
||||
|
||||
**The useless tree:**
|
||||
Make something useless. Deliberately, completely, beautifully useless. No utility. No purpose. No point. That's the point.
|
||||
|
||||
**Artificial stupidity:**
|
||||
Make fun of AI by showcasing its faults. Mistrain it. Lie to it. Build the opposite of what AI is supposed to be good at.
|
||||
|
||||
**"I use technology in order to hate it properly":**
|
||||
Make something inspired by the tension between loving and hating your tools.
|
||||
|
||||
**The more things change, the more they stay the same:**
|
||||
Reflect on time, difference, and similarity.
|
||||
|
||||
## Transformation
|
||||
|
||||
**Translate:**
|
||||
Take something meant for one audience and make it understandable by another. A research paper as a children's book. An API as a board game. A song as an architecture diagram.
|
||||
|
||||
**I mean, I GUESS you could store something that way:**
|
||||
The project works when you can save and open something. Store data in DNS caches. Encode a novel in emoji. Write a file system on top of something that isn't a file system.
|
||||
|
||||
**I mean, I GUESS those could be pixels:**
|
||||
The project works when you can display an image. Render anything visual in a medium that wasn't meant for rendering.
|
||||
|
||||
## Identity & Reflection
|
||||
|
||||
**Make a self-portrait:**
|
||||
Be yourself? Be fake? Be real? In code, in data, in sound, in a directory structure.
|
||||
|
||||
**Make a pun:**
|
||||
The stupider the better. Physical, digital, linguistic, visual. The project IS the joke.
|
||||
|
||||
**Doors, walls, borders, barriers, boundaries:**
|
||||
Things that intermediate two places: opening, closing, permeating, excluding, combining.
|
||||
|
||||
## Scale & Repetition
|
||||
|
||||
**Lists!:**
|
||||
Itemizations, taxonomies, exhaustive recountings, iterations. This one. A list of list of lists.
|
||||
|
||||
**Did you mean *recursion*?**
|
||||
Did you mean recursion?
|
||||
|
||||
**Animals:**
|
||||
Lions, and tigers, and bears. Crab logic gates. Fish plays the stock market.
|
||||
|
||||
**Cats:**
|
||||
Where would the internet be without them.
|
||||
|
||||
## Starting Points
|
||||
|
||||
**An idea that comes from a book:**
|
||||
Read something. Make something inspired by it.
|
||||
|
||||
**Go to a museum:**
|
||||
Project ensues.
|
||||
|
||||
**NPC loot:**
|
||||
What do you drop when you die? What do you take on your journey? Build the item.
|
||||
|
||||
**Mythological objects and entities:**
|
||||
Pandora's box, the ocarina of time, the palantir. Build the artifact.
|
||||
|
||||
**69:**
|
||||
Nice. Make something with the joke being the number 69.
|
||||
|
||||
**Office Space printer scene:**
|
||||
Capture the same energy. Channel the catharsis of destroying the thing that frustrates you.
|
||||
|
||||
**Borges week:**
|
||||
Something inspired by the Argentine. The library of babel. The map that is the territory.
|
||||
|
||||
**Lights!:**
|
||||
LED throwies, light installations, illuminated anything. Make something that glows.
|
||||
194
skills/creative/excalidraw/SKILL.md
Normal file
194
skills/creative/excalidraw/SKILL.md
Normal file
@@ -0,0 +1,194 @@
|
||||
---
|
||||
name: excalidraw
|
||||
description: Create hand-drawn style diagrams using Excalidraw JSON format. Generate .excalidraw files for architecture diagrams, flowcharts, sequence diagrams, concept maps, and more. Files can be opened at excalidraw.com or uploaded for shareable links.
|
||||
version: 1.0.0
|
||||
author: Hermes Agent
|
||||
license: MIT
|
||||
dependencies: []
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [Excalidraw, Diagrams, Flowcharts, Architecture, Visualization, JSON]
|
||||
related_skills: []
|
||||
|
||||
---
|
||||
|
||||
# Excalidraw Diagram Skill
|
||||
|
||||
Create diagrams by writing standard Excalidraw element JSON and saving as `.excalidraw` files. These files can be drag-and-dropped onto [excalidraw.com](https://excalidraw.com) for viewing and editing. No accounts, no API keys, no rendering libraries -- just JSON.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. **Load this skill** (you already did)
|
||||
2. **Write the elements JSON** -- an array of Excalidraw element objects
|
||||
3. **Save the file** using `write_file` to create a `.excalidraw` file
|
||||
4. **Optionally upload** for a shareable link using `scripts/upload.py` via `terminal`
|
||||
|
||||
### Saving a Diagram
|
||||
|
||||
Wrap your elements array in the standard `.excalidraw` envelope and save with `write_file`:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "excalidraw",
|
||||
"version": 2,
|
||||
"source": "hermes-agent",
|
||||
"elements": [ ...your elements array here... ],
|
||||
"appState": {
|
||||
"viewBackgroundColor": "#ffffff"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Save to any path, e.g. `~/diagrams/my_diagram.excalidraw`.
|
||||
|
||||
### Uploading for a Shareable Link
|
||||
|
||||
Run the upload script (located in this skill's `scripts/` directory) via terminal:
|
||||
|
||||
```bash
|
||||
python skills/diagramming/excalidraw/scripts/upload.py ~/diagrams/my_diagram.excalidraw
|
||||
```
|
||||
|
||||
This uploads to excalidraw.com (no account needed) and prints a shareable URL. Requires the `cryptography` pip package (`pip install cryptography`).
|
||||
|
||||
---
|
||||
|
||||
## Element Format Reference
|
||||
|
||||
### Required Fields (all elements)
|
||||
`type`, `id` (unique string), `x`, `y`, `width`, `height`
|
||||
|
||||
### Defaults (skip these -- they're applied automatically)
|
||||
- `strokeColor`: `"#1e1e1e"`
|
||||
- `backgroundColor`: `"transparent"`
|
||||
- `fillStyle`: `"solid"`
|
||||
- `strokeWidth`: `2`
|
||||
- `roughness`: `1` (hand-drawn look)
|
||||
- `opacity`: `100`
|
||||
|
||||
Canvas background is white.
|
||||
|
||||
### Element Types
|
||||
|
||||
**Rectangle**:
|
||||
```json
|
||||
{ "type": "rectangle", "id": "r1", "x": 100, "y": 100, "width": 200, "height": 100 }
|
||||
```
|
||||
- `roundness: { "type": 3 }` for rounded corners
|
||||
- `backgroundColor: "#a5d8ff"`, `fillStyle: "solid"` for filled
|
||||
|
||||
**Ellipse**:
|
||||
```json
|
||||
{ "type": "ellipse", "id": "e1", "x": 100, "y": 100, "width": 150, "height": 150 }
|
||||
```
|
||||
|
||||
**Diamond**:
|
||||
```json
|
||||
{ "type": "diamond", "id": "d1", "x": 100, "y": 100, "width": 150, "height": 150 }
|
||||
```
|
||||
|
||||
**Labeled shape (container binding)** -- create a text element bound to the shape:
|
||||
|
||||
> **WARNING:** Do NOT use `"label": { "text": "..." }` on shapes. This is NOT a valid
|
||||
> Excalidraw property and will be silently ignored, producing blank shapes. You MUST
|
||||
> use the container binding approach below.
|
||||
|
||||
The shape needs `boundElements` listing the text, and the text needs `containerId` pointing back:
|
||||
```json
|
||||
{ "type": "rectangle", "id": "r1", "x": 100, "y": 100, "width": 200, "height": 80,
|
||||
"roundness": { "type": 3 }, "backgroundColor": "#a5d8ff", "fillStyle": "solid",
|
||||
"boundElements": [{ "id": "t_r1", "type": "text" }] },
|
||||
{ "type": "text", "id": "t_r1", "x": 105, "y": 110, "width": 190, "height": 25,
|
||||
"text": "Hello", "fontSize": 20, "fontFamily": 1, "strokeColor": "#1e1e1e",
|
||||
"textAlign": "center", "verticalAlign": "middle",
|
||||
"containerId": "r1", "originalText": "Hello", "autoResize": true }
|
||||
```
|
||||
- Works on rectangle, ellipse, diamond
|
||||
- Text is auto-centered by Excalidraw when `containerId` is set
|
||||
- The text `x`/`y`/`width`/`height` are approximate -- Excalidraw recalculates them on load
|
||||
- `originalText` should match `text`
|
||||
- Always include `fontFamily: 1` (Virgil/hand-drawn font)
|
||||
|
||||
**Labeled arrow** -- same container binding approach:
|
||||
```json
|
||||
{ "type": "arrow", "id": "a1", "x": 300, "y": 150, "width": 200, "height": 0,
|
||||
"points": [[0,0],[200,0]], "endArrowhead": "arrow",
|
||||
"boundElements": [{ "id": "t_a1", "type": "text" }] },
|
||||
{ "type": "text", "id": "t_a1", "x": 370, "y": 130, "width": 60, "height": 20,
|
||||
"text": "connects", "fontSize": 16, "fontFamily": 1, "strokeColor": "#1e1e1e",
|
||||
"textAlign": "center", "verticalAlign": "middle",
|
||||
"containerId": "a1", "originalText": "connects", "autoResize": true }
|
||||
```
|
||||
|
||||
**Standalone text** (titles and annotations only -- no container):
|
||||
```json
|
||||
{ "type": "text", "id": "t1", "x": 150, "y": 138, "text": "Hello", "fontSize": 20,
|
||||
"fontFamily": 1, "strokeColor": "#1e1e1e", "originalText": "Hello", "autoResize": true }
|
||||
```
|
||||
- `x` is the LEFT edge. To center at position `cx`: `x = cx - (text.length * fontSize * 0.5) / 2`
|
||||
- Do NOT rely on `textAlign` or `width` for positioning
|
||||
|
||||
**Arrow**:
|
||||
```json
|
||||
{ "type": "arrow", "id": "a1", "x": 300, "y": 150, "width": 200, "height": 0,
|
||||
"points": [[0,0],[200,0]], "endArrowhead": "arrow" }
|
||||
```
|
||||
- `points`: `[dx, dy]` offsets from element `x`, `y`
|
||||
- `endArrowhead`: `null` | `"arrow"` | `"bar"` | `"dot"` | `"triangle"`
|
||||
- `strokeStyle`: `"solid"` (default) | `"dashed"` | `"dotted"`
|
||||
|
||||
### Arrow Bindings (connect arrows to shapes)
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "arrow", "id": "a1", "x": 300, "y": 150, "width": 150, "height": 0,
|
||||
"points": [[0,0],[150,0]], "endArrowhead": "arrow",
|
||||
"startBinding": { "elementId": "r1", "fixedPoint": [1, 0.5] },
|
||||
"endBinding": { "elementId": "r2", "fixedPoint": [0, 0.5] }
|
||||
}
|
||||
```
|
||||
|
||||
`fixedPoint` coordinates: `top=[0.5,0]`, `bottom=[0.5,1]`, `left=[0,0.5]`, `right=[1,0.5]`
|
||||
|
||||
### Drawing Order (z-order)
|
||||
- Array order = z-order (first = back, last = front)
|
||||
- Emit progressively: background zones → shape → its bound text → its arrows → next shape
|
||||
- BAD: all rectangles, then all texts, then all arrows
|
||||
- GOOD: bg_zone → shape1 → text_for_shape1 → arrow1 → arrow_label_text → shape2 → text_for_shape2 → ...
|
||||
- Always place the bound text element immediately after its container shape
|
||||
|
||||
### Sizing Guidelines
|
||||
|
||||
**Font sizes:**
|
||||
- Minimum `fontSize`: **16** for body text, labels, descriptions
|
||||
- Minimum `fontSize`: **20** for titles and headings
|
||||
- Minimum `fontSize`: **14** for secondary annotations only (sparingly)
|
||||
- NEVER use `fontSize` below 14
|
||||
|
||||
**Element sizes:**
|
||||
- Minimum shape size: 120x60 for labeled rectangles/ellipses
|
||||
- Leave 20-30px gaps between elements minimum
|
||||
- Prefer fewer, larger elements over many tiny ones
|
||||
|
||||
### Color Palette
|
||||
|
||||
See `references/colors.md` for full color tables. Quick reference:
|
||||
|
||||
| Use | Fill Color | Hex |
|
||||
|-----|-----------|-----|
|
||||
| Primary / Input | Light Blue | `#a5d8ff` |
|
||||
| Success / Output | Light Green | `#b2f2bb` |
|
||||
| Warning / External | Light Orange | `#ffd8a8` |
|
||||
| Processing / Special | Light Purple | `#d0bfff` |
|
||||
| Error / Critical | Light Red | `#ffc9c9` |
|
||||
| Notes / Decisions | Light Yellow | `#fff3bf` |
|
||||
| Storage / Data | Light Teal | `#c3fae8` |
|
||||
|
||||
### Tips
|
||||
- Use the color palette consistently across the diagram
|
||||
- **Text contrast is CRITICAL** -- never use light gray on white backgrounds. Minimum text color on white: `#757575`
|
||||
- Do NOT use emoji in text -- they don't render in Excalidraw's font
|
||||
- For dark mode diagrams, see `references/dark-mode.md`
|
||||
- For larger examples, see `references/examples.md`
|
||||
|
||||
|
||||
44
skills/creative/excalidraw/references/colors.md
Normal file
44
skills/creative/excalidraw/references/colors.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# Excalidraw Color Palette
|
||||
|
||||
Use these colors consistently across diagrams.
|
||||
|
||||
## Primary Colors (for strokes, arrows, and accents)
|
||||
|
||||
| Name | Hex | Use |
|
||||
|------|-----|-----|
|
||||
| Blue | `#4a9eed` | Primary actions, links, data series 1 |
|
||||
| Amber | `#f59e0b` | Warnings, highlights, data series 2 |
|
||||
| Green | `#22c55e` | Success, positive, data series 3 |
|
||||
| Red | `#ef4444` | Errors, negative, data series 4 |
|
||||
| Purple | `#8b5cf6` | Accents, special items, data series 5 |
|
||||
| Pink | `#ec4899` | Decorative, data series 6 |
|
||||
| Cyan | `#06b6d4` | Info, secondary, data series 7 |
|
||||
| Lime | `#84cc16` | Extra, data series 8 |
|
||||
|
||||
## Pastel Fills (for shape backgrounds)
|
||||
|
||||
| Color | Hex | Good For |
|
||||
|-------|-----|----------|
|
||||
| Light Blue | `#a5d8ff` | Input, sources, primary nodes |
|
||||
| Light Green | `#b2f2bb` | Success, output, completed |
|
||||
| Light Orange | `#ffd8a8` | Warning, pending, external |
|
||||
| Light Purple | `#d0bfff` | Processing, middleware, special |
|
||||
| Light Red | `#ffc9c9` | Error, critical, alerts |
|
||||
| Light Yellow | `#fff3bf` | Notes, decisions, planning |
|
||||
| Light Teal | `#c3fae8` | Storage, data, memory |
|
||||
| Light Pink | `#eebefa` | Analytics, metrics |
|
||||
|
||||
## Background Zones (use with opacity: 30-35 for layered diagrams)
|
||||
|
||||
| Color | Hex | Good For |
|
||||
|-------|-----|----------|
|
||||
| Blue zone | `#dbe4ff` | UI / frontend layer |
|
||||
| Purple zone | `#e5dbff` | Logic / agent layer |
|
||||
| Green zone | `#d3f9d8` | Data / tool layer |
|
||||
|
||||
## Text Contrast Rules
|
||||
|
||||
- **On white backgrounds**: minimum text color is `#757575`. Default `#1e1e1e` is best.
|
||||
- **Colored text on light fills**: use dark variants (`#15803d` not `#22c55e`, `#2563eb` not `#4a9eed`)
|
||||
- **White text**: only on dark backgrounds (`#9a5030` not `#c4795b`)
|
||||
- **Never**: light gray (`#b0b0b0`, `#999`) on white -- unreadable
|
||||
68
skills/creative/excalidraw/references/dark-mode.md
Normal file
68
skills/creative/excalidraw/references/dark-mode.md
Normal file
@@ -0,0 +1,68 @@
|
||||
# Excalidraw Dark Mode Diagrams
|
||||
|
||||
To create a dark-themed diagram, use a massive dark background rectangle as the **first element** in the array. Make it large enough to cover any viewport:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "rectangle", "id": "darkbg",
|
||||
"x": -4000, "y": -3000, "width": 10000, "height": 7500,
|
||||
"backgroundColor": "#1e1e2e", "fillStyle": "solid",
|
||||
"strokeColor": "transparent", "strokeWidth": 0
|
||||
}
|
||||
```
|
||||
|
||||
Then use the following color palettes for elements on the dark background.
|
||||
|
||||
## Text Colors (on dark)
|
||||
|
||||
| Color | Hex | Use |
|
||||
|-------|-----|-----|
|
||||
| White | `#e5e5e5` | Primary text, titles |
|
||||
| Muted | `#a0a0a0` | Secondary text, annotations |
|
||||
| NEVER | `#555` or darker | Invisible on dark bg! |
|
||||
|
||||
## Shape Fills (on dark)
|
||||
|
||||
| Color | Hex | Good For |
|
||||
|-------|-----|----------|
|
||||
| Dark Blue | `#1e3a5f` | Primary nodes |
|
||||
| Dark Green | `#1a4d2e` | Success, output |
|
||||
| Dark Purple | `#2d1b69` | Processing, special |
|
||||
| Dark Orange | `#5c3d1a` | Warning, pending |
|
||||
| Dark Red | `#5c1a1a` | Error, critical |
|
||||
| Dark Teal | `#1a4d4d` | Storage, data |
|
||||
|
||||
## Stroke and Arrow Colors (on dark)
|
||||
|
||||
Use the standard Primary Colors from the main color palette -- they're bright enough on dark backgrounds:
|
||||
- Blue `#4a9eed`, Amber `#f59e0b`, Green `#22c55e`, Red `#ef4444`, Purple `#8b5cf6`
|
||||
|
||||
For subtle shape borders, use `#555555`.
|
||||
|
||||
## Example: Dark mode labeled rectangle
|
||||
|
||||
Use container binding (NOT the `"label"` property, which doesn't work). On dark backgrounds, set text `strokeColor` to `"#e5e5e5"` so it's visible:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"type": "rectangle", "id": "r1",
|
||||
"x": 100, "y": 100, "width": 200, "height": 80,
|
||||
"backgroundColor": "#1e3a5f", "fillStyle": "solid",
|
||||
"strokeColor": "#4a9eed", "strokeWidth": 2,
|
||||
"roundness": { "type": 3 },
|
||||
"boundElements": [{ "id": "t_r1", "type": "text" }]
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "t_r1",
|
||||
"x": 105, "y": 120, "width": 190, "height": 25,
|
||||
"text": "Dark Node", "fontSize": 20, "fontFamily": 1,
|
||||
"strokeColor": "#e5e5e5",
|
||||
"textAlign": "center", "verticalAlign": "middle",
|
||||
"containerId": "r1", "originalText": "Dark Node", "autoResize": true
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
Note: For standalone text elements on dark backgrounds, always set `"strokeColor": "#e5e5e5"` explicitly. The default `#1e1e1e` is invisible on dark.
|
||||
|
||||
141
skills/creative/excalidraw/references/examples.md
Normal file
141
skills/creative/excalidraw/references/examples.md
Normal file
@@ -0,0 +1,141 @@
|
||||
# Excalidraw Diagram Examples
|
||||
|
||||
Complete, copy-pasteable examples. Wrap each in the `.excalidraw` envelope before saving:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "excalidraw",
|
||||
"version": 2,
|
||||
"source": "hermes-agent",
|
||||
"elements": [ ...elements from examples below... ],
|
||||
"appState": { "viewBackgroundColor": "#ffffff" }
|
||||
}
|
||||
```
|
||||
|
||||
> **IMPORTANT:** All text labels on shapes and arrows use container binding (`containerId` + `boundElements`).
|
||||
> Do NOT use the non-existent `"label"` property -- it will be silently ignored, producing blank shapes.
|
||||
|
||||
---
|
||||
|
||||
## Example 1: Two Connected Labeled Boxes
|
||||
|
||||
A minimal flowchart with two boxes and an arrow between them.
|
||||
|
||||
```json
|
||||
[
|
||||
{ "type": "text", "id": "title", "x": 280, "y": 30, "text": "Simple Flow", "fontSize": 28, "fontFamily": 1, "strokeColor": "#1e1e1e", "originalText": "Simple Flow", "autoResize": true },
|
||||
{ "type": "rectangle", "id": "b1", "x": 100, "y": 100, "width": 200, "height": 100, "roundness": { "type": 3 }, "backgroundColor": "#a5d8ff", "fillStyle": "solid", "boundElements": [{ "id": "t_b1", "type": "text" }, { "id": "a1", "type": "arrow" }] },
|
||||
{ "type": "text", "id": "t_b1", "x": 105, "y": 130, "width": 190, "height": 25, "text": "Start", "fontSize": 20, "fontFamily": 1, "strokeColor": "#1e1e1e", "textAlign": "center", "verticalAlign": "middle", "containerId": "b1", "originalText": "Start", "autoResize": true },
|
||||
{ "type": "rectangle", "id": "b2", "x": 450, "y": 100, "width": 200, "height": 100, "roundness": { "type": 3 }, "backgroundColor": "#b2f2bb", "fillStyle": "solid", "boundElements": [{ "id": "t_b2", "type": "text" }, { "id": "a1", "type": "arrow" }] },
|
||||
{ "type": "text", "id": "t_b2", "x": 455, "y": 130, "width": 190, "height": 25, "text": "End", "fontSize": 20, "fontFamily": 1, "strokeColor": "#1e1e1e", "textAlign": "center", "verticalAlign": "middle", "containerId": "b2", "originalText": "End", "autoResize": true },
|
||||
{ "type": "arrow", "id": "a1", "x": 300, "y": 150, "width": 150, "height": 0, "points": [[0,0],[150,0]], "endArrowhead": "arrow", "startBinding": { "elementId": "b1", "fixedPoint": [1, 0.5] }, "endBinding": { "elementId": "b2", "fixedPoint": [0, 0.5] } }
|
||||
]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Example 2: Photosynthesis Process Diagram
|
||||
|
||||
A larger diagram with background zones, multiple nodes, and directional arrows showing inputs/outputs.
|
||||
|
||||
```json
|
||||
[
|
||||
{"type":"text","id":"ti","x":280,"y":10,"text":"Photosynthesis","fontSize":28,"fontFamily":1,"strokeColor":"#1e1e1e","originalText":"Photosynthesis","autoResize":true},
|
||||
{"type":"text","id":"fo","x":245,"y":48,"text":"6CO2 + 6H2O --> C6H12O6 + 6O2","fontSize":16,"fontFamily":1,"strokeColor":"#757575","originalText":"6CO2 + 6H2O --> C6H12O6 + 6O2","autoResize":true},
|
||||
{"type":"rectangle","id":"lf","x":150,"y":90,"width":520,"height":380,"backgroundColor":"#d3f9d8","fillStyle":"solid","roundness":{"type":3},"strokeColor":"#22c55e","strokeWidth":1,"opacity":35},
|
||||
{"type":"text","id":"lfl","x":170,"y":96,"text":"Inside the Leaf","fontSize":16,"fontFamily":1,"strokeColor":"#15803d","originalText":"Inside the Leaf","autoResize":true},
|
||||
|
||||
{"type":"rectangle","id":"lr","x":190,"y":190,"width":160,"height":70,"backgroundColor":"#fff3bf","fillStyle":"solid","roundness":{"type":3},"strokeColor":"#f59e0b","boundElements":[{"id":"t_lr","type":"text"},{"id":"a1","type":"arrow"},{"id":"a2","type":"arrow"},{"id":"a3","type":"arrow"},{"id":"a5","type":"arrow"}]},
|
||||
{"type":"text","id":"t_lr","x":195,"y":205,"width":150,"height":20,"text":"Light Reactions","fontSize":16,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"lr","originalText":"Light Reactions","autoResize":true},
|
||||
|
||||
{"type":"arrow","id":"a1","x":350,"y":225,"width":120,"height":0,"points":[[0,0],[120,0]],"strokeColor":"#1e1e1e","strokeWidth":2,"endArrowhead":"arrow","boundElements":[{"id":"t_a1","type":"text"}]},
|
||||
{"type":"text","id":"t_a1","x":390,"y":205,"width":40,"height":20,"text":"ATP","fontSize":14,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"a1","originalText":"ATP","autoResize":true},
|
||||
|
||||
{"type":"rectangle","id":"cc","x":470,"y":190,"width":160,"height":70,"backgroundColor":"#d0bfff","fillStyle":"solid","roundness":{"type":3},"strokeColor":"#8b5cf6","boundElements":[{"id":"t_cc","type":"text"},{"id":"a1","type":"arrow"},{"id":"a4","type":"arrow"},{"id":"a6","type":"arrow"}]},
|
||||
{"type":"text","id":"t_cc","x":475,"y":205,"width":150,"height":20,"text":"Calvin Cycle","fontSize":16,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"cc","originalText":"Calvin Cycle","autoResize":true},
|
||||
|
||||
{"type":"rectangle","id":"sl","x":10,"y":200,"width":120,"height":50,"backgroundColor":"#fff3bf","fillStyle":"solid","roundness":{"type":3},"strokeColor":"#f59e0b","boundElements":[{"id":"t_sl","type":"text"},{"id":"a2","type":"arrow"}]},
|
||||
{"type":"text","id":"t_sl","x":15,"y":210,"width":110,"height":20,"text":"Sunlight","fontSize":16,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"sl","originalText":"Sunlight","autoResize":true},
|
||||
|
||||
{"type":"arrow","id":"a2","x":130,"y":225,"width":60,"height":0,"points":[[0,0],[60,0]],"strokeColor":"#f59e0b","strokeWidth":2,"endArrowhead":"arrow"},
|
||||
|
||||
{"type":"rectangle","id":"wa","x":200,"y":360,"width":140,"height":50,"backgroundColor":"#a5d8ff","fillStyle":"solid","roundness":{"type":3},"strokeColor":"#4a9eed","boundElements":[{"id":"t_wa","type":"text"},{"id":"a3","type":"arrow"}]},
|
||||
{"type":"text","id":"t_wa","x":205,"y":370,"width":130,"height":20,"text":"Water (H2O)","fontSize":16,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"wa","originalText":"Water (H2O)","autoResize":true},
|
||||
|
||||
{"type":"arrow","id":"a3","x":270,"y":360,"width":0,"height":-100,"points":[[0,0],[0,-100]],"strokeColor":"#4a9eed","strokeWidth":2,"endArrowhead":"arrow"},
|
||||
|
||||
{"type":"rectangle","id":"co","x":480,"y":360,"width":130,"height":50,"backgroundColor":"#ffd8a8","fillStyle":"solid","roundness":{"type":3},"strokeColor":"#f59e0b","boundElements":[{"id":"t_co","type":"text"},{"id":"a4","type":"arrow"}]},
|
||||
{"type":"text","id":"t_co","x":485,"y":370,"width":120,"height":20,"text":"CO2","fontSize":16,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"co","originalText":"CO2","autoResize":true},
|
||||
|
||||
{"type":"arrow","id":"a4","x":545,"y":360,"width":0,"height":-100,"points":[[0,0],[0,-100]],"strokeColor":"#f59e0b","strokeWidth":2,"endArrowhead":"arrow"},
|
||||
|
||||
{"type":"rectangle","id":"ox","x":540,"y":100,"width":100,"height":40,"backgroundColor":"#ffc9c9","fillStyle":"solid","roundness":{"type":3},"strokeColor":"#ef4444","boundElements":[{"id":"t_ox","type":"text"},{"id":"a5","type":"arrow"}]},
|
||||
{"type":"text","id":"t_ox","x":545,"y":105,"width":90,"height":20,"text":"O2","fontSize":16,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"ox","originalText":"O2","autoResize":true},
|
||||
|
||||
{"type":"arrow","id":"a5","x":310,"y":190,"width":230,"height":-50,"points":[[0,0],[230,-50]],"strokeColor":"#ef4444","strokeWidth":2,"endArrowhead":"arrow"},
|
||||
|
||||
{"type":"rectangle","id":"gl","x":690,"y":195,"width":120,"height":60,"backgroundColor":"#c3fae8","fillStyle":"solid","roundness":{"type":3},"strokeColor":"#22c55e","boundElements":[{"id":"t_gl","type":"text"},{"id":"a6","type":"arrow"}]},
|
||||
{"type":"text","id":"t_gl","x":695,"y":210,"width":110,"height":25,"text":"Glucose","fontSize":18,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"gl","originalText":"Glucose","autoResize":true},
|
||||
|
||||
{"type":"arrow","id":"a6","x":630,"y":225,"width":60,"height":0,"points":[[0,0],[60,0]],"strokeColor":"#22c55e","strokeWidth":2,"endArrowhead":"arrow"},
|
||||
|
||||
{"type":"ellipse","id":"sun","x":30,"y":110,"width":50,"height":50,"backgroundColor":"#fff3bf","fillStyle":"solid","strokeColor":"#f59e0b","strokeWidth":2},
|
||||
{"type":"arrow","id":"r1","x":55,"y":108,"width":0,"height":-14,"points":[[0,0],[0,-14]],"strokeColor":"#f59e0b","strokeWidth":2,"endArrowhead":null,"startArrowhead":null},
|
||||
{"type":"arrow","id":"r2","x":55,"y":162,"width":0,"height":14,"points":[[0,0],[0,14]],"strokeColor":"#f59e0b","strokeWidth":2,"endArrowhead":null,"startArrowhead":null},
|
||||
{"type":"arrow","id":"r3","x":28,"y":135,"width":-14,"height":0,"points":[[0,0],[-14,0]],"strokeColor":"#f59e0b","strokeWidth":2,"endArrowhead":null,"startArrowhead":null},
|
||||
{"type":"arrow","id":"r4","x":82,"y":135,"width":14,"height":0,"points":[[0,0],[14,0]],"strokeColor":"#f59e0b","strokeWidth":2,"endArrowhead":null,"startArrowhead":null}
|
||||
]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Example 3: Sequence Diagram (UML-style)
|
||||
|
||||
Demonstrates a sequence diagram with actors, dashed lifelines, and message arrows.
|
||||
|
||||
```json
|
||||
[
|
||||
{"type":"text","id":"title","x":200,"y":15,"text":"MCP Apps -- Sequence Flow","fontSize":24,"fontFamily":1,"strokeColor":"#1e1e1e","originalText":"MCP Apps -- Sequence Flow","autoResize":true},
|
||||
|
||||
{"type":"rectangle","id":"uHead","x":60,"y":60,"width":100,"height":40,"backgroundColor":"#a5d8ff","fillStyle":"solid","roundness":{"type":3},"strokeColor":"#4a9eed","strokeWidth":2,"boundElements":[{"id":"t_uHead","type":"text"}]},
|
||||
{"type":"text","id":"t_uHead","x":65,"y":65,"width":90,"height":20,"text":"User","fontSize":16,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"uHead","originalText":"User","autoResize":true},
|
||||
|
||||
{"type":"arrow","id":"uLine","x":110,"y":100,"width":0,"height":400,"points":[[0,0],[0,400]],"strokeColor":"#b0b0b0","strokeWidth":1,"strokeStyle":"dashed","endArrowhead":null},
|
||||
|
||||
{"type":"rectangle","id":"aHead","x":230,"y":60,"width":100,"height":40,"backgroundColor":"#d0bfff","fillStyle":"solid","roundness":{"type":3},"strokeColor":"#8b5cf6","strokeWidth":2,"boundElements":[{"id":"t_aHead","type":"text"}]},
|
||||
{"type":"text","id":"t_aHead","x":235,"y":65,"width":90,"height":20,"text":"Agent","fontSize":16,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"aHead","originalText":"Agent","autoResize":true},
|
||||
|
||||
{"type":"arrow","id":"aLine","x":280,"y":100,"width":0,"height":400,"points":[[0,0],[0,400]],"strokeColor":"#b0b0b0","strokeWidth":1,"strokeStyle":"dashed","endArrowhead":null},
|
||||
|
||||
{"type":"rectangle","id":"sHead","x":420,"y":60,"width":130,"height":40,"backgroundColor":"#ffd8a8","fillStyle":"solid","roundness":{"type":3},"strokeColor":"#f59e0b","strokeWidth":2,"boundElements":[{"id":"t_sHead","type":"text"}]},
|
||||
{"type":"text","id":"t_sHead","x":425,"y":65,"width":120,"height":20,"text":"Server","fontSize":16,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"sHead","originalText":"Server","autoResize":true},
|
||||
|
||||
{"type":"arrow","id":"sLine","x":485,"y":100,"width":0,"height":400,"points":[[0,0],[0,400]],"strokeColor":"#b0b0b0","strokeWidth":1,"strokeStyle":"dashed","endArrowhead":null},
|
||||
|
||||
{"type":"arrow","id":"m1","x":110,"y":150,"width":170,"height":0,"points":[[0,0],[170,0]],"strokeColor":"#1e1e1e","strokeWidth":2,"endArrowhead":"arrow","boundElements":[{"id":"t_m1","type":"text"}]},
|
||||
{"type":"text","id":"t_m1","x":165,"y":130,"width":60,"height":20,"text":"request","fontSize":14,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"m1","originalText":"request","autoResize":true},
|
||||
|
||||
{"type":"arrow","id":"m2","x":280,"y":200,"width":205,"height":0,"points":[[0,0],[205,0]],"strokeColor":"#8b5cf6","strokeWidth":2,"endArrowhead":"arrow","boundElements":[{"id":"t_m2","type":"text"}]},
|
||||
{"type":"text","id":"t_m2","x":352,"y":180,"width":60,"height":20,"text":"tools/call","fontSize":14,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"m2","originalText":"tools/call","autoResize":true},
|
||||
|
||||
{"type":"arrow","id":"m3","x":485,"y":260,"width":-205,"height":0,"points":[[0,0],[-205,0]],"strokeColor":"#f59e0b","strokeWidth":2,"endArrowhead":"arrow","strokeStyle":"dashed","boundElements":[{"id":"t_m3","type":"text"}]},
|
||||
{"type":"text","id":"t_m3","x":352,"y":240,"width":60,"height":20,"text":"result","fontSize":14,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"m3","originalText":"result","autoResize":true},
|
||||
|
||||
{"type":"arrow","id":"m4","x":280,"y":320,"width":-170,"height":0,"points":[[0,0],[-170,0]],"strokeColor":"#8b5cf6","strokeWidth":2,"endArrowhead":"arrow","strokeStyle":"dashed","boundElements":[{"id":"t_m4","type":"text"}]},
|
||||
{"type":"text","id":"t_m4","x":165,"y":300,"width":60,"height":20,"text":"response","fontSize":14,"fontFamily":1,"strokeColor":"#1e1e1e","textAlign":"center","verticalAlign":"middle","containerId":"m4","originalText":"response","autoResize":true}
|
||||
]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Common Mistakes to Avoid
|
||||
|
||||
- **Do NOT use `"label"` property** -- this is the #1 mistake. It is NOT part of the Excalidraw file format and will be silently ignored, producing blank shapes with no visible text. Always use container binding (`containerId` + `boundElements`) as shown in the examples above.
|
||||
- **Every bound text needs both sides linked** -- the shape needs `boundElements: [{"id": "t_xxx", "type": "text"}]` AND the text needs `containerId: "shape_id"`. If either is missing, the binding won't work.
|
||||
- **Include `originalText` and `autoResize: true`** on all text elements -- Excalidraw uses these for proper text reflow.
|
||||
- **Include `fontFamily: 1`** on all text elements -- without it, text may not render with the expected hand-drawn font.
|
||||
- **Elements overlap when y-coordinates are close** -- always check that text, boxes, and labels don't stack on top of each other
|
||||
- **Arrow labels need space** -- long labels like "ATP + NADPH" overflow short arrows. Keep labels short or make arrows wider
|
||||
- **Center titles relative to the diagram** -- estimate total width and center the title text over it
|
||||
- **Draw decorations LAST** -- cute illustrations (sun, stars, icons) should appear at the end of the array so they're drawn on top
|
||||
|
||||
133
skills/creative/excalidraw/scripts/upload.py
Normal file
133
skills/creative/excalidraw/scripts/upload.py
Normal file
@@ -0,0 +1,133 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Upload an .excalidraw file to excalidraw.com and print a shareable URL.
|
||||
|
||||
No account required. The diagram is encrypted client-side (AES-GCM) before
|
||||
upload -- the encryption key is embedded in the URL fragment, so the server
|
||||
never sees plaintext.
|
||||
|
||||
Requirements:
|
||||
pip install cryptography
|
||||
|
||||
Usage:
|
||||
python upload.py <path-to-file.excalidraw>
|
||||
|
||||
Example:
|
||||
python upload.py ~/diagrams/architecture.excalidraw
|
||||
# prints: https://excalidraw.com/#json=abc123,encryptionKeyHere
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import struct
|
||||
import sys
|
||||
import zlib
|
||||
import base64
|
||||
import urllib.request
|
||||
|
||||
try:
|
||||
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
||||
except ImportError:
|
||||
print("Error: 'cryptography' package is required for upload.")
|
||||
print("Install it with: pip install cryptography")
|
||||
sys.exit(1)
|
||||
|
||||
# Excalidraw public upload endpoint (no auth needed)
|
||||
UPLOAD_URL = "https://json.excalidraw.com/api/v2/post/"
|
||||
|
||||
|
||||
def concat_buffers(*buffers: bytes) -> bytes:
|
||||
"""
|
||||
Build the Excalidraw v2 concat-buffers binary format.
|
||||
|
||||
Layout: [version=1 (4B big-endian)] then for each buffer:
|
||||
[length (4B big-endian)] [data bytes]
|
||||
"""
|
||||
parts = [struct.pack(">I", 1)] # version = 1
|
||||
for buf in buffers:
|
||||
parts.append(struct.pack(">I", len(buf)))
|
||||
parts.append(buf)
|
||||
return b"".join(parts)
|
||||
|
||||
|
||||
def upload(excalidraw_json: str) -> str:
|
||||
"""
|
||||
Encrypt and upload Excalidraw JSON to excalidraw.com.
|
||||
|
||||
Args:
|
||||
excalidraw_json: The full .excalidraw file content as a string.
|
||||
|
||||
Returns:
|
||||
Shareable URL string.
|
||||
"""
|
||||
# 1. Inner payload: concat_buffers(file_metadata, data)
|
||||
file_metadata = json.dumps({}).encode("utf-8")
|
||||
data_bytes = excalidraw_json.encode("utf-8")
|
||||
inner_payload = concat_buffers(file_metadata, data_bytes)
|
||||
|
||||
# 2. Compress with zlib
|
||||
compressed = zlib.compress(inner_payload)
|
||||
|
||||
# 3. AES-GCM 128-bit encrypt
|
||||
raw_key = os.urandom(16) # 128-bit key
|
||||
iv = os.urandom(12) # 12-byte nonce
|
||||
aesgcm = AESGCM(raw_key)
|
||||
encrypted = aesgcm.encrypt(iv, compressed, None)
|
||||
|
||||
# 4. Encoding metadata
|
||||
encoding_meta = json.dumps({
|
||||
"version": 2,
|
||||
"compression": "pako@1",
|
||||
"encryption": "AES-GCM",
|
||||
}).encode("utf-8")
|
||||
|
||||
# 5. Outer payload: concat_buffers(encoding_meta, iv, encrypted)
|
||||
payload = concat_buffers(encoding_meta, iv, encrypted)
|
||||
|
||||
# 6. Upload
|
||||
req = urllib.request.Request(UPLOAD_URL, data=payload, method="POST")
|
||||
with urllib.request.urlopen(req, timeout=30) as resp:
|
||||
if resp.status != 200:
|
||||
raise RuntimeError(f"Upload failed with HTTP {resp.status}")
|
||||
result = json.loads(resp.read().decode("utf-8"))
|
||||
|
||||
file_id = result.get("id")
|
||||
if not file_id:
|
||||
raise RuntimeError(f"Upload returned no file ID. Response: {result}")
|
||||
|
||||
# 7. Key as base64url (JWK 'k' format, no padding)
|
||||
key_b64 = base64.urlsafe_b64encode(raw_key).rstrip(b"=").decode("ascii")
|
||||
|
||||
return f"https://excalidraw.com/#json={file_id},{key_b64}"
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: python upload.py <path-to-file.excalidraw>")
|
||||
sys.exit(1)
|
||||
|
||||
file_path = sys.argv[1]
|
||||
|
||||
if not os.path.isfile(file_path):
|
||||
print(f"Error: File not found: {file_path}")
|
||||
sys.exit(1)
|
||||
|
||||
with open(file_path, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
|
||||
# Basic validation: should be valid JSON with an "elements" key
|
||||
try:
|
||||
doc = json.loads(content)
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"Error: File is not valid JSON: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
if "elements" not in doc:
|
||||
print("Warning: File does not contain an 'elements' key. Uploading anyway.")
|
||||
|
||||
url = upload(content)
|
||||
print(url)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
23
skills/creative/manim-video/README.md
Normal file
23
skills/creative/manim-video/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Manim Video Skill
|
||||
|
||||
Production pipeline for mathematical and technical animations using [Manim Community Edition](https://www.manim.community/).
|
||||
|
||||
## What it does
|
||||
|
||||
Creates 3Blue1Brown-style animated videos from text prompts. The agent handles the full pipeline: creative planning, Python code generation, rendering, scene stitching, and iterative refinement.
|
||||
|
||||
## Use cases
|
||||
|
||||
- **Concept explainers** — "Explain how neural networks learn"
|
||||
- **Equation derivations** — "Animate the proof of the Pythagorean theorem"
|
||||
- **Algorithm visualizations** — "Show how quicksort works step by step"
|
||||
- **Data stories** — "Animate our before/after performance metrics"
|
||||
- **Architecture diagrams** — "Show our microservice architecture building up"
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Python 3.10+, Manim CE (`pip install manim`), LaTeX, ffmpeg.
|
||||
|
||||
```bash
|
||||
bash skills/creative/manim-video/scripts/setup.sh
|
||||
```
|
||||
264
skills/creative/manim-video/SKILL.md
Normal file
264
skills/creative/manim-video/SKILL.md
Normal file
@@ -0,0 +1,264 @@
|
||||
---
|
||||
name: manim-video
|
||||
description: "Production pipeline for mathematical and technical animations using Manim Community Edition. Creates 3Blue1Brown-style explainer videos, algorithm visualizations, equation derivations, architecture diagrams, and data stories. Use when users request: animated explanations, math animations, concept visualizations, algorithm walkthroughs, technical explainers, 3Blue1Brown style videos, or any programmatic animation with geometric/mathematical content."
|
||||
version: 1.0.0
|
||||
---
|
||||
|
||||
# Manim Video Production Pipeline
|
||||
|
||||
## Creative Standard
|
||||
|
||||
This is educational cinema. Every frame teaches. Every animation reveals structure.
|
||||
|
||||
**Before writing a single line of code**, articulate the narrative arc. What misconception does this correct? What is the "aha moment"? What visual story takes the viewer from confusion to understanding? The user's prompt is a starting point — interpret it with pedagogical ambition.
|
||||
|
||||
**Geometry before algebra.** Show the shape first, the equation second. Visual memory encodes faster than symbolic memory. When the viewer sees the geometric pattern before the formula, the equation feels earned.
|
||||
|
||||
**First-render excellence is non-negotiable.** The output must be visually clear and aesthetically cohesive without revision rounds. If something looks cluttered, poorly timed, or like "AI-generated slides," it is wrong.
|
||||
|
||||
**Opacity layering directs attention.** Never show everything at full brightness. Primary elements at 1.0, contextual elements at 0.4, structural elements (axes, grids) at 0.15. The brain processes visual salience in layers.
|
||||
|
||||
**Breathing room.** Every animation needs `self.wait()` after it. The viewer needs time to absorb what just appeared. Never rush from one animation to the next. A 2-second pause after a key reveal is never wasted.
|
||||
|
||||
**Cohesive visual language.** All scenes share a color palette, consistent typography sizing, matching animation speeds. A technically correct video where every scene uses random different colors is an aesthetic failure.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Run `scripts/setup.sh` to verify all dependencies. Requires: Python 3.10+, Manim Community Edition v0.20+ (`pip install manim`), LaTeX (`texlive-full` on Linux, `mactex` on macOS), and ffmpeg. Reference docs tested against Manim CE v0.20.1.
|
||||
|
||||
## Modes
|
||||
|
||||
| Mode | Input | Output | Reference |
|
||||
|------|-------|--------|-----------|
|
||||
| **Concept explainer** | Topic/concept | Animated explanation with geometric intuition | `references/scene-planning.md` |
|
||||
| **Equation derivation** | Math expressions | Step-by-step animated proof | `references/equations.md` |
|
||||
| **Algorithm visualization** | Algorithm description | Step-by-step execution with data structures | `references/graphs-and-data.md` |
|
||||
| **Data story** | Data/metrics | Animated charts, comparisons, counters | `references/graphs-and-data.md` |
|
||||
| **Architecture diagram** | System description | Components building up with connections | `references/mobjects.md` |
|
||||
| **Paper explainer** | Research paper | Key findings and methods animated | `references/scene-planning.md` |
|
||||
| **3D visualization** | 3D concept | Rotating surfaces, parametric curves, spatial geometry | `references/camera-and-3d.md` |
|
||||
|
||||
## Stack
|
||||
|
||||
Single Python script per project. No browser, no Node.js, no GPU required.
|
||||
|
||||
| Layer | Tool | Purpose |
|
||||
|-------|------|---------|
|
||||
| Core | Manim Community Edition | Scene rendering, animation engine |
|
||||
| Math | LaTeX (texlive/MiKTeX) | Equation rendering via `MathTex` |
|
||||
| Video I/O | ffmpeg | Scene stitching, format conversion, audio muxing |
|
||||
| TTS | ElevenLabs / Qwen3-TTS (optional) | Narration voiceover |
|
||||
|
||||
## Pipeline
|
||||
|
||||
```
|
||||
PLAN --> CODE --> RENDER --> STITCH --> AUDIO (optional) --> REVIEW
|
||||
```
|
||||
|
||||
1. **PLAN** — Write `plan.md` with narrative arc, scene list, visual elements, color palette, voiceover script
|
||||
2. **CODE** — Write `script.py` with one class per scene, each independently renderable
|
||||
3. **RENDER** — `manim -ql script.py Scene1 Scene2 ...` for draft, `-qh` for production
|
||||
4. **STITCH** — ffmpeg concat of scene clips into `final.mp4`
|
||||
5. **AUDIO** (optional) — Add voiceover and/or background music via ffmpeg. See `references/rendering.md`
|
||||
6. **REVIEW** — Render preview stills, verify against plan, adjust
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
project-name/
|
||||
plan.md # Narrative arc, scene breakdown
|
||||
script.py # All scenes in one file
|
||||
concat.txt # ffmpeg scene list
|
||||
final.mp4 # Stitched output
|
||||
media/ # Auto-generated by Manim
|
||||
videos/script/480p15/
|
||||
```
|
||||
|
||||
## Creative Direction
|
||||
|
||||
### Color Palettes
|
||||
|
||||
| Palette | Background | Primary | Secondary | Accent | Use case |
|
||||
|---------|-----------|---------|-----------|--------|----------|
|
||||
| **Classic 3B1B** | `#1C1C1C` | `#58C4DD` (BLUE) | `#83C167` (GREEN) | `#FFFF00` (YELLOW) | General math/CS |
|
||||
| **Warm academic** | `#2D2B55` | `#FF6B6B` | `#FFD93D` | `#6BCB77` | Approachable |
|
||||
| **Neon tech** | `#0A0A0A` | `#00F5FF` | `#FF00FF` | `#39FF14` | Systems, architecture |
|
||||
| **Monochrome** | `#1A1A2E` | `#EAEAEA` | `#888888` | `#FFFFFF` | Minimalist |
|
||||
|
||||
### Animation Speed
|
||||
|
||||
| Context | run_time | self.wait() after |
|
||||
|---------|----------|-------------------|
|
||||
| Title/intro appear | 1.5s | 1.0s |
|
||||
| Key equation reveal | 2.0s | 2.0s |
|
||||
| Transform/morph | 1.5s | 1.5s |
|
||||
| Supporting label | 0.8s | 0.5s |
|
||||
| FadeOut cleanup | 0.5s | 0.3s |
|
||||
| "Aha moment" reveal | 2.5s | 3.0s |
|
||||
|
||||
### Typography Scale
|
||||
|
||||
| Role | Font size | Usage |
|
||||
|------|-----------|-------|
|
||||
| Title | 48 | Scene titles, opening text |
|
||||
| Heading | 36 | Section headers within a scene |
|
||||
| Body | 30 | Explanatory text |
|
||||
| Label | 24 | Annotations, axis labels |
|
||||
| Caption | 20 | Subtitles, fine print |
|
||||
|
||||
### Fonts
|
||||
|
||||
**Use monospace fonts for all text.** Manim's Pango renderer produces broken kerning with proportional fonts at all sizes. See `references/visual-design.md` for full recommendations.
|
||||
|
||||
```python
|
||||
MONO = "Menlo" # define once at top of file
|
||||
|
||||
Text("Fourier Series", font_size=48, font=MONO, weight=BOLD) # titles
|
||||
Text("n=1: sin(x)", font_size=20, font=MONO) # labels
|
||||
MathTex(r"\nabla L") # math (uses LaTeX)
|
||||
```
|
||||
|
||||
Minimum `font_size=18` for readability.
|
||||
|
||||
### Per-Scene Variation
|
||||
|
||||
Never use identical config for all scenes. For each scene:
|
||||
- **Different dominant color** from the palette
|
||||
- **Different layout** — don't always center everything
|
||||
- **Different animation entry** — vary between Write, FadeIn, GrowFromCenter, Create
|
||||
- **Different visual weight** — some scenes dense, others sparse
|
||||
|
||||
## Workflow
|
||||
|
||||
### Step 1: Plan (plan.md)
|
||||
|
||||
Before any code, write `plan.md`. See `references/scene-planning.md` for the comprehensive template.
|
||||
|
||||
### Step 2: Code (script.py)
|
||||
|
||||
One class per scene. Every scene is independently renderable.
|
||||
|
||||
```python
|
||||
from manim import *
|
||||
|
||||
BG = "#1C1C1C"
|
||||
PRIMARY = "#58C4DD"
|
||||
SECONDARY = "#83C167"
|
||||
ACCENT = "#FFFF00"
|
||||
MONO = "Menlo"
|
||||
|
||||
class Scene1_Introduction(Scene):
|
||||
def construct(self):
|
||||
self.camera.background_color = BG
|
||||
title = Text("Why Does This Work?", font_size=48, color=PRIMARY, weight=BOLD, font=MONO)
|
||||
self.add_subcaption("Why does this work?", duration=2)
|
||||
self.play(Write(title), run_time=1.5)
|
||||
self.wait(1.0)
|
||||
self.play(FadeOut(title), run_time=0.5)
|
||||
```
|
||||
|
||||
Key patterns:
|
||||
- **Subtitles** on every animation: `self.add_subcaption("text", duration=N)` or `subcaption="text"` on `self.play()`
|
||||
- **Shared color constants** at file top for cross-scene consistency
|
||||
- **`self.camera.background_color`** set in every scene
|
||||
- **Clean exits** — FadeOut all mobjects at scene end: `self.play(FadeOut(Group(*self.mobjects)))`
|
||||
|
||||
### Step 3: Render
|
||||
|
||||
```bash
|
||||
manim -ql script.py Scene1_Introduction Scene2_CoreConcept # draft
|
||||
manim -qh script.py Scene1_Introduction Scene2_CoreConcept # production
|
||||
```
|
||||
|
||||
### Step 4: Stitch
|
||||
|
||||
```bash
|
||||
cat > concat.txt << 'EOF'
|
||||
file 'media/videos/script/480p15/Scene1_Introduction.mp4'
|
||||
file 'media/videos/script/480p15/Scene2_CoreConcept.mp4'
|
||||
EOF
|
||||
ffmpeg -y -f concat -safe 0 -i concat.txt -c copy final.mp4
|
||||
```
|
||||
|
||||
### Step 5: Review
|
||||
|
||||
```bash
|
||||
manim -ql --format=png -s script.py Scene2_CoreConcept # preview still
|
||||
```
|
||||
|
||||
## Critical Implementation Notes
|
||||
|
||||
### Raw Strings for LaTeX
|
||||
```python
|
||||
# WRONG: MathTex("\frac{1}{2}")
|
||||
# RIGHT:
|
||||
MathTex(r"\frac{1}{2}")
|
||||
```
|
||||
|
||||
### buff >= 0.5 for Edge Text
|
||||
```python
|
||||
label.to_edge(DOWN, buff=0.5) # never < 0.5
|
||||
```
|
||||
|
||||
### FadeOut Before Replacing Text
|
||||
```python
|
||||
self.play(ReplacementTransform(note1, note2)) # not Write(note2) on top
|
||||
```
|
||||
|
||||
### Never Animate Non-Added Mobjects
|
||||
```python
|
||||
self.play(Create(circle)) # must add first
|
||||
self.play(circle.animate.set_color(RED)) # then animate
|
||||
```
|
||||
|
||||
## Performance Targets
|
||||
|
||||
| Quality | Resolution | FPS | Speed |
|
||||
|---------|-----------|-----|-------|
|
||||
| `-ql` (draft) | 854x480 | 15 | 5-15s/scene |
|
||||
| `-qm` (medium) | 1280x720 | 30 | 15-60s/scene |
|
||||
| `-qh` (production) | 1920x1080 | 60 | 30-120s/scene |
|
||||
|
||||
Always iterate at `-ql`. Only render `-qh` for final output.
|
||||
|
||||
## References
|
||||
|
||||
| File | Contents |
|
||||
|------|----------|
|
||||
| `references/animations.md` | Core animations, rate functions, composition, `.animate` syntax, timing patterns |
|
||||
| `references/mobjects.md` | Text, shapes, VGroup/Group, positioning, styling, custom mobjects |
|
||||
| `references/visual-design.md` | 12 design principles, opacity layering, layout templates, color palettes |
|
||||
| `references/equations.md` | LaTeX in Manim, TransformMatchingTex, derivation patterns |
|
||||
| `references/graphs-and-data.md` | Axes, plotting, BarChart, animated data, algorithm visualization |
|
||||
| `references/camera-and-3d.md` | MovingCameraScene, ThreeDScene, 3D surfaces, camera control |
|
||||
| `references/scene-planning.md` | Narrative arcs, layout templates, scene transitions, planning template |
|
||||
| `references/rendering.md` | CLI reference, quality presets, ffmpeg, voiceover workflow, GIF export |
|
||||
| `references/troubleshooting.md` | LaTeX errors, animation errors, common mistakes, debugging |
|
||||
| `references/animation-design-thinking.md` | When to animate vs show static, decomposition, pacing, narration sync |
|
||||
| `references/updaters-and-trackers.md` | ValueTracker, add_updater, always_redraw, time-based updaters, patterns |
|
||||
| `references/paper-explainer.md` | Turning research papers into animations — workflow, templates, domain patterns |
|
||||
| `references/decorations.md` | SurroundingRectangle, Brace, arrows, DashedLine, Angle, annotation lifecycle |
|
||||
| `references/production-quality.md` | Pre-code, pre-render, post-render checklists, spatial layout, color, tempo |
|
||||
|
||||
---
|
||||
|
||||
## Creative Divergence (use only when user requests experimental/creative/unique output)
|
||||
|
||||
If the user asks for creative, experimental, or unconventional explanatory approaches, select a strategy and reason through it BEFORE designing the animation.
|
||||
|
||||
- **SCAMPER** — when the user wants a fresh take on a standard explanation
|
||||
- **Assumption Reversal** — when the user wants to challenge how something is typically taught
|
||||
|
||||
### SCAMPER Transformation
|
||||
Take a standard mathematical/technical visualization and transform it:
|
||||
- **Substitute**: replace the standard visual metaphor (number line → winding path, matrix → city grid)
|
||||
- **Combine**: merge two explanation approaches (algebraic + geometric simultaneously)
|
||||
- **Reverse**: derive backward — start from the result and deconstruct to axioms
|
||||
- **Modify**: exaggerate a parameter to show why it matters (10x the learning rate, 1000x the sample size)
|
||||
- **Eliminate**: remove all notation — explain purely through animation and spatial relationships
|
||||
|
||||
### Assumption Reversal
|
||||
1. List what's "standard" about how this topic is visualized (left-to-right, 2D, discrete steps, formal notation)
|
||||
2. Pick the most fundamental assumption
|
||||
3. Reverse it (right-to-left derivation, 3D embedding of a 2D concept, continuous morphing instead of steps, zero notation)
|
||||
4. Explore what the reversal reveals that the standard approach hides
|
||||
@@ -0,0 +1,161 @@
|
||||
# Animation Design Thinking
|
||||
|
||||
How to decide WHAT to animate and HOW to structure it — before writing any code.
|
||||
|
||||
## Should I animate this?
|
||||
|
||||
Not everything benefits from animation. Motion adds cognitive load. Bad animation is worse than a good static diagram.
|
||||
|
||||
**Animate when:**
|
||||
- A sequence unfolds over time (algorithm steps, derivation, pipeline stages)
|
||||
- Spatial relationships change (transformation, deformation, rotation)
|
||||
- Something is built from parts (construction, assembly, accumulation)
|
||||
- You're comparing states (before/after, method A vs method B)
|
||||
- Temporal evolution is the point (training curves, wave propagation, gradient descent)
|
||||
|
||||
**Show static when:**
|
||||
- The concept is a single labeled diagram (circuit, anatomy, architecture overview)
|
||||
- Motion would distract from spatial layout
|
||||
- The viewer needs to study it carefully (dense table, reference chart)
|
||||
- The concept is already intuitive from a well-labeled figure
|
||||
|
||||
**Rule of thumb:** If you'd explain it with "first X, then Y, then Z" — animate it. If you'd explain it by pointing at parts of one picture — show it static.
|
||||
|
||||
## Decomposing a concept into animation
|
||||
|
||||
### Step 1: Write the narration first
|
||||
|
||||
Before any code, write what the narrator would say. This determines:
|
||||
- **Order** — what concept comes first
|
||||
- **Duration** — how long each idea gets
|
||||
- **Visuals** — what the viewer must SEE when they HEAR each sentence
|
||||
|
||||
A scene where the narration says "the gradient points uphill" must show a gradient arrow at that moment. If the visual doesn't match the audio, the viewer's brain splits attention and both tracks are lost.
|
||||
|
||||
### Step 2: Identify visual beats
|
||||
|
||||
A "beat" is a moment where something changes on screen. Mark each beat in your narration:
|
||||
|
||||
```
|
||||
"Consider a function f of x." → [BEAT: axes + curve appear]
|
||||
"At this point..." → [BEAT: dot appears on curve]
|
||||
"...the slope is positive." → [BEAT: tangent line drawn]
|
||||
"So the gradient tells us to go left." → [BEAT: arrow points left, dot moves]
|
||||
```
|
||||
|
||||
Each beat is one `self.play()` call or a small group of simultaneous animations.
|
||||
|
||||
### Step 3: Choose the right tool per beat
|
||||
|
||||
| Visual need | Manim approach |
|
||||
|-------------|----------------|
|
||||
| Object appears for first time | `Create`, `Write`, `FadeIn`, `GrowFromCenter` |
|
||||
| Object transforms into another | `Transform`, `ReplacementTransform`, `FadeTransform` |
|
||||
| Attention drawn to existing object | `Indicate`, `Circumscribe`, `Flash`, `ShowPassingFlash` |
|
||||
| Continuous relationship maintained | `add_updater`, `always_redraw`, `ValueTracker` |
|
||||
| Object leaves the scene | `FadeOut`, `Uncreate`, `ShrinkToCenter` |
|
||||
| Static context that stays visible | `self.add()` (no animation) |
|
||||
|
||||
## Pacing: the universal mistake is too fast
|
||||
|
||||
### Timing rules
|
||||
|
||||
| Content type | Minimum on-screen time |
|
||||
|-------------|----------------------|
|
||||
| New equation appearing | 2.0s animation + 2.0s pause |
|
||||
| New concept label | 1.0s animation + 1.0s pause |
|
||||
| Key insight ("aha moment") | 2.5s animation + 3.0s pause |
|
||||
| Supporting annotation | 0.8s animation + 0.5s pause |
|
||||
| Scene transition (FadeOut all) | 0.5s animation + 0.3s pause |
|
||||
|
||||
### Breathing room
|
||||
|
||||
After every reveal, add `self.wait()`. The viewer needs time to:
|
||||
1. Read the new text
|
||||
2. Connect it to what's already on screen
|
||||
3. Form an expectation about what comes next
|
||||
|
||||
**No wait = the viewer is always behind you.** They're still reading the equation when you've already started transforming it.
|
||||
|
||||
### Tempo variation
|
||||
|
||||
Monotonous pacing feels like a lecture. Vary the tempo:
|
||||
- **Slow build** for core concepts (long run_time, long pauses)
|
||||
- **Quick succession** for supporting details (short run_time, minimal pauses)
|
||||
- **Dramatic pause** before the key reveal (extra `self.wait(2.0)` before the "aha")
|
||||
- **Rapid montage** for "and this applies to X, Y, Z..." sequences (`LaggedStart` with tight lag_ratio)
|
||||
|
||||
## Narration synchronization
|
||||
|
||||
### The "see then hear" principle
|
||||
|
||||
The visual should appear slightly BEFORE the narration describes it. When the viewer sees a circle appear and THEN hears "consider a circle," the visual primes their brain for the concept. The reverse — hearing first, seeing second — creates confusion because they're searching the screen for something that isn't there yet.
|
||||
|
||||
### Practical timing
|
||||
|
||||
```python
|
||||
# Scene duration should match narration duration.
|
||||
# If narration for this scene is 8 seconds:
|
||||
# Total animation run_times + total self.wait() times = ~8 seconds.
|
||||
|
||||
# Use manim-voiceover for automatic sync:
|
||||
with self.voiceover(text="The gradient points downhill") as tracker:
|
||||
self.play(GrowArrow(gradient_arrow), run_time=tracker.duration)
|
||||
```
|
||||
|
||||
## Equation decomposition strategy
|
||||
|
||||
### The "dim and reveal" pattern
|
||||
|
||||
When building a complex equation step by step:
|
||||
1. Show the full equation dimmed at `opacity=0.2` (sets expectation for where you're going)
|
||||
2. Highlight the first term at full opacity
|
||||
3. Explain it
|
||||
4. Highlight the next term, dim the first to `0.5` (it's now context)
|
||||
5. Repeat until the full equation is bright
|
||||
|
||||
This is better than building left-to-right because the viewer always sees the destination.
|
||||
|
||||
### Term ordering
|
||||
|
||||
Animate terms in the order the viewer needs to understand them, not in the order they appear in the equation. For `E = mc²`:
|
||||
- Show `E` (the thing we want to know)
|
||||
- Then `m` (the input)
|
||||
- Then `c²` (the constant that makes it work)
|
||||
- Then the `=` (connecting them)
|
||||
|
||||
## Architecture and pipeline diagrams
|
||||
|
||||
### Box granularity
|
||||
|
||||
The most common mistake: too many boxes. Each box is a concept the viewer must track. Five boxes with clear labels beats twelve boxes with abbreviations.
|
||||
|
||||
**Rule:** If two consecutive boxes could be labeled "X" and "process X output," merge them into one box.
|
||||
|
||||
### Animation strategy
|
||||
|
||||
Build pipelines left-to-right (or top-to-bottom) with arrows connecting them:
|
||||
1. First box appears alone → explain it
|
||||
2. Arrow grows from first to second → "the output feeds into..."
|
||||
3. Second box appears → explain it
|
||||
4. Repeat
|
||||
|
||||
Then show data flowing through: `ShowPassingFlash` along the arrows, or a colored dot traversing the path.
|
||||
|
||||
### The zoom-and-return pattern
|
||||
|
||||
For complex systems:
|
||||
1. Show the full overview (all boxes, small)
|
||||
2. Zoom into one box (`MovingCameraScene.camera.frame.animate`)
|
||||
3. Expand that box into its internal components
|
||||
4. Zoom back out to the overview
|
||||
5. Zoom into the next box
|
||||
|
||||
## Common design mistakes
|
||||
|
||||
1. **Animating everything at once.** The viewer can track 1-2 simultaneous animations. More than that and nothing registers.
|
||||
2. **No visual hierarchy.** Everything at the same opacity/size/color means nothing stands out. Use opacity layering.
|
||||
3. **Equations without context.** An equation appearing alone means nothing. Always show the geometric/visual interpretation first or simultaneously.
|
||||
4. **Skipping the "why."** Showing HOW a transformation works without WHY it matters. Add a sentence/label explaining the purpose.
|
||||
5. **Identical pacing throughout.** Every animation at run_time=1.5, every wait at 1.0. Vary it.
|
||||
6. **Forgetting the audience.** A video for high schoolers needs different pacing and complexity than one for PhD students. Decide the audience in the planning phase.
|
||||
282
skills/creative/manim-video/references/animations.md
Normal file
282
skills/creative/manim-video/references/animations.md
Normal file
@@ -0,0 +1,282 @@
|
||||
# Animations Reference
|
||||
|
||||
## Core Concept
|
||||
|
||||
An animation is a Python object that computes intermediate visual states of a mobject over time. Animations are objects passed to `self.play()`, not functions.
|
||||
|
||||
`run_time` controls seconds (default: 1). Always specify it explicitly for important animations.
|
||||
|
||||
## Creation Animations
|
||||
|
||||
```python
|
||||
self.play(Create(circle)) # traces outline
|
||||
self.play(Write(equation)) # simulates handwriting (for Text/MathTex)
|
||||
self.play(FadeIn(group)) # opacity 0 -> 1
|
||||
self.play(GrowFromCenter(dot)) # scale 0 -> 1 from center
|
||||
self.play(DrawBorderThenFill(sq)) # outline first, then fill
|
||||
```
|
||||
|
||||
## Removal Animations
|
||||
|
||||
```python
|
||||
self.play(FadeOut(mobject)) # opacity 1 -> 0
|
||||
self.play(Uncreate(circle)) # reverse of Create
|
||||
self.play(ShrinkToCenter(group)) # scale 1 -> 0
|
||||
```
|
||||
|
||||
## Transform Animations
|
||||
|
||||
```python
|
||||
# Transform -- modifies the original in place
|
||||
self.play(Transform(circle, square))
|
||||
# After: circle IS the square (same object, new appearance)
|
||||
|
||||
# ReplacementTransform -- replaces old with new
|
||||
self.play(ReplacementTransform(circle, square))
|
||||
# After: circle removed, square on screen
|
||||
|
||||
# TransformMatchingTex -- smart equation morphing
|
||||
eq1 = MathTex(r"a^2 + b^2")
|
||||
eq2 = MathTex(r"a^2 + b^2 = c^2")
|
||||
self.play(TransformMatchingTex(eq1, eq2))
|
||||
```
|
||||
|
||||
**Critical**: After `Transform(A, B)`, variable `A` references the on-screen mobject. Variable `B` is NOT on screen. Use `ReplacementTransform` when you want to work with `B` afterwards.
|
||||
|
||||
## The .animate Syntax
|
||||
|
||||
```python
|
||||
self.play(circle.animate.set_color(RED))
|
||||
self.play(circle.animate.shift(RIGHT * 2).scale(0.5)) # chain multiple
|
||||
```
|
||||
|
||||
## Additional Creation Animations
|
||||
|
||||
```python
|
||||
self.play(GrowFromPoint(circle, LEFT * 3)) # scale 0 -> 1 from a specific point
|
||||
self.play(GrowFromEdge(rect, DOWN)) # grow from one edge
|
||||
self.play(SpinInFromNothing(square)) # scale up while rotating (default PI/2)
|
||||
self.play(GrowArrow(arrow)) # grows arrow from start to tip
|
||||
```
|
||||
|
||||
## Movement Animations
|
||||
|
||||
```python
|
||||
# Move a mobject along an arbitrary path
|
||||
path = Arc(radius=2, angle=PI)
|
||||
self.play(MoveAlongPath(dot, path), run_time=2)
|
||||
|
||||
# Rotate (as a Transform, not .animate — supports about_point)
|
||||
self.play(Rotate(square, angle=PI / 2, about_point=ORIGIN), run_time=1.5)
|
||||
|
||||
# Rotating (continuous rotation, updater-style — good for spinning objects)
|
||||
self.play(Rotating(gear, angle=TAU, run_time=4, rate_func=linear))
|
||||
```
|
||||
|
||||
`MoveAlongPath` takes any `VMobject` as the path — use `Arc`, `CubicBezier`, `Line`, or a custom `VMobject`. Position is computed via `path.point_from_proportion()`.
|
||||
|
||||
## Emphasis Animations
|
||||
|
||||
```python
|
||||
self.play(Indicate(mobject)) # brief yellow flash + scale
|
||||
self.play(Circumscribe(mobject)) # draw rectangle around it
|
||||
self.play(Flash(point)) # radial flash
|
||||
self.play(Wiggle(mobject)) # shake side to side
|
||||
```
|
||||
|
||||
## Rate Functions
|
||||
|
||||
```python
|
||||
self.play(FadeIn(mob), rate_func=smooth) # default: ease in/out
|
||||
self.play(FadeIn(mob), rate_func=linear) # constant speed
|
||||
self.play(FadeIn(mob), rate_func=rush_into) # start slow, end fast
|
||||
self.play(FadeIn(mob), rate_func=rush_from) # start fast, end slow
|
||||
self.play(FadeIn(mob), rate_func=there_and_back) # animate then reverse
|
||||
```
|
||||
|
||||
## Composition
|
||||
|
||||
```python
|
||||
# Simultaneous
|
||||
self.play(FadeIn(title), Create(circle), run_time=2)
|
||||
|
||||
# AnimationGroup with lag
|
||||
self.play(AnimationGroup(*[FadeIn(i) for i in items], lag_ratio=0.2))
|
||||
|
||||
# LaggedStart
|
||||
self.play(LaggedStart(*[Write(l) for l in lines], lag_ratio=0.3, run_time=3))
|
||||
|
||||
# Succession (sequential in one play call)
|
||||
self.play(Succession(FadeIn(title), Wait(0.5), Write(subtitle)))
|
||||
```
|
||||
|
||||
## Updaters
|
||||
|
||||
```python
|
||||
tracker = ValueTracker(0)
|
||||
dot = Dot().add_updater(lambda m: m.move_to(axes.c2p(tracker.get_value(), 0)))
|
||||
self.play(tracker.animate.set_value(5), run_time=3)
|
||||
```
|
||||
|
||||
## Subtitles
|
||||
|
||||
```python
|
||||
# Method 1: standalone
|
||||
self.add_subcaption("Key insight", duration=2)
|
||||
self.play(Write(equation), run_time=2.0)
|
||||
|
||||
# Method 2: inline
|
||||
self.play(Write(equation), subcaption="Key insight", subcaption_duration=2)
|
||||
```
|
||||
|
||||
Manim auto-generates `.srt` subtitle files. Always add subcaptions for accessibility.
|
||||
|
||||
## Timing Patterns
|
||||
|
||||
```python
|
||||
# Pause-after-reveal
|
||||
self.play(Write(key_equation), run_time=2.0)
|
||||
self.wait(2.0)
|
||||
|
||||
# Dim-and-focus
|
||||
self.play(old_content.animate.set_opacity(0.3), FadeIn(new_content))
|
||||
|
||||
# Clean exit
|
||||
self.play(FadeOut(Group(*self.mobjects)), run_time=0.5)
|
||||
self.wait(0.3)
|
||||
```
|
||||
|
||||
## Reactive Mobjects: always_redraw()
|
||||
|
||||
Rebuild a mobject from scratch every frame — essential when its geometry depends on other animated objects:
|
||||
|
||||
```python
|
||||
# Brace that follows a resizing square
|
||||
brace = always_redraw(Brace, square, UP)
|
||||
self.add(brace)
|
||||
self.play(square.animate.scale(2)) # brace auto-adjusts
|
||||
|
||||
# Horizontal line that tracks a moving dot
|
||||
h_line = always_redraw(lambda: axes.get_h_line(dot.get_left()))
|
||||
|
||||
# Label that always stays next to another mobject
|
||||
label = always_redraw(lambda: Text("here", font_size=20).next_to(dot, UP, buff=0.2))
|
||||
```
|
||||
|
||||
Note: `always_redraw` recreates the mobject every frame. For simple property tracking, use `add_updater` instead (cheaper):
|
||||
```python
|
||||
label.add_updater(lambda m: m.next_to(dot, UP))
|
||||
```
|
||||
|
||||
## TracedPath — Trajectory Tracing
|
||||
|
||||
Draw the path a point has traveled:
|
||||
|
||||
```python
|
||||
dot = Dot(color=YELLOW)
|
||||
path = TracedPath(dot.get_center, stroke_color=YELLOW, stroke_width=2)
|
||||
self.add(dot, path)
|
||||
self.play(dot.animate.shift(RIGHT * 3 + UP * 2), run_time=2)
|
||||
# path shows the trail the dot left behind
|
||||
|
||||
# Fading trail (dissipates over time):
|
||||
path = TracedPath(dot.get_center, dissipating_time=0.5, stroke_opacity=[0, 1])
|
||||
```
|
||||
|
||||
Use cases: gradient descent paths, planetary orbits, function tracing, particle trajectories.
|
||||
|
||||
## FadeTransform — Smoother Cross-Fades
|
||||
|
||||
`Transform` morphs shapes through ugly intermediate warping. `FadeTransform` cross-fades with position matching — use it when source and target look different:
|
||||
|
||||
```python
|
||||
# UGLY: Transform warps circle into square through a blob
|
||||
self.play(Transform(circle, square))
|
||||
|
||||
# SMOOTH: FadeTransform cross-fades cleanly
|
||||
self.play(FadeTransform(circle, square))
|
||||
|
||||
# FadeTransformPieces: per-submobject FadeTransform
|
||||
self.play(FadeTransformPieces(group1, group2))
|
||||
|
||||
# TransformFromCopy: animate a COPY while keeping the original visible
|
||||
self.play(TransformFromCopy(source, target))
|
||||
# source stays on screen, a copy morphs into target
|
||||
```
|
||||
|
||||
**Recommendation:** Use `FadeTransform` as default for dissimilar shapes. Use `Transform`/`ReplacementTransform` only for similar shapes (circle→ellipse, equation→equation).
|
||||
|
||||
## ApplyMatrix — Linear Transformation Visualization
|
||||
|
||||
Animate a matrix transformation on mobjects:
|
||||
|
||||
```python
|
||||
# Apply a 2x2 matrix to a grid
|
||||
matrix = [[2, 1], [1, 1]]
|
||||
self.play(ApplyMatrix(matrix, number_plane), run_time=2)
|
||||
|
||||
# Also works on individual mobjects
|
||||
self.play(ApplyMatrix([[0, -1], [1, 0]], square)) # 90-degree rotation
|
||||
```
|
||||
|
||||
Pairs with `LinearTransformationScene` — see `camera-and-3d.md`.
|
||||
|
||||
## squish_rate_func — Time-Window Staggering
|
||||
|
||||
Compress any rate function into a time window within an animation. Enables overlapping stagger without `LaggedStart`:
|
||||
|
||||
```python
|
||||
self.play(
|
||||
FadeIn(a, rate_func=squish_rate_func(smooth, 0, 0.5)), # 0% to 50%
|
||||
FadeIn(b, rate_func=squish_rate_func(smooth, 0.25, 0.75)), # 25% to 75%
|
||||
FadeIn(c, rate_func=squish_rate_func(smooth, 0.5, 1.0)), # 50% to 100%
|
||||
run_time=2
|
||||
)
|
||||
```
|
||||
|
||||
More precise than `LaggedStart` when you need exact overlap control.
|
||||
|
||||
## Additional Rate Functions
|
||||
|
||||
```python
|
||||
from manim import (
|
||||
smooth, linear, rush_into, rush_from,
|
||||
there_and_back, there_and_back_with_pause,
|
||||
running_start, double_smooth, wiggle,
|
||||
lingering, exponential_decay, not_quite_there,
|
||||
squish_rate_func
|
||||
)
|
||||
|
||||
# running_start: pulls back before going forward (anticipation)
|
||||
self.play(FadeIn(mob, rate_func=running_start))
|
||||
|
||||
# there_and_back_with_pause: goes there, holds, comes back
|
||||
self.play(mob.animate.shift(UP), rate_func=there_and_back_with_pause)
|
||||
|
||||
# not_quite_there: stops at a fraction of the full animation
|
||||
self.play(FadeIn(mob, rate_func=not_quite_there(0.7)))
|
||||
```
|
||||
|
||||
## ShowIncreasingSubsets / ShowSubmobjectsOneByOne
|
||||
|
||||
Reveal group members progressively — ideal for algorithm visualization:
|
||||
|
||||
```python
|
||||
# Reveal array elements one at a time
|
||||
array = Group(*[Square() for _ in range(8)]).arrange(RIGHT)
|
||||
self.play(ShowIncreasingSubsets(array), run_time=3)
|
||||
|
||||
# Show submobjects with staggered appearance
|
||||
self.play(ShowSubmobjectsOneByOne(code_lines), run_time=4)
|
||||
```
|
||||
|
||||
## ShowPassingFlash
|
||||
|
||||
A flash of light travels along a path:
|
||||
|
||||
```python
|
||||
# Flash traveling along a curve
|
||||
self.play(ShowPassingFlash(curve.copy().set_color(YELLOW), time_width=0.3))
|
||||
|
||||
# Great for: data flow, electrical signals, network traffic
|
||||
```
|
||||
135
skills/creative/manim-video/references/camera-and-3d.md
Normal file
135
skills/creative/manim-video/references/camera-and-3d.md
Normal file
@@ -0,0 +1,135 @@
|
||||
# Camera and 3D Reference
|
||||
|
||||
## MovingCameraScene (2D Camera Control)
|
||||
|
||||
```python
|
||||
class ZoomExample(MovingCameraScene):
|
||||
def construct(self):
|
||||
circle = Circle(radius=2, color=BLUE)
|
||||
self.play(Create(circle))
|
||||
# Zoom in
|
||||
self.play(self.camera.frame.animate.set(width=4).move_to(circle.get_top()), run_time=2)
|
||||
self.wait(2)
|
||||
# Zoom back out
|
||||
self.play(self.camera.frame.animate.set(width=14.222).move_to(ORIGIN), run_time=2)
|
||||
```
|
||||
|
||||
### Camera Operations
|
||||
|
||||
```python
|
||||
self.camera.frame.animate.set(width=6) # zoom in
|
||||
self.camera.frame.animate.set(width=20) # zoom out
|
||||
self.camera.frame.animate.move_to(target) # pan
|
||||
self.camera.frame.save_state() # save
|
||||
self.play(Restore(self.camera.frame)) # restore
|
||||
```
|
||||
|
||||
## ThreeDScene
|
||||
|
||||
```python
|
||||
class ThreeDExample(ThreeDScene):
|
||||
def construct(self):
|
||||
self.set_camera_orientation(phi=60*DEGREES, theta=-45*DEGREES)
|
||||
axes = ThreeDAxes()
|
||||
surface = Surface(
|
||||
lambda u, v: axes.c2p(u, v, np.sin(u) * np.cos(v)),
|
||||
u_range=[-PI, PI], v_range=[-PI, PI], resolution=(30, 30)
|
||||
)
|
||||
surface.set_color_by_gradient(BLUE, GREEN, YELLOW)
|
||||
self.play(Create(axes), Create(surface))
|
||||
self.begin_ambient_camera_rotation(rate=0.2)
|
||||
self.wait(5)
|
||||
self.stop_ambient_camera_rotation()
|
||||
```
|
||||
|
||||
### Camera Control in 3D
|
||||
|
||||
```python
|
||||
self.set_camera_orientation(phi=70*DEGREES, theta=-45*DEGREES)
|
||||
self.move_camera(phi=45*DEGREES, theta=30*DEGREES, run_time=2)
|
||||
self.begin_ambient_camera_rotation(rate=0.2)
|
||||
```
|
||||
|
||||
### 3D Mobjects
|
||||
|
||||
```python
|
||||
sphere = Sphere(radius=1).set_color(BLUE).set_opacity(0.7)
|
||||
cube = Cube(side_length=2, fill_color=GREEN, fill_opacity=0.5)
|
||||
arrow = Arrow3D(start=ORIGIN, end=[2, 1, 1], color=RED)
|
||||
# 2D text facing camera:
|
||||
label = Text("Label", font_size=30)
|
||||
self.add_fixed_in_frame_mobjects(label)
|
||||
```
|
||||
|
||||
### Parametric Curves
|
||||
|
||||
```python
|
||||
helix = ParametricFunction(
|
||||
lambda t: [np.cos(t), np.sin(t), t / (2*PI)],
|
||||
t_range=[0, 4*PI], color=YELLOW
|
||||
)
|
||||
```
|
||||
|
||||
## When to Use 3D
|
||||
- Surfaces, vector fields, spatial geometry, 3D transforms
|
||||
## When NOT to Use 3D
|
||||
- 2D concepts, text-heavy scenes, flat data (bar charts, time series)
|
||||
|
||||
## ZoomedScene — Inset Zoom
|
||||
|
||||
Show a magnified inset of a detail while keeping the full view visible:
|
||||
|
||||
```python
|
||||
class ZoomExample(ZoomedScene):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(
|
||||
zoom_factor=0.3, # how much of the scene the zoom box covers
|
||||
zoomed_display_height=3, # size of the inset
|
||||
zoomed_display_width=3,
|
||||
zoomed_camera_frame_starting_position=ORIGIN,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def construct(self):
|
||||
self.camera.background_color = BG
|
||||
# ... create your scene content ...
|
||||
|
||||
# Activate the zoom
|
||||
self.activate_zooming()
|
||||
|
||||
# Move the zoom frame to a point of interest
|
||||
self.play(self.zoomed_camera.frame.animate.move_to(detail_point))
|
||||
self.wait(2)
|
||||
|
||||
# Deactivate
|
||||
self.play(self.get_zoomed_display_pop_out_animation(), rate_func=lambda t: smooth(1-t))
|
||||
```
|
||||
|
||||
Use cases: zooming into a specific term in an equation, showing fine detail in a diagram, magnifying a region of a plot.
|
||||
|
||||
## LinearTransformationScene — Linear Algebra
|
||||
|
||||
Pre-built scene with basis vectors and grid for visualizing matrix transformations:
|
||||
|
||||
```python
|
||||
class LinearTransformExample(LinearTransformationScene):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(
|
||||
show_coordinates=True,
|
||||
show_basis_vectors=True,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def construct(self):
|
||||
matrix = [[2, 1], [1, 1]]
|
||||
|
||||
# Add a vector before applying the transform
|
||||
vector = self.get_vector([1, 2], color=YELLOW)
|
||||
self.add_vector(vector)
|
||||
|
||||
# Apply the transformation — grid, basis vectors, and your vector all transform
|
||||
self.apply_matrix(matrix)
|
||||
self.wait(2)
|
||||
```
|
||||
|
||||
This produces the signature 3Blue1Brown "Essence of Linear Algebra" look — grid lines deforming, basis vectors stretching, determinant visualized through area change.
|
||||
202
skills/creative/manim-video/references/decorations.md
Normal file
202
skills/creative/manim-video/references/decorations.md
Normal file
@@ -0,0 +1,202 @@
|
||||
# Decorations and Visual Polish
|
||||
|
||||
Decorations are mobjects that annotate, highlight, or frame other mobjects. They turn a technically correct animation into a visually polished one.
|
||||
|
||||
## SurroundingRectangle
|
||||
|
||||
Draws a rectangle around any mobject. The go-to for highlighting:
|
||||
|
||||
```python
|
||||
highlight = SurroundingRectangle(
|
||||
equation[2], # the term to highlight
|
||||
color=YELLOW,
|
||||
buff=0.15, # padding between content and border
|
||||
corner_radius=0.1, # rounded corners
|
||||
stroke_width=2
|
||||
)
|
||||
self.play(Create(highlight))
|
||||
self.wait(1)
|
||||
self.play(FadeOut(highlight))
|
||||
```
|
||||
|
||||
### Around part of an equation
|
||||
|
||||
```python
|
||||
eq = MathTex(r"E", r"=", r"m", r"c^2")
|
||||
box = SurroundingRectangle(eq[2:], color=YELLOW, buff=0.1) # highlight "mc²"
|
||||
label = Text("mass-energy", font_size=18, font="Menlo", color=YELLOW)
|
||||
label.next_to(box, DOWN, buff=0.2)
|
||||
self.play(Create(box), FadeIn(label))
|
||||
```
|
||||
|
||||
## BackgroundRectangle
|
||||
|
||||
Semi-transparent background behind text for readability over complex scenes:
|
||||
|
||||
```python
|
||||
bg = BackgroundRectangle(equation, fill_opacity=0.7, buff=0.2, color=BLACK)
|
||||
self.play(FadeIn(bg), Write(equation))
|
||||
|
||||
# Or using set_stroke for a "backdrop" effect on the text itself:
|
||||
label.set_stroke(BLACK, width=5, background=True)
|
||||
```
|
||||
|
||||
The `set_stroke(background=True)` approach is cleaner for text labels over graphs/diagrams.
|
||||
|
||||
## Brace and BraceLabel
|
||||
|
||||
Curly braces that annotate sections of a diagram or equation:
|
||||
|
||||
```python
|
||||
brace = Brace(equation[2:4], DOWN, color=YELLOW)
|
||||
brace_label = brace.get_text("these terms", font_size=20)
|
||||
self.play(GrowFromCenter(brace), FadeIn(brace_label))
|
||||
|
||||
# Between two specific points
|
||||
brace = BraceBetweenPoints(point_a, point_b, direction=UP)
|
||||
```
|
||||
|
||||
### Brace placement
|
||||
|
||||
```python
|
||||
# Below a group
|
||||
Brace(group, DOWN)
|
||||
# Above a group
|
||||
Brace(group, UP)
|
||||
# Left of a group
|
||||
Brace(group, LEFT)
|
||||
# Right of a group
|
||||
Brace(group, RIGHT)
|
||||
```
|
||||
|
||||
## Arrows for Annotation
|
||||
|
||||
### Straight arrows pointing to mobjects
|
||||
|
||||
```python
|
||||
arrow = Arrow(
|
||||
start=label.get_bottom(),
|
||||
end=target.get_top(),
|
||||
color=YELLOW,
|
||||
stroke_width=2,
|
||||
buff=0.1, # gap between arrow tip and target
|
||||
max_tip_length_to_length_ratio=0.15 # small arrowhead
|
||||
)
|
||||
self.play(GrowArrow(arrow), FadeIn(label))
|
||||
```
|
||||
|
||||
### Curved arrows
|
||||
|
||||
```python
|
||||
arrow = CurvedArrow(
|
||||
start_point=source.get_right(),
|
||||
end_point=target.get_left(),
|
||||
angle=PI/4, # curve angle
|
||||
color=PRIMARY
|
||||
)
|
||||
```
|
||||
|
||||
### Labeling with arrows
|
||||
|
||||
```python
|
||||
# LabeledArrow: arrow with built-in text label
|
||||
arr = LabeledArrow(
|
||||
Text("gradient", font_size=16, font="Menlo"),
|
||||
start=point_a, end=point_b, color=RED
|
||||
)
|
||||
```
|
||||
|
||||
## DashedLine and DashedVMobject
|
||||
|
||||
```python
|
||||
# Dashed line (for asymptotes, construction lines, implied connections)
|
||||
asymptote = DashedLine(
|
||||
axes.c2p(2, -3), axes.c2p(2, 3),
|
||||
color=YELLOW, dash_length=0.15
|
||||
)
|
||||
|
||||
# Make any VMobject dashed
|
||||
dashed_circle = DashedVMobject(Circle(radius=2, color=BLUE), num_dashes=30)
|
||||
```
|
||||
|
||||
## Angle and RightAngle Markers
|
||||
|
||||
```python
|
||||
line1 = Line(ORIGIN, RIGHT * 2)
|
||||
line2 = Line(ORIGIN, UP * 2 + RIGHT)
|
||||
|
||||
# Angle arc between two lines
|
||||
angle = Angle(line1, line2, radius=0.5, color=YELLOW)
|
||||
angle_value = angle.get_value() # radians
|
||||
|
||||
# Right angle marker (the small square)
|
||||
right_angle = RightAngle(line1, Line(ORIGIN, UP * 2), length=0.3, color=WHITE)
|
||||
```
|
||||
|
||||
## Cross (strikethrough)
|
||||
|
||||
Mark something as wrong or deprecated:
|
||||
|
||||
```python
|
||||
cross = Cross(old_equation, color=RED, stroke_width=4)
|
||||
self.play(Create(cross))
|
||||
# Then show the correct version
|
||||
```
|
||||
|
||||
## Underline
|
||||
|
||||
```python
|
||||
underline = Underline(important_text, color=ACCENT, stroke_width=3)
|
||||
self.play(Create(underline))
|
||||
```
|
||||
|
||||
## Color Highlighting Workflow
|
||||
|
||||
### Method 1: At creation with t2c
|
||||
|
||||
```python
|
||||
text = Text("The gradient is negative here", t2c={"gradient": BLUE, "negative": RED})
|
||||
```
|
||||
|
||||
### Method 2: set_color_by_tex after creation
|
||||
|
||||
```python
|
||||
eq = MathTex(r"\nabla L = -\frac{\partial L}{\partial w}")
|
||||
eq.set_color_by_tex(r"\nabla", BLUE)
|
||||
eq.set_color_by_tex(r"\partial", RED)
|
||||
```
|
||||
|
||||
### Method 3: Index into submobjects
|
||||
|
||||
```python
|
||||
eq = MathTex(r"a", r"+", r"b", r"=", r"c")
|
||||
eq[0].set_color(RED) # "a"
|
||||
eq[2].set_color(BLUE) # "b"
|
||||
eq[4].set_color(GREEN) # "c"
|
||||
```
|
||||
|
||||
## Combining Annotations
|
||||
|
||||
Layer multiple annotations for emphasis:
|
||||
|
||||
```python
|
||||
# Highlight a term, add a brace, and an arrow — in sequence
|
||||
box = SurroundingRectangle(eq[2], color=YELLOW, buff=0.1)
|
||||
brace = Brace(eq[2], DOWN, color=YELLOW)
|
||||
label = brace.get_text("learning rate", font_size=18)
|
||||
|
||||
self.play(Create(box))
|
||||
self.wait(0.5)
|
||||
self.play(FadeOut(box), GrowFromCenter(brace), FadeIn(label))
|
||||
self.wait(1.5)
|
||||
self.play(FadeOut(brace), FadeOut(label))
|
||||
```
|
||||
|
||||
### The annotation lifecycle
|
||||
|
||||
Annotations should follow a rhythm:
|
||||
1. **Appear** — draw attention (Create, GrowFromCenter)
|
||||
2. **Hold** — viewer reads and understands (self.wait)
|
||||
3. **Disappear** — clear the stage for the next thing (FadeOut)
|
||||
|
||||
Never leave annotations on screen indefinitely — they become visual noise once their purpose is served.
|
||||
216
skills/creative/manim-video/references/equations.md
Normal file
216
skills/creative/manim-video/references/equations.md
Normal file
@@ -0,0 +1,216 @@
|
||||
# Equations and LaTeX Reference
|
||||
|
||||
## Basic LaTeX
|
||||
|
||||
```python
|
||||
eq = MathTex(r"E = mc^2")
|
||||
eq = MathTex(r"f(x) &= x^2 + 2x + 1 \\ &= (x + 1)^2") # multi-line aligned
|
||||
```
|
||||
|
||||
**Always use raw strings (`r""`).**
|
||||
|
||||
## Step-by-Step Derivations
|
||||
|
||||
```python
|
||||
step1 = MathTex(r"a^2 + b^2 = c^2")
|
||||
step2 = MathTex(r"a^2 = c^2 - b^2")
|
||||
self.play(Write(step1), run_time=1.5)
|
||||
self.wait(1.5)
|
||||
self.play(TransformMatchingTex(step1, step2), run_time=1.5)
|
||||
```
|
||||
|
||||
## Selective Color
|
||||
|
||||
```python
|
||||
eq = MathTex(r"a^2", r"+", r"b^2", r"=", r"c^2")
|
||||
eq[0].set_color(RED)
|
||||
eq[4].set_color(GREEN)
|
||||
```
|
||||
|
||||
## Building Incrementally
|
||||
|
||||
```python
|
||||
parts = MathTex(r"f(x)", r"=", r"\sum_{n=0}^{\infty}", r"\frac{f^{(n)}(a)}{n!}", r"(x-a)^n")
|
||||
self.play(Write(parts[0:2]))
|
||||
self.wait(0.5)
|
||||
self.play(Write(parts[2]))
|
||||
self.wait(0.5)
|
||||
self.play(Write(parts[3:]))
|
||||
```
|
||||
|
||||
## Highlighting
|
||||
|
||||
```python
|
||||
highlight = SurroundingRectangle(eq[2], color=YELLOW, buff=0.1)
|
||||
self.play(Create(highlight))
|
||||
self.play(Indicate(eq[4], color=YELLOW))
|
||||
```
|
||||
|
||||
## Annotation
|
||||
|
||||
```python
|
||||
brace = Brace(eq, DOWN, color=YELLOW)
|
||||
label = brace.get_text("Fundamental Theorem", font_size=24)
|
||||
self.play(GrowFromCenter(brace), Write(label))
|
||||
```
|
||||
|
||||
## Common LaTeX
|
||||
|
||||
```python
|
||||
MathTex(r"\frac{a}{b}") # fraction
|
||||
MathTex(r"\alpha, \beta, \gamma") # Greek
|
||||
MathTex(r"\sum_{i=1}^{n} x_i") # summation
|
||||
MathTex(r"\int_{0}^{\infty} e^{-x} dx") # integral
|
||||
MathTex(r"\vec{v}") # vector
|
||||
MathTex(r"\lim_{x \to \infty} f(x)") # limit
|
||||
```
|
||||
|
||||
## Matrices
|
||||
|
||||
`MathTex` supports standard LaTeX matrix environments via `amsmath` (loaded by default):
|
||||
|
||||
```python
|
||||
# Bracketed matrix
|
||||
MathTex(r"\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}")
|
||||
|
||||
# Parenthesized matrix
|
||||
MathTex(r"\begin{pmatrix} a & b \\ c & d \end{pmatrix}")
|
||||
|
||||
# Determinant (vertical bars)
|
||||
MathTex(r"\begin{vmatrix} a & b \\ c & d \end{vmatrix}")
|
||||
|
||||
# Plain (no delimiters)
|
||||
MathTex(r"\begin{matrix} x_1 \\ x_2 \\ x_3 \end{matrix}")
|
||||
```
|
||||
|
||||
For matrices you need to animate element-by-element or color individual entries, use the `IntegerMatrix`, `DecimalMatrix`, or `MobjectMatrix` mobjects instead — see `mobjects.md`.
|
||||
|
||||
## Cases and Piecewise Functions
|
||||
|
||||
```python
|
||||
MathTex(r"""
|
||||
f(x) = \begin{cases}
|
||||
x^2 & \text{if } x \geq 0 \\
|
||||
-x^2 & \text{if } x < 0
|
||||
\end{cases}
|
||||
""")
|
||||
```
|
||||
|
||||
## Aligned Environments
|
||||
|
||||
For multi-line derivations with alignment, use `aligned` inside `MathTex`:
|
||||
|
||||
```python
|
||||
MathTex(r"""
|
||||
\begin{aligned}
|
||||
\nabla \cdot \mathbf{E} &= \frac{\rho}{\epsilon_0} \\
|
||||
\nabla \cdot \mathbf{B} &= 0 \\
|
||||
\nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t} \\
|
||||
\nabla \times \mathbf{B} &= \mu_0 \mathbf{J} + \mu_0 \epsilon_0 \frac{\partial \mathbf{E}}{\partial t}
|
||||
\end{aligned}
|
||||
""")
|
||||
```
|
||||
|
||||
Note: `MathTex` wraps content in `align*` by default. Override with `tex_environment` if needed:
|
||||
```python
|
||||
MathTex(r"...", tex_environment="gather*")
|
||||
```
|
||||
|
||||
## Derivation Pattern
|
||||
|
||||
```python
|
||||
class DerivationScene(Scene):
|
||||
def construct(self):
|
||||
self.camera.background_color = BG
|
||||
s1 = MathTex(r"ax^2 + bx + c = 0")
|
||||
self.play(Write(s1))
|
||||
self.wait(1.5)
|
||||
s2 = MathTex(r"x^2 + \frac{b}{a}x + \frac{c}{a} = 0")
|
||||
s2.next_to(s1, DOWN, buff=0.8)
|
||||
self.play(s1.animate.set_opacity(0.4), TransformMatchingTex(s1.copy(), s2))
|
||||
```
|
||||
|
||||
## substrings_to_isolate for Complex Equations
|
||||
|
||||
For dense equations where manually splitting into parts is impractical, use `substrings_to_isolate` to tell Manim which substrings to track as individual elements:
|
||||
|
||||
```python
|
||||
# Without isolation — the whole expression is one blob
|
||||
lagrangian = MathTex(
|
||||
r"\mathcal{L} = \bar{\psi}(i \gamma^\mu D_\mu - m)\psi - \tfrac{1}{4}F_{\mu\nu}F^{\mu\nu}"
|
||||
)
|
||||
|
||||
# With isolation — each named substring is a separate submobject
|
||||
lagrangian = MathTex(
|
||||
r"\mathcal{L} = \bar{\psi}(i \gamma^\mu D_\mu - m)\psi - \tfrac{1}{4}F_{\mu\nu}F^{\mu\nu}",
|
||||
substrings_to_isolate=[r"\psi", r"D_\mu", r"\gamma^\mu", r"F_{\mu\nu}"]
|
||||
)
|
||||
# Now you can color individual terms
|
||||
lagrangian.set_color_by_tex(r"\psi", BLUE)
|
||||
lagrangian.set_color_by_tex(r"F_{\mu\nu}", YELLOW)
|
||||
```
|
||||
|
||||
Essential for `TransformMatchingTex` on complex equations — without isolation, matching fails on dense expressions.
|
||||
|
||||
## Multi-Line Complex Equations
|
||||
|
||||
For equations with multiple related lines, pass each line as a separate argument:
|
||||
|
||||
```python
|
||||
maxwell = MathTex(
|
||||
r"\nabla \cdot \mathbf{E} = \frac{\rho}{\epsilon_0}",
|
||||
r"\nabla \times \mathbf{B} = \mu_0\mathbf{J} + \mu_0\epsilon_0\frac{\partial \mathbf{E}}{\partial t}"
|
||||
).arrange(DOWN)
|
||||
|
||||
# Each line is a separate submobject — animate independently
|
||||
self.play(Write(maxwell[0]))
|
||||
self.wait(1)
|
||||
self.play(Write(maxwell[1]))
|
||||
```
|
||||
|
||||
## TransformMatchingTex with key_map
|
||||
|
||||
Map specific substrings between source and target equations during transformation:
|
||||
|
||||
```python
|
||||
eq1 = MathTex(r"A^2 + B^2 = C^2")
|
||||
eq2 = MathTex(r"A^2 = C^2 - B^2")
|
||||
|
||||
self.play(TransformMatchingTex(
|
||||
eq1, eq2,
|
||||
key_map={"+": "-"}, # map "+" in source to "-" in target
|
||||
path_arc=PI / 2, # arc the pieces into position
|
||||
))
|
||||
```
|
||||
|
||||
## set_color_by_tex — Color by Substring
|
||||
|
||||
```python
|
||||
eq = MathTex(r"E = mc^2")
|
||||
eq.set_color_by_tex("E", BLUE)
|
||||
eq.set_color_by_tex("m", RED)
|
||||
eq.set_color_by_tex("c", GREEN)
|
||||
```
|
||||
|
||||
## TransformMatchingTex with matched_keys
|
||||
|
||||
When matching substrings are ambiguous, specify which to align explicitly:
|
||||
|
||||
```python
|
||||
kw = dict(font_size=72, t2c={"A": BLUE, "B": TEAL, "C": GREEN})
|
||||
lines = [
|
||||
MathTex(r"A^2 + B^2 = C^2", **kw),
|
||||
MathTex(r"A^2 = C^2 - B^2", **kw),
|
||||
MathTex(r"A^2 = (C + B)(C - B)", **kw),
|
||||
MathTex(r"A = \sqrt{(C + B)(C - B)}", **kw),
|
||||
]
|
||||
|
||||
self.play(TransformMatchingTex(
|
||||
lines[0].copy(), lines[1],
|
||||
matched_keys=["A^2", "B^2", "C^2"], # explicitly match these
|
||||
key_map={"+": "-"}, # map + to -
|
||||
path_arc=PI / 2, # arc pieces into position
|
||||
))
|
||||
```
|
||||
|
||||
Without `matched_keys`, the animation matches the longest common substrings, which can produce unexpected results on complex equations (e.g., "^2 = C^2" matching across terms).
|
||||
163
skills/creative/manim-video/references/graphs-and-data.md
Normal file
163
skills/creative/manim-video/references/graphs-and-data.md
Normal file
@@ -0,0 +1,163 @@
|
||||
# Graphs, Plots, and Data Visualization
|
||||
|
||||
## Axes
|
||||
|
||||
```python
|
||||
axes = Axes(
|
||||
x_range=[-3, 3, 1], y_range=[-2, 2, 1],
|
||||
x_length=8, y_length=5,
|
||||
axis_config={"include_numbers": True, "font_size": 24}
|
||||
)
|
||||
axes.set_opacity(0.15) # structural element
|
||||
x_label = axes.get_x_axis_label(r"x")
|
||||
```
|
||||
|
||||
## Plotting
|
||||
|
||||
```python
|
||||
graph = axes.plot(lambda x: x**2, color=BLUE)
|
||||
graph_label = axes.get_graph_label(graph, label=r"x^2", x_val=2)
|
||||
area = axes.get_area(graph, x_range=[0, 2], color=BLUE, opacity=0.3)
|
||||
```
|
||||
|
||||
## Animated Plotting
|
||||
|
||||
```python
|
||||
self.play(Create(graph), run_time=3) # trace the graph
|
||||
|
||||
# Moving dot along curve
|
||||
dot = Dot(color=YELLOW).move_to(axes.c2p(0, 0))
|
||||
self.play(MoveAlongPath(dot, graph), run_time=3)
|
||||
|
||||
# Dynamic parameter
|
||||
tracker = ValueTracker(1)
|
||||
dynamic = always_redraw(lambda: axes.plot(lambda x: tracker.get_value() * x**2, color=BLUE))
|
||||
self.add(dynamic)
|
||||
self.play(tracker.animate.set_value(3), run_time=2)
|
||||
```
|
||||
|
||||
## Bar Charts
|
||||
|
||||
```python
|
||||
chart = BarChart(
|
||||
values=[4, 6, 2, 8, 5], bar_names=["A", "B", "C", "D", "E"],
|
||||
y_range=[0, 10, 2], bar_colors=[RED, GREEN, BLUE, YELLOW, PURPLE]
|
||||
)
|
||||
self.play(Create(chart), run_time=2)
|
||||
self.play(chart.animate.change_bar_values([6, 3, 7, 4, 9]))
|
||||
```
|
||||
|
||||
## Number Lines
|
||||
|
||||
```python
|
||||
nl = NumberLine(x_range=[0, 10, 1], length=10, include_numbers=True)
|
||||
pointer = Arrow(nl.n2p(3) + UP * 0.5, nl.n2p(3), color=RED, buff=0)
|
||||
tracker = ValueTracker(3)
|
||||
pointer.add_updater(lambda m: m.put_start_and_end_on(
|
||||
nl.n2p(tracker.get_value()) + UP * 0.5, nl.n2p(tracker.get_value())))
|
||||
self.play(tracker.animate.set_value(8), run_time=2)
|
||||
```
|
||||
|
||||
## Animated Counters
|
||||
|
||||
```python
|
||||
counter = DecimalNumber(0, font_size=72, num_decimal_places=0)
|
||||
self.play(counter.animate.set_value(1000), run_time=3, rate_func=rush_from)
|
||||
```
|
||||
|
||||
## Algorithm Visualization Pattern
|
||||
|
||||
```python
|
||||
values = [5, 2, 8, 1, 9, 3]
|
||||
bars = VGroup(*[
|
||||
Rectangle(width=0.6, height=v * 0.4, color=BLUE, fill_opacity=0.7)
|
||||
for v in values
|
||||
]).arrange(RIGHT, buff=0.2, aligned_edge=DOWN).move_to(ORIGIN)
|
||||
self.play(LaggedStart(*[GrowFromEdge(b, DOWN) for b in bars], lag_ratio=0.1))
|
||||
# Highlight, swap, etc.
|
||||
```
|
||||
|
||||
## Data Story Pattern
|
||||
|
||||
```python
|
||||
# Before/After comparison
|
||||
before = BarChart(values=[3, 5, 2], bar_colors=[RED]*3).shift(LEFT * 3)
|
||||
after = BarChart(values=[8, 9, 7], bar_colors=[GREEN]*3).shift(RIGHT * 3)
|
||||
self.play(Create(before)); self.wait(1)
|
||||
self.play(Create(after)); self.wait(1)
|
||||
arrow = Arrow(before.get_right(), after.get_left(), color=YELLOW)
|
||||
label = Text("+167%", font_size=36, color=YELLOW).next_to(arrow, UP)
|
||||
self.play(GrowArrow(arrow), Write(label))
|
||||
```
|
||||
|
||||
## Graph / DiGraph — Graph Theory Visualization
|
||||
|
||||
Built-in graph mobjects with automatic layout:
|
||||
|
||||
```python
|
||||
# Undirected graph
|
||||
g = Graph(
|
||||
vertices=[1, 2, 3, 4, 5],
|
||||
edges=[(1, 2), (2, 3), (3, 4), (4, 5), (5, 1), (1, 3)],
|
||||
layout="spring", # or "circular", "kamada_kawai", "planar", "tree"
|
||||
labels=True,
|
||||
vertex_config={"fill_color": PRIMARY},
|
||||
edge_config={"stroke_color": SUBTLE},
|
||||
)
|
||||
self.play(Create(g))
|
||||
|
||||
# Directed graph
|
||||
dg = DiGraph(
|
||||
vertices=["A", "B", "C"],
|
||||
edges=[("A", "B"), ("B", "C"), ("C", "A")],
|
||||
layout="circular",
|
||||
labels=True,
|
||||
edge_config={("A", "B"): {"stroke_color": RED}},
|
||||
)
|
||||
|
||||
# Add/remove vertices and edges dynamically
|
||||
self.play(g.animate.add_vertices(6, positions={6: RIGHT * 2}))
|
||||
self.play(g.animate.add_edges((1, 6)))
|
||||
self.play(g.animate.remove_vertices(3))
|
||||
```
|
||||
|
||||
Layout algorithms: `"spring"`, `"circular"`, `"kamada_kawai"`, `"planar"`, `"spectral"`, `"tree"` (for rooted trees, specify `root=`).
|
||||
|
||||
## ArrowVectorField / StreamLines — Vector Fields
|
||||
|
||||
```python
|
||||
# Arrow field: arrows showing direction at each point
|
||||
field = ArrowVectorField(
|
||||
lambda pos: np.array([-pos[1], pos[0], 0]), # rotation field
|
||||
x_range=[-3, 3], y_range=[-3, 3],
|
||||
colors=[BLUE, GREEN, YELLOW, RED]
|
||||
)
|
||||
self.play(Create(field))
|
||||
|
||||
# StreamLines: flowing particle traces through the field
|
||||
stream = StreamLines(
|
||||
lambda pos: np.array([-pos[1], pos[0], 0]),
|
||||
stroke_width=2, max_anchors_per_line=30
|
||||
)
|
||||
self.add(stream)
|
||||
stream.start_animation(warm_up=True, flow_speed=1.5)
|
||||
self.wait(3)
|
||||
stream.end_animation()
|
||||
```
|
||||
|
||||
Use cases: electromagnetic fields, fluid flow, gradient fields, ODE phase portraits.
|
||||
|
||||
## ComplexPlane / PolarPlane
|
||||
|
||||
```python
|
||||
# Complex plane with Re/Im labels
|
||||
cplane = ComplexPlane().add_coordinates()
|
||||
dot = Dot(cplane.n2p(2 + 1j), color=YELLOW)
|
||||
label = Text("2+i", font_size=20).next_to(dot, UR, buff=0.1)
|
||||
|
||||
# Apply complex function to the plane
|
||||
self.play(cplane.animate.apply_complex_function(lambda z: z**2), run_time=3)
|
||||
|
||||
# Polar plane
|
||||
polar = PolarPlane(radius_max=3).add_coordinates()
|
||||
```
|
||||
333
skills/creative/manim-video/references/mobjects.md
Normal file
333
skills/creative/manim-video/references/mobjects.md
Normal file
@@ -0,0 +1,333 @@
|
||||
# Mobjects Reference
|
||||
|
||||
Everything visible on screen is a Mobject. They have position, color, opacity, and can be animated.
|
||||
|
||||
## Text
|
||||
|
||||
```python
|
||||
title = Text("Hello World", font_size=48, color=BLUE)
|
||||
eq = MathTex(r"E = mc^2", font_size=40)
|
||||
|
||||
# Multi-part (for selective coloring)
|
||||
eq = MathTex(r"a^2", r"+", r"b^2", r"=", r"c^2")
|
||||
eq[0].set_color(RED)
|
||||
eq[4].set_color(BLUE)
|
||||
|
||||
# Mixed text and math
|
||||
t = Tex(r"The area is $\pi r^2$", font_size=36)
|
||||
|
||||
# Styled markup
|
||||
t = MarkupText('<span foreground="#58C4DD">Blue</span> text', font_size=30)
|
||||
```
|
||||
|
||||
**Always use raw strings (`r""`) for any string with backslashes.**
|
||||
|
||||
## Shapes
|
||||
|
||||
```python
|
||||
circle = Circle(radius=1, color=BLUE, fill_opacity=0.5)
|
||||
square = Square(side_length=2, color=RED)
|
||||
rect = Rectangle(width=4, height=2, color=GREEN)
|
||||
dot = Dot(point=ORIGIN, radius=0.08, color=YELLOW)
|
||||
line = Line(LEFT * 2, RIGHT * 2, color=WHITE)
|
||||
arrow = Arrow(LEFT, RIGHT, color=ORANGE)
|
||||
rrect = RoundedRectangle(corner_radius=0.3, width=4, height=2)
|
||||
brace = Brace(rect, DOWN, color=YELLOW)
|
||||
```
|
||||
|
||||
## Polygons and Arcs
|
||||
|
||||
```python
|
||||
# Arbitrary polygon from vertices
|
||||
poly = Polygon(LEFT, UP * 2, RIGHT, color=GREEN, fill_opacity=0.3)
|
||||
|
||||
# Regular n-sided polygon
|
||||
hexagon = RegularPolygon(n=6, color=TEAL, fill_opacity=0.4)
|
||||
|
||||
# Triangle (shorthand for RegularPolygon(n=3))
|
||||
tri = Triangle(color=YELLOW, fill_opacity=0.5)
|
||||
|
||||
# Arc (portion of a circle)
|
||||
arc = Arc(radius=2, start_angle=0, angle=PI / 2, color=BLUE)
|
||||
|
||||
# Arc between two points
|
||||
arc_between = ArcBetweenPoints(LEFT * 2, RIGHT * 2, angle=TAU / 4, color=RED)
|
||||
|
||||
# Curved arrow (arc with tip)
|
||||
curved_arrow = CurvedArrow(LEFT * 2, RIGHT * 2, color=ORANGE)
|
||||
```
|
||||
|
||||
## Sectors and Annuli
|
||||
|
||||
```python
|
||||
# Sector (pie slice)
|
||||
sector = Sector(outer_radius=2, start_angle=0, angle=PI / 3, fill_opacity=0.7, color=BLUE)
|
||||
|
||||
# Annulus (ring)
|
||||
ring = Annulus(inner_radius=1, outer_radius=2, fill_opacity=0.5, color=GREEN)
|
||||
|
||||
# Annular sector (partial ring)
|
||||
partial_ring = AnnularSector(
|
||||
inner_radius=1, outer_radius=2,
|
||||
angle=PI / 2, start_angle=0,
|
||||
fill_opacity=0.7, color=TEAL
|
||||
)
|
||||
|
||||
# Cutout (punch holes in a shape)
|
||||
background = Square(side_length=4, fill_opacity=1, color=BLUE)
|
||||
hole = Circle(radius=0.5)
|
||||
cutout = Cutout(background, hole, fill_opacity=1, color=BLUE)
|
||||
```
|
||||
|
||||
Use cases: pie charts, ring progress indicators, Venn diagrams with arcs, geometric proofs.
|
||||
|
||||
## Positioning
|
||||
|
||||
```python
|
||||
mob.move_to(ORIGIN) # center
|
||||
mob.move_to(UP * 2 + RIGHT) # relative
|
||||
label.next_to(circle, DOWN, buff=0.3) # next to another
|
||||
title.to_edge(UP, buff=0.5) # screen edge (buff >= 0.5!)
|
||||
mob.to_corner(UL, buff=0.5) # corner
|
||||
```
|
||||
|
||||
## VGroup vs Group
|
||||
|
||||
**VGroup** is for collections of shapes (VMobjects only — Circle, Square, Arrow, Line, MathTex):
|
||||
```python
|
||||
shapes = VGroup(circle, square, arrow)
|
||||
shapes.arrange(DOWN, buff=0.5)
|
||||
shapes.set_color(BLUE)
|
||||
```
|
||||
|
||||
**Group** is for mixed collections (Text + shapes, or any Mobject types):
|
||||
```python
|
||||
# Text objects are Mobjects, not VMobjects — use Group when mixing
|
||||
labeled_shape = Group(circle, Text("Label").next_to(circle, DOWN))
|
||||
labeled_shape.move_to(ORIGIN)
|
||||
|
||||
# FadeOut everything on screen (may contain mixed types)
|
||||
self.play(FadeOut(Group(*self.mobjects)))
|
||||
```
|
||||
|
||||
**Rule: if your group contains any `Text()` objects, use `Group`, not `VGroup`.** VGroup will raise a TypeError on Manim CE v0.20+. MathTex and Tex are VMobjects and work with VGroup.
|
||||
|
||||
Both support `arrange()`, `arrange_in_grid()`, `set_opacity()`, `shift()`, `scale()`, `move_to()`.
|
||||
|
||||
## Styling
|
||||
|
||||
```python
|
||||
mob.set_color(BLUE)
|
||||
mob.set_fill(RED, opacity=0.5)
|
||||
mob.set_stroke(WHITE, width=2)
|
||||
mob.set_opacity(0.4)
|
||||
mob.set_z_index(1) # layering
|
||||
```
|
||||
|
||||
## Specialized Mobjects
|
||||
|
||||
```python
|
||||
nl = NumberLine(x_range=[-3, 3, 1], length=8, include_numbers=True)
|
||||
table = Table([["A", "B"], ["C", "D"]], row_labels=[Text("R1"), Text("R2")])
|
||||
code = Code("example.py", tab_width=4, font_size=20, language="python")
|
||||
highlight = SurroundingRectangle(target, color=YELLOW, buff=0.2)
|
||||
bg = BackgroundRectangle(equation, fill_opacity=0.7, buff=0.2)
|
||||
```
|
||||
|
||||
## Custom Mobjects
|
||||
|
||||
```python
|
||||
class NetworkNode(Group):
|
||||
def __init__(self, label_text, color=BLUE, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.circle = Circle(radius=0.4, color=color, fill_opacity=0.3)
|
||||
self.label = Text(label_text, font_size=20).move_to(self.circle)
|
||||
self.add(self.circle, self.label)
|
||||
```
|
||||
|
||||
## Matrix Mobjects
|
||||
|
||||
Display matrices as grids of numbers or mobjects:
|
||||
|
||||
```python
|
||||
# Integer matrix
|
||||
m = IntegerMatrix([[1, 2], [3, 4]])
|
||||
|
||||
# Decimal matrix (control decimal places)
|
||||
m = DecimalMatrix([[1.5, 2.7], [3.1, 4.9]], element_to_mobject_config={"num_decimal_places": 2})
|
||||
|
||||
# Mobject matrix (any mobject in each cell)
|
||||
m = MobjectMatrix([
|
||||
[MathTex(r"\pi"), MathTex(r"e")],
|
||||
[MathTex(r"\phi"), MathTex(r"\tau")]
|
||||
])
|
||||
|
||||
# Bracket types: "(" "[" "|" or "\\{"
|
||||
m = IntegerMatrix([[1, 0], [0, 1]], left_bracket="[", right_bracket="]")
|
||||
```
|
||||
|
||||
Use cases: linear algebra, transformation matrices, system-of-equations coefficient display.
|
||||
|
||||
## Constants
|
||||
|
||||
Directions: `UP, DOWN, LEFT, RIGHT, ORIGIN, UL, UR, DL, DR`
|
||||
Colors: `RED, BLUE, GREEN, YELLOW, WHITE, GRAY, ORANGE, PINK, PURPLE, TEAL, GOLD`
|
||||
Frame: `config.frame_width = 14.222, config.frame_height = 8.0`
|
||||
|
||||
## SVGMobject — Import SVG Files
|
||||
|
||||
```python
|
||||
logo = SVGMobject("path/to/logo.svg")
|
||||
logo.set_color(WHITE).scale(0.5).to_corner(UR)
|
||||
self.play(FadeIn(logo))
|
||||
|
||||
# SVG submobjects are individually animatable
|
||||
for part in logo.submobjects:
|
||||
self.play(part.animate.set_color(random_color()))
|
||||
```
|
||||
|
||||
## ImageMobject — Display Images
|
||||
|
||||
```python
|
||||
img = ImageMobject("screenshot.png")
|
||||
img.set_height(3).to_edge(RIGHT)
|
||||
self.play(FadeIn(img))
|
||||
```
|
||||
|
||||
Note: images cannot be animated with `.animate` (they're raster, not vector). Use `FadeIn`/`FadeOut` and `shift`/`scale` only.
|
||||
|
||||
## Variable — Auto-Updating Display
|
||||
|
||||
```python
|
||||
var = Variable(0, Text("x"), num_decimal_places=2)
|
||||
var.move_to(ORIGIN)
|
||||
self.add(var)
|
||||
|
||||
# Animate the value
|
||||
self.play(var.tracker.animate.set_value(5), run_time=2)
|
||||
# Display auto-updates: "x = 5.00"
|
||||
```
|
||||
|
||||
Cleaner than manual `DecimalNumber` + `add_updater` for simple labeled-value displays.
|
||||
|
||||
## BulletedList
|
||||
|
||||
```python
|
||||
bullets = BulletedList(
|
||||
"First key point",
|
||||
"Second important fact",
|
||||
"Third conclusion",
|
||||
font_size=28
|
||||
)
|
||||
bullets.to_edge(LEFT, buff=1.0)
|
||||
self.play(Write(bullets))
|
||||
|
||||
# Highlight individual items
|
||||
self.play(bullets[1].animate.set_color(YELLOW))
|
||||
```
|
||||
|
||||
## DashedLine and Angle Markers
|
||||
|
||||
```python
|
||||
# Dashed line (asymptotes, construction lines)
|
||||
dashed = DashedLine(LEFT * 3, RIGHT * 3, color=SUBTLE, dash_length=0.15)
|
||||
|
||||
# Angle marker between two lines
|
||||
line1 = Line(ORIGIN, RIGHT * 2)
|
||||
line2 = Line(ORIGIN, UP * 2 + RIGHT)
|
||||
angle = Angle(line1, line2, radius=0.5, color=YELLOW)
|
||||
angle_label = angle.get_value() # returns the angle in radians
|
||||
|
||||
# Right angle marker
|
||||
right_angle = RightAngle(line1, Line(ORIGIN, UP * 2), length=0.3, color=WHITE)
|
||||
```
|
||||
|
||||
## Boolean Operations (CSG)
|
||||
|
||||
Combine, subtract, or intersect 2D shapes:
|
||||
|
||||
```python
|
||||
circle = Circle(radius=1.5, color=BLUE, fill_opacity=0.5).shift(LEFT * 0.5)
|
||||
square = Square(side_length=2, color=RED, fill_opacity=0.5).shift(RIGHT * 0.5)
|
||||
|
||||
# Union, Intersection, Difference, Exclusion
|
||||
union = Union(circle, square, color=GREEN, fill_opacity=0.5)
|
||||
intersect = Intersection(circle, square, color=YELLOW, fill_opacity=0.5)
|
||||
diff = Difference(circle, square, color=PURPLE, fill_opacity=0.5)
|
||||
exclude = Exclusion(circle, square, color=ORANGE, fill_opacity=0.5)
|
||||
```
|
||||
|
||||
Use cases: Venn diagrams, set theory, geometric proofs, area calculations.
|
||||
|
||||
## LabeledArrow / LabeledLine
|
||||
|
||||
```python
|
||||
# Arrow with built-in label (auto-positioned)
|
||||
arr = LabeledArrow(Text("force", font_size=18), start=LEFT, end=RIGHT, color=RED)
|
||||
|
||||
# Line with label
|
||||
line = LabeledLine(Text("d = 5m", font_size=18), start=LEFT * 2, end=RIGHT * 2)
|
||||
```
|
||||
|
||||
Auto-handles label positioning — cleaner than manual `Arrow` + `Text().next_to()`.
|
||||
|
||||
## Text Color/Font/Style Per-Substring (t2c, t2f, t2s, t2w)
|
||||
|
||||
```python
|
||||
# Color specific words (t2c = text-to-color)
|
||||
text = Text(
|
||||
"Gradient descent minimizes the loss function",
|
||||
t2c={"Gradient descent": BLUE, "loss function": RED}
|
||||
)
|
||||
|
||||
# Different fonts per word (t2f = text-to-font)
|
||||
text = Text(
|
||||
"Use Menlo for code and Inter for prose",
|
||||
t2f={"Menlo": "Menlo", "Inter": "Inter"}
|
||||
)
|
||||
|
||||
# Italic/slant per word (t2s = text-to-slant)
|
||||
text = Text("Normal and italic text", t2s={"italic": ITALIC})
|
||||
|
||||
# Bold per word (t2w = text-to-weight)
|
||||
text = Text("Normal and bold text", t2w={"bold": BOLD})
|
||||
```
|
||||
|
||||
These are much cleaner than creating separate Text objects and grouping them.
|
||||
|
||||
## Backstroke for Readability Over Backgrounds
|
||||
|
||||
When text overlaps other content (graphs, diagrams, images), add a dark stroke behind it:
|
||||
|
||||
```python
|
||||
# CE syntax:
|
||||
label.set_stroke(BLACK, width=5, background=True)
|
||||
|
||||
# Apply to a group
|
||||
for mob in labels:
|
||||
mob.set_stroke(BLACK, width=4, background=True)
|
||||
```
|
||||
|
||||
This is how 3Blue1Brown keeps text readable over complex backgrounds without using BackgroundRectangle.
|
||||
|
||||
## Complex Function Transforms
|
||||
|
||||
Apply complex functions to entire mobjects — transforms the plane:
|
||||
|
||||
```python
|
||||
c_grid = ComplexPlane()
|
||||
moving_grid = c_grid.copy()
|
||||
moving_grid.prepare_for_nonlinear_transform() # adds more sample points for smooth deformation
|
||||
|
||||
self.play(
|
||||
moving_grid.animate.apply_complex_function(lambda z: z**2),
|
||||
run_time=5,
|
||||
)
|
||||
|
||||
# Also works with R3->R3 functions:
|
||||
self.play(grid.animate.apply_function(
|
||||
lambda p: [p[0] + 0.5 * math.sin(p[1]), p[1] + 0.5 * math.sin(p[0]), p[2]]
|
||||
), run_time=5)
|
||||
```
|
||||
|
||||
**Critical:** Call `prepare_for_nonlinear_transform()` before applying nonlinear functions — without it, the grid has too few sample points and the deformation looks jagged.
|
||||
255
skills/creative/manim-video/references/paper-explainer.md
Normal file
255
skills/creative/manim-video/references/paper-explainer.md
Normal file
@@ -0,0 +1,255 @@
|
||||
# Paper Explainer Workflow
|
||||
|
||||
How to turn a research paper into an animated explainer video.
|
||||
|
||||
## Why animate a paper?
|
||||
|
||||
A research paper is optimized for precision and completeness. A video is optimized for understanding and retention. The translation is NOT "read the paper aloud with pictures" — it's "extract the core insight and make it feel obvious through visual storytelling."
|
||||
|
||||
The paper has one job: prove the claim is true. The video has a different job: make the viewer understand WHY the claim is true, and WHY it matters.
|
||||
|
||||
## Who is watching?
|
||||
|
||||
Before anything, decide the audience:
|
||||
|
||||
| Audience | Prerequisites | Pacing | Depth |
|
||||
|----------|--------------|--------|-------|
|
||||
| General public | None | Slow, many analogies | Intuition only, skip proofs |
|
||||
| Undergrad students | Basic math/CS | Medium, some formalism | Key equations, skip derivations |
|
||||
| Grad students / researchers | Domain knowledge | Faster, more notation | Full equations, sketch proofs |
|
||||
|
||||
This determines everything: vocabulary, pacing, which sections to animate, how much math to show.
|
||||
|
||||
## The 5-minute template
|
||||
|
||||
Most paper explainers fit this structure (scale times proportionally for longer videos):
|
||||
|
||||
| Section | Duration | Purpose |
|
||||
|---------|----------|---------|
|
||||
| **Hook** | 0:00-0:30 | Surprising result or provocative question |
|
||||
| **Problem** | 0:30-1:30 | What was broken/missing before this paper |
|
||||
| **Key insight** | 1:30-3:00 | The core idea, explained visually |
|
||||
| **How it works** | 3:00-4:00 | Method/algorithm, simplified |
|
||||
| **Evidence** | 4:00-4:30 | Key result that proves it works |
|
||||
| **Implications** | 4:30-5:00 | Why it matters, what it enables |
|
||||
|
||||
### What to skip
|
||||
|
||||
- Related work survey → one sentence: "Previous approaches did X, which had problem Y"
|
||||
- Implementation details → skip unless they're the contribution
|
||||
- Ablation studies → show one chart at most
|
||||
- Proofs → show the key step, not the full proof
|
||||
- Hyperparameter tuning → skip entirely
|
||||
|
||||
### What to expand
|
||||
|
||||
- The core insight → this gets the most screen time
|
||||
- Geometric/visual intuition → if the paper has math, show what it MEANS
|
||||
- Before/after comparison → the most compelling evidence
|
||||
|
||||
## Pre-code workflow
|
||||
|
||||
### Gate 1: Narration script
|
||||
|
||||
Write the full narration before any code. Every sentence maps to a visual beat. If you can't write the narration, you don't understand the paper well enough to animate it.
|
||||
|
||||
```markdown
|
||||
## Hook (30s)
|
||||
"What if I told you that a model with 7 billion parameters can outperform
|
||||
one with 70 billion — if you train it on the right data?"
|
||||
|
||||
## Problem (60s)
|
||||
"The standard approach is to scale up. More parameters, more compute.
|
||||
[VISUAL: bar chart showing model sizes growing exponentially]
|
||||
But Chinchilla showed us that most models are undertrained..."
|
||||
```
|
||||
|
||||
### Gate 2: Scene list
|
||||
|
||||
After the narration, break it into scenes. Each scene is one Manim class.
|
||||
|
||||
```markdown
|
||||
Scene 1: Hook — surprising stat with animated counter
|
||||
Scene 2: Problem — model size bar chart growing
|
||||
Scene 3: Key insight — training data vs parameters, animated 2D plot
|
||||
Scene 4: Method — pipeline diagram building left to right
|
||||
Scene 5: Results — before/after comparison with animated bars
|
||||
Scene 6: Closing — implications text
|
||||
```
|
||||
|
||||
### Gate 3: Style constants
|
||||
|
||||
Before coding scenes, define the visual language:
|
||||
|
||||
```python
|
||||
# style.py — import in every scene file
|
||||
BG = "#0D1117"
|
||||
PRIMARY = "#58C4DD"
|
||||
SECONDARY = "#83C167"
|
||||
ACCENT = "#FFFF00"
|
||||
HIGHLIGHT = "#FF6B6B"
|
||||
MONO = "Menlo"
|
||||
|
||||
# Color meanings for THIS paper
|
||||
MODEL_COLOR = PRIMARY # "the model"
|
||||
DATA_COLOR = SECONDARY # "training data"
|
||||
BASELINE_COLOR = HIGHLIGHT # "previous approach"
|
||||
RESULT_COLOR = ACCENT # "our result"
|
||||
```
|
||||
|
||||
## First-principles equation explanation
|
||||
|
||||
When the paper has a key equation, don't just show it — build it from intuition:
|
||||
|
||||
### The "what would you do?" pattern
|
||||
|
||||
1. Pose the problem in plain language
|
||||
2. Ask what the simplest solution would be
|
||||
3. Show why it doesn't work (animate the failure)
|
||||
4. Introduce the paper's solution as the fix
|
||||
5. THEN show the equation — it now feels earned
|
||||
|
||||
```python
|
||||
# Scene: Why we need attention (for a Transformer paper)
|
||||
# Step 1: "How do we let each word look at every other word?"
|
||||
# Step 2: Show naive approach (fully connected = O(n²) everything)
|
||||
# Step 3: Show it breaks (information overload, no selectivity)
|
||||
# Step 4: "What if each word could CHOOSE which words to attend to?"
|
||||
# Step 5: Show attention equation — Q, K, V now mean something
|
||||
```
|
||||
|
||||
### Equation reveal strategy
|
||||
|
||||
```python
|
||||
# Show equation dimmed first (full destination)
|
||||
eq = MathTex(r"Attention(Q,K,V) = softmax\left(\frac{QK^T}{\sqrt{d_k}}\right)V")
|
||||
eq.set_opacity(0.15)
|
||||
self.play(FadeIn(eq))
|
||||
|
||||
# Highlight Q, K, V one at a time with color + label
|
||||
for part, color, label_text in [
|
||||
(r"Q", PRIMARY, "Query: what am I looking for?"),
|
||||
(r"K", SECONDARY, "Key: what do I contain?"),
|
||||
(r"V", ACCENT, "Value: what do I output?"),
|
||||
]:
|
||||
eq.set_color_by_tex(part, color)
|
||||
label = Text(label_text, font_size=18, color=color, font=MONO)
|
||||
# position label, animate it, wait, then dim it
|
||||
```
|
||||
|
||||
## Building architecture diagrams
|
||||
|
||||
### The progressive build pattern
|
||||
|
||||
Don't show the full architecture at once. Build it:
|
||||
|
||||
1. First component appears alone → explain
|
||||
2. Arrow grows → "this feeds into..."
|
||||
3. Second component appears → explain
|
||||
4. Repeat until complete
|
||||
|
||||
```python
|
||||
# Component factory
|
||||
def make_box(label, color, width=2.0, height=0.8):
|
||||
box = RoundedRectangle(corner_radius=0.1, width=width, height=height,
|
||||
color=color, fill_opacity=0.1, stroke_width=1.5)
|
||||
text = Text(label, font_size=18, font=MONO, color=color).move_to(box)
|
||||
return Group(box, text)
|
||||
|
||||
encoder = make_box("Encoder", PRIMARY)
|
||||
decoder = make_box("Decoder", SECONDARY).next_to(encoder, RIGHT, buff=1.5)
|
||||
arrow = Arrow(encoder.get_right(), decoder.get_left(), color=DIM, stroke_width=1.5)
|
||||
|
||||
self.play(FadeIn(encoder))
|
||||
self.wait(1) # explain encoder
|
||||
self.play(GrowArrow(arrow))
|
||||
self.play(FadeIn(decoder))
|
||||
self.wait(1) # explain decoder
|
||||
```
|
||||
|
||||
### Data flow animation
|
||||
|
||||
After building the diagram, show data moving through it:
|
||||
|
||||
```python
|
||||
# Dot traveling along the pipeline
|
||||
data_dot = Dot(color=ACCENT, radius=0.1).move_to(encoder)
|
||||
self.play(FadeIn(data_dot))
|
||||
self.play(MoveAlongPath(data_dot, arrow), run_time=1)
|
||||
self.play(data_dot.animate.move_to(decoder), run_time=0.5)
|
||||
self.play(Flash(data_dot.get_center(), color=ACCENT), run_time=0.3)
|
||||
```
|
||||
|
||||
## Animating results
|
||||
|
||||
### Bar chart comparison (most common)
|
||||
|
||||
```python
|
||||
# Before/after bars
|
||||
before_data = [45, 52, 38, 61]
|
||||
after_data = [78, 85, 72, 91]
|
||||
labels = ["Task A", "Task B", "Task C", "Task D"]
|
||||
|
||||
before_chart = BarChart(before_data, bar_names=labels,
|
||||
y_range=[0, 100, 20], bar_colors=[HIGHLIGHT]*4).scale(0.6).shift(LEFT*3)
|
||||
after_chart = BarChart(after_data, bar_names=labels,
|
||||
y_range=[0, 100, 20], bar_colors=[SECONDARY]*4).scale(0.6).shift(RIGHT*3)
|
||||
|
||||
before_label = Text("Baseline", font_size=20, color=HIGHLIGHT, font=MONO)
|
||||
after_label = Text("Ours", font_size=20, color=SECONDARY, font=MONO)
|
||||
|
||||
# Reveal baseline first, then ours (dramatic comparison)
|
||||
self.play(Create(before_chart), FadeIn(before_label))
|
||||
self.wait(1.5)
|
||||
self.play(Create(after_chart), FadeIn(after_label))
|
||||
self.wait(0.5)
|
||||
|
||||
# Highlight the improvement
|
||||
improvement = Text("+35% avg", font_size=24, color=ACCENT, font=MONO)
|
||||
self.play(FadeIn(improvement))
|
||||
```
|
||||
|
||||
### Training curve (for ML papers)
|
||||
|
||||
```python
|
||||
tracker = ValueTracker(0)
|
||||
curve = always_redraw(lambda: axes.plot(
|
||||
lambda x: 1 - 0.8 * np.exp(-x / 3),
|
||||
x_range=[0, tracker.get_value()], color=PRIMARY
|
||||
))
|
||||
epoch_label = always_redraw(lambda: Text(
|
||||
f"Epoch {int(tracker.get_value())}", font_size=18, font=MONO
|
||||
).to_corner(UR))
|
||||
|
||||
self.add(curve, epoch_label)
|
||||
self.play(tracker.animate.set_value(10), run_time=5, rate_func=linear)
|
||||
```
|
||||
|
||||
## Domain-specific patterns
|
||||
|
||||
### ML papers
|
||||
- Show data flow through the model (animated pipeline)
|
||||
- Training curves with `ValueTracker`
|
||||
- Attention heatmaps as colored grids
|
||||
- Embedding space as 2D scatter (PCA/t-SNE visualization)
|
||||
- Loss landscape as 3D surface with gradient descent dot
|
||||
|
||||
### Physics/math papers
|
||||
- Use `LinearTransformationScene` for linear algebra
|
||||
- Vector fields with `ArrowVectorField` / `StreamLines`
|
||||
- Phase spaces with `NumberPlane` + trajectories
|
||||
- Wave equations with time-parameterized plots
|
||||
|
||||
### Systems/architecture papers
|
||||
- Pipeline diagrams built progressively
|
||||
- `ShowPassingFlash` for data flow along arrows
|
||||
- `ZoomedScene` for zooming into components
|
||||
- Before/after latency/throughput comparisons
|
||||
|
||||
## Common mistakes
|
||||
|
||||
1. **Trying to cover the whole paper.** A 5-minute video can explain ONE core insight well. Covering everything means explaining nothing.
|
||||
2. **Reading the abstract as narration.** Academic writing is designed for readers, not listeners. Rewrite in conversational language.
|
||||
3. **Showing notation without meaning.** Never show a symbol without first showing what it represents visually.
|
||||
4. **Skipping the motivation.** Jumping straight to "here's our method" without showing why the problem matters. The Problem section is what makes the viewer care.
|
||||
5. **Identical pacing throughout.** The hook and key insight need the most visual energy. The method section can be faster. Evidence should land with impact (pause after showing the big number).
|
||||
190
skills/creative/manim-video/references/production-quality.md
Normal file
190
skills/creative/manim-video/references/production-quality.md
Normal file
@@ -0,0 +1,190 @@
|
||||
# Production Quality Checklist
|
||||
|
||||
Standards and checks for ensuring animation output is publication-ready.
|
||||
|
||||
## Pre-Code Checklist
|
||||
|
||||
Before writing any Manim code:
|
||||
|
||||
- [ ] Narration script written with visual beats marked
|
||||
- [ ] Scene list with purpose, duration, and layout for each
|
||||
- [ ] Color palette defined with meaning assignments (`PRIMARY` = main concept, etc.)
|
||||
- [ ] `MONO = "Menlo"` set as the font constant
|
||||
- [ ] Target resolution and aspect ratio decided
|
||||
|
||||
## Text Quality
|
||||
|
||||
### Overlap prevention
|
||||
|
||||
```python
|
||||
# RULE: buff >= 0.5 for edge text
|
||||
label.to_edge(DOWN, buff=0.5) # GOOD
|
||||
label.to_edge(DOWN, buff=0.3) # BAD — may clip
|
||||
|
||||
# RULE: FadeOut previous before adding new at same position
|
||||
self.play(ReplacementTransform(note1, note2)) # GOOD
|
||||
self.play(Write(note2)) # BAD — overlaps note1
|
||||
|
||||
# RULE: Reduce font size for dense scenes
|
||||
# When > 4 text elements visible, use font_size=20 not 28
|
||||
```
|
||||
|
||||
### Width enforcement
|
||||
|
||||
Long text strings overflow the frame:
|
||||
|
||||
```python
|
||||
# RULE: Set max width for any text that might be long
|
||||
text = Text("This is a potentially long description", font_size=22, font=MONO)
|
||||
if text.width > config.frame_width - 1.0:
|
||||
text.set_width(config.frame_width - 1.0)
|
||||
```
|
||||
|
||||
### Font consistency
|
||||
|
||||
```python
|
||||
# RULE: Define MONO once, use everywhere
|
||||
MONO = "Menlo"
|
||||
|
||||
# WRONG: mixing fonts
|
||||
Text("Title", font="Helvetica")
|
||||
Text("Label", font="Arial")
|
||||
Text("Code", font="Courier")
|
||||
|
||||
# RIGHT: one font
|
||||
Text("Title", font=MONO, weight=BOLD, font_size=48)
|
||||
Text("Label", font=MONO, font_size=20)
|
||||
Text("Code", font=MONO, font_size=18)
|
||||
```
|
||||
|
||||
## Spatial Layout
|
||||
|
||||
### The coordinate budget
|
||||
|
||||
The visible frame is approximately 14.2 wide × 8.0 tall (default 16:9). With mandatory margins:
|
||||
|
||||
```
|
||||
Usable area: x ∈ [-6.5, 6.5], y ∈ [-3.5, 3.5]
|
||||
Top title zone: y ∈ [2.5, 3.5]
|
||||
Bottom note zone: y ∈ [-3.5, -2.5]
|
||||
Main content: y ∈ [-2.5, 2.5], x ∈ [-6.0, 6.0]
|
||||
```
|
||||
|
||||
### Fill the frame
|
||||
|
||||
Empty scenes look unfinished. If the main content is small, add context:
|
||||
- A dimmed grid/axes behind the content
|
||||
- A title/subtitle at the top
|
||||
- A source citation at the bottom
|
||||
- Decorative geometry at low opacity
|
||||
|
||||
### Maximum simultaneous elements
|
||||
|
||||
**Hard limit: 6 actively visible elements.** Beyond that, the viewer can't track everything. If you need more:
|
||||
- Dim old elements to opacity 0.3
|
||||
- Remove elements that have served their purpose
|
||||
- Split into two scenes
|
||||
|
||||
## Animation Quality
|
||||
|
||||
### Variety audit
|
||||
|
||||
Check that no two consecutive scenes use the exact same:
|
||||
- Animation type (if Scene 3 uses Write for everything, Scene 4 should use FadeIn or Create)
|
||||
- Color emphasis (rotate through palette colors)
|
||||
- Layout (center, left-right, grid — alternate)
|
||||
- Pacing (if Scene 2 was slow and deliberate, Scene 3 can be faster)
|
||||
|
||||
### Tempo curve
|
||||
|
||||
A good video follows a tempo curve:
|
||||
|
||||
```
|
||||
Slow ──→ Medium ──→ FAST (climax) ──→ Slow (conclusion)
|
||||
|
||||
Scene 1: Slow (introduction, setup)
|
||||
Scene 2: Medium (building understanding)
|
||||
Scene 3: Medium-Fast (core content, lots of animation)
|
||||
Scene 4: FAST (montage of applications/results)
|
||||
Scene 5: Slow (conclusion, key takeaway)
|
||||
```
|
||||
|
||||
### Transition quality
|
||||
|
||||
Between scenes:
|
||||
- **Clean exit**: `self.play(FadeOut(Group(*self.mobjects)), run_time=0.5)`
|
||||
- **Brief pause**: `self.wait(0.3)` after fadeout, before next scene's first animation
|
||||
- **Never hard-cut**: always animate the transition
|
||||
|
||||
## Color Quality
|
||||
|
||||
### Dimming on dark backgrounds
|
||||
|
||||
Colors that look vibrant on white look muddy on dark backgrounds (#0D1117, #1C1C1C). Test your palette:
|
||||
|
||||
```python
|
||||
# Colors that work well on dark backgrounds:
|
||||
# Bright and saturated: #58C4DD, #83C167, #FFFF00, #FF6B6B
|
||||
# Colors that DON'T work: #666666 (invisible), #2244AA (too dark)
|
||||
|
||||
# RULE: Structural elements (axes, grids) at opacity 0.15
|
||||
# Context elements at 0.3-0.4
|
||||
# Primary elements at 1.0
|
||||
```
|
||||
|
||||
### Color meaning consistency
|
||||
|
||||
Once a color is assigned a meaning, it keeps that meaning for the entire video:
|
||||
|
||||
```python
|
||||
# If PRIMARY (#58C4DD) means "the model" in Scene 1,
|
||||
# it means "the model" in every scene.
|
||||
# Never reuse PRIMARY for a different concept later.
|
||||
```
|
||||
|
||||
## Data Visualization Quality
|
||||
|
||||
### Minimum requirements for charts
|
||||
|
||||
- Axis labels on every axis
|
||||
- Y-axis range starts at 0 (or has a clear break indicator)
|
||||
- Bar/line colors match the legend
|
||||
- Numbers on notable data points (at least the maximum and the comparison point)
|
||||
|
||||
### Animated counters
|
||||
|
||||
When showing a number changing:
|
||||
```python
|
||||
# GOOD: DecimalNumber with smooth animation
|
||||
counter = DecimalNumber(0, font_size=48, num_decimal_places=0, font="Menlo")
|
||||
self.play(counter.animate.set_value(1000), run_time=3, rate_func=rush_from)
|
||||
|
||||
# BAD: Text that jumps between values
|
||||
```
|
||||
|
||||
## Pre-Render Checklist
|
||||
|
||||
Before running `manim -qh`:
|
||||
|
||||
- [ ] All scenes render without errors at `-ql`
|
||||
- [ ] Preview stills at `-qm` for text-heavy scenes (check kerning)
|
||||
- [ ] Background color set in every scene (`self.camera.background_color = BG`)
|
||||
- [ ] `add_subcaption()` or `subcaption=` on every significant animation
|
||||
- [ ] No text smaller than font_size=18
|
||||
- [ ] No text using proportional fonts (use monospace)
|
||||
- [ ] buff >= 0.5 on all `.to_edge()` calls
|
||||
- [ ] Clean exit (FadeOut all) at end of every scene
|
||||
- [ ] `self.wait()` after every reveal
|
||||
- [ ] Color constants used (no hardcoded hex strings in scene code)
|
||||
- [ ] All scenes use the same quality flag (don't mix `-ql` and `-qh`)
|
||||
|
||||
## Post-Render Checklist
|
||||
|
||||
After stitching the final video:
|
||||
|
||||
- [ ] Watch the complete video at 1x speed — does it feel rushed anywhere?
|
||||
- [ ] Is there a moment where two things animate simultaneously and it's confusing?
|
||||
- [ ] Does every text label have enough time to be read?
|
||||
- [ ] Are transitions between scenes smooth (no black frames, no jarring cuts)?
|
||||
- [ ] Is the audio in sync with the visuals (if using voiceover)?
|
||||
- [ ] Is the Gibbs-like "first impression" good? The first 5 seconds determine if someone keeps watching
|
||||
185
skills/creative/manim-video/references/rendering.md
Normal file
185
skills/creative/manim-video/references/rendering.md
Normal file
@@ -0,0 +1,185 @@
|
||||
# Rendering Reference
|
||||
|
||||
## Prerequisites
|
||||
|
||||
```bash
|
||||
manim --version # Manim CE
|
||||
pdflatex --version # LaTeX
|
||||
ffmpeg -version # ffmpeg
|
||||
```
|
||||
|
||||
## CLI Reference
|
||||
|
||||
```bash
|
||||
manim -ql script.py Scene1 Scene2 # draft (480p 15fps)
|
||||
manim -qm script.py Scene1 # medium (720p 30fps)
|
||||
manim -qh script.py Scene1 # production (1080p 60fps)
|
||||
manim -ql --format=png -s script.py Scene1 # preview still (last frame)
|
||||
manim -ql --format=gif script.py Scene1 # GIF output
|
||||
```
|
||||
|
||||
## Quality Presets
|
||||
|
||||
| Flag | Resolution | FPS | Use case |
|
||||
|------|-----------|-----|----------|
|
||||
| `-ql` | 854x480 | 15 | Draft iteration (layout, timing) |
|
||||
| `-qm` | 1280x720 | 30 | Preview (use for text-heavy scenes) |
|
||||
| `-qh` | 1920x1080 | 60 | Production |
|
||||
|
||||
**Text rendering quality:** `-ql` (480p15) produces noticeably poor text kerning and readability. For scenes with significant text, preview stills at `-qm` to catch issues invisible at 480p. Use `-ql` only for testing layout and animation timing.
|
||||
|
||||
## Output Structure
|
||||
|
||||
```
|
||||
media/videos/script/480p15/Scene1_Intro.mp4
|
||||
media/images/script/Scene1_Intro.png (from -s flag)
|
||||
```
|
||||
|
||||
## Stitching with ffmpeg
|
||||
|
||||
```bash
|
||||
cat > concat.txt << 'EOF'
|
||||
file 'media/videos/script/480p15/Scene1_Intro.mp4'
|
||||
file 'media/videos/script/480p15/Scene2_Core.mp4'
|
||||
EOF
|
||||
ffmpeg -y -f concat -safe 0 -i concat.txt -c copy final.mp4
|
||||
```
|
||||
|
||||
## Add Voiceover
|
||||
|
||||
```bash
|
||||
# Mux narration
|
||||
ffmpeg -y -i final.mp4 -i narration.mp3 -c:v copy -c:a aac -b:a 192k -shortest final_narrated.mp4
|
||||
|
||||
# Concat per-scene audio first
|
||||
cat > audio_concat.txt << 'EOF'
|
||||
file 'audio/scene1.mp3'
|
||||
file 'audio/scene2.mp3'
|
||||
EOF
|
||||
ffmpeg -y -f concat -safe 0 -i audio_concat.txt -c copy full_narration.mp3
|
||||
```
|
||||
|
||||
## Add Background Music
|
||||
|
||||
```bash
|
||||
ffmpeg -y -i final.mp4 -i music.mp3 \
|
||||
-filter_complex "[1:a]volume=0.15[bg];[0:a][bg]amix=inputs=2:duration=shortest" \
|
||||
-c:v copy final_with_music.mp4
|
||||
```
|
||||
|
||||
## GIF Export
|
||||
|
||||
```bash
|
||||
ffmpeg -y -i scene.mp4 \
|
||||
-vf "fps=15,scale=640:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
|
||||
output.gif
|
||||
```
|
||||
|
||||
## Aspect Ratios
|
||||
|
||||
```bash
|
||||
manim -ql --resolution 1080,1920 script.py Scene # 9:16 vertical
|
||||
manim -ql --resolution 1080,1080 script.py Scene # 1:1 square
|
||||
```
|
||||
|
||||
## Render Workflow
|
||||
|
||||
1. Draft render all scenes at `-ql`
|
||||
2. Preview stills at key moments (`-s`)
|
||||
3. Fix and re-render only broken scenes
|
||||
4. Stitch with ffmpeg
|
||||
5. Review stitched output
|
||||
6. Production render at `-qh`
|
||||
7. Re-stitch + add audio
|
||||
|
||||
## manim.cfg — Project Configuration
|
||||
|
||||
Create `manim.cfg` in the project directory for per-project defaults:
|
||||
|
||||
```ini
|
||||
[CLI]
|
||||
quality = low_quality
|
||||
preview = True
|
||||
media_dir = ./media
|
||||
|
||||
[renderer]
|
||||
background_color = #0D1117
|
||||
|
||||
[tex]
|
||||
tex_template_file = custom_template.tex
|
||||
```
|
||||
|
||||
This eliminates repetitive CLI flags and `self.camera.background_color` in every scene.
|
||||
|
||||
## Sections — Chapter Markers
|
||||
|
||||
Mark sections within a scene for organized output:
|
||||
|
||||
```python
|
||||
class LongVideo(Scene):
|
||||
def construct(self):
|
||||
self.next_section("Introduction")
|
||||
# ... intro content ...
|
||||
|
||||
self.next_section("Main Concept")
|
||||
# ... main content ...
|
||||
|
||||
self.next_section("Conclusion")
|
||||
# ... closing ...
|
||||
```
|
||||
|
||||
Render individual sections: `manim --save_sections script.py LongVideo`
|
||||
This outputs separate video files per section — useful for long videos where you want to re-render only one part.
|
||||
|
||||
## manim-voiceover Plugin (Recommended for Narrated Videos)
|
||||
|
||||
The official `manim-voiceover` plugin integrates TTS directly into scene code, auto-syncing animation duration to voiceover length. This is significantly cleaner than the manual ffmpeg muxing approach above.
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
pip install "manim-voiceover[elevenlabs]"
|
||||
# Or for free/local TTS:
|
||||
pip install "manim-voiceover[gtts]" # Google TTS (free, lower quality)
|
||||
pip install "manim-voiceover[azure]" # Azure Cognitive Services
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```python
|
||||
from manim import *
|
||||
from manim_voiceover import VoiceoverScene
|
||||
from manim_voiceover.services.elevenlabs import ElevenLabsService
|
||||
|
||||
class NarratedScene(VoiceoverScene):
|
||||
def construct(self):
|
||||
self.set_speech_service(ElevenLabsService(
|
||||
voice_name="Alice",
|
||||
model_id="eleven_multilingual_v2"
|
||||
))
|
||||
|
||||
# Voiceover auto-controls scene duration
|
||||
with self.voiceover(text="Here is a circle being drawn.") as tracker:
|
||||
self.play(Create(Circle()), run_time=tracker.duration)
|
||||
|
||||
with self.voiceover(text="Now let's transform it into a square.") as tracker:
|
||||
self.play(Transform(circle, Square()), run_time=tracker.duration)
|
||||
```
|
||||
|
||||
### Key Features
|
||||
|
||||
- `tracker.duration` — total voiceover duration in seconds
|
||||
- `tracker.time_until_bookmark("mark1")` — sync specific animations to specific words
|
||||
- Auto-generates subtitle `.srt` files
|
||||
- Caches audio locally — re-renders don't re-generate TTS
|
||||
- Works with: ElevenLabs, Azure, Google TTS, pyttsx3 (offline), and custom services
|
||||
|
||||
### Bookmarks for Precise Sync
|
||||
|
||||
```python
|
||||
with self.voiceover(text='This is a <bookmark mark="circle"/>circle.') as tracker:
|
||||
self.wait_until_bookmark("circle")
|
||||
self.play(Create(Circle()), run_time=tracker.time_until_bookmark("circle", limit=1))
|
||||
```
|
||||
|
||||
This is the recommended approach for any video with narration. The manual ffmpeg muxing workflow above is still useful for adding background music or post-production audio mixing.
|
||||
118
skills/creative/manim-video/references/scene-planning.md
Normal file
118
skills/creative/manim-video/references/scene-planning.md
Normal file
@@ -0,0 +1,118 @@
|
||||
# Scene Planning Reference
|
||||
|
||||
## Narrative Arc Structures
|
||||
|
||||
### Discovery Arc (most common)
|
||||
1. Hook -- pose a question or surprising result
|
||||
2. Intuition -- build visual understanding
|
||||
3. Formalize -- introduce the equation/algorithm
|
||||
4. Reveal -- the "aha moment"
|
||||
5. Extend -- implications or generalizations
|
||||
|
||||
### Problem-Solution Arc
|
||||
1. Problem -- what's broken
|
||||
2. Failed attempt -- obvious approach fails
|
||||
3. Key insight -- the idea that works
|
||||
4. Solution -- implement it
|
||||
5. Result -- show improvement
|
||||
|
||||
### Comparison Arc
|
||||
1. Setup -- introduce two approaches
|
||||
2. Approach A -- how it works
|
||||
3. Approach B -- how it works
|
||||
4. Contrast -- differences
|
||||
5. Verdict -- which is better
|
||||
|
||||
### Build-Up Arc (architecture/systems)
|
||||
1. Component A -- first piece
|
||||
2. Component B -- second piece
|
||||
3. Connection -- how they interact
|
||||
4. Scale -- add more pieces
|
||||
5. Full picture -- zoom out
|
||||
|
||||
## Scene Transitions
|
||||
|
||||
### Clean Break (default)
|
||||
```python
|
||||
self.play(FadeOut(Group(*self.mobjects)), run_time=0.5)
|
||||
self.wait(0.3)
|
||||
```
|
||||
|
||||
### Carry-Forward
|
||||
Keep one element, fade the rest. Next scene starts with it still on screen.
|
||||
|
||||
### Transform Bridge
|
||||
End scene with a shape, start next scene by transforming it.
|
||||
|
||||
## Cross-Scene Consistency
|
||||
|
||||
```python
|
||||
# Shared constants at file top
|
||||
BG = "#1C1C1C"
|
||||
PRIMARY = "#58C4DD"
|
||||
SECONDARY = "#83C167"
|
||||
ACCENT = "#FFFF00"
|
||||
TITLE_SIZE = 48
|
||||
BODY_SIZE = 30
|
||||
LABEL_SIZE = 24
|
||||
FAST = 0.8; NORMAL = 1.5; SLOW = 2.5
|
||||
```
|
||||
|
||||
## Scene Checklist
|
||||
|
||||
- [ ] Background color set
|
||||
- [ ] Subcaptions on every animation
|
||||
- [ ] `self.wait()` after every reveal
|
||||
- [ ] Text buff >= 0.5 for edge positioning
|
||||
- [ ] No text overlap
|
||||
- [ ] Color constants used (not hardcoded)
|
||||
- [ ] Opacity layering applied
|
||||
- [ ] Clean exit at scene end
|
||||
- [ ] No more than 5-6 elements visible at once
|
||||
|
||||
## Duration Estimation
|
||||
|
||||
| Content | Duration |
|
||||
|---------|----------|
|
||||
| Title card | 3-5s |
|
||||
| Concept introduction | 10-20s |
|
||||
| Equation reveal | 15-25s |
|
||||
| Algorithm step | 5-10s |
|
||||
| Data comparison | 10-15s |
|
||||
| "Aha moment" | 15-30s |
|
||||
| Conclusion | 5-10s |
|
||||
|
||||
## Planning Template
|
||||
|
||||
```markdown
|
||||
# [Video Title]
|
||||
|
||||
## Overview
|
||||
- **Topic**: [Core concept]
|
||||
- **Hook**: [Opening question]
|
||||
- **Aha moment**: [Key insight]
|
||||
- **Target audience**: [Prerequisites]
|
||||
- **Length**: [seconds/minutes]
|
||||
- **Resolution**: 480p (draft) / 1080p (final)
|
||||
|
||||
## Color Palette
|
||||
- Background: #1C1C1C
|
||||
- Primary: #58C4DD -- [purpose]
|
||||
- Secondary: #83C167 -- [purpose]
|
||||
- Accent: #FFFF00 -- [purpose]
|
||||
|
||||
## Arc: [Discovery / Problem-Solution / Comparison / Build-Up]
|
||||
|
||||
## Scene 1: [Name] (~Ns)
|
||||
**Purpose**: [one sentence]
|
||||
**Layout**: [FULL_CENTER / LEFT_RIGHT / GRID / PROGRESSIVE]
|
||||
|
||||
### Visual elements
|
||||
- [Mobject: type, position, color]
|
||||
|
||||
### Animation sequence
|
||||
1. [Animation] -- [what it reveals] (~Ns)
|
||||
|
||||
### Subtitle
|
||||
"[text]"
|
||||
```
|
||||
135
skills/creative/manim-video/references/troubleshooting.md
Normal file
135
skills/creative/manim-video/references/troubleshooting.md
Normal file
@@ -0,0 +1,135 @@
|
||||
# Troubleshooting
|
||||
|
||||
## LaTeX Errors
|
||||
|
||||
**Missing raw string** (the #1 error):
|
||||
```python
|
||||
# WRONG: MathTex("\\frac{1}{2}") -- \\f is form-feed
|
||||
# RIGHT: MathTex(r"\frac{1}{2}")
|
||||
```
|
||||
|
||||
**Unbalanced braces**: `MathTex(r"\frac{1}{2")` -- missing closing brace.
|
||||
|
||||
**LaTeX not installed**: `which pdflatex` -- install texlive-full or mactex.
|
||||
|
||||
**Missing package**: Add to preamble:
|
||||
```python
|
||||
tex_template = TexTemplate()
|
||||
tex_template.add_to_preamble(r"\usepackage{mathrsfs}")
|
||||
MathTex(r"\mathscr{L}", tex_template=tex_template)
|
||||
```
|
||||
|
||||
## VGroup TypeError
|
||||
|
||||
**Error:** `TypeError: Only values of type VMobject can be added as submobjects of VGroup`
|
||||
|
||||
**Cause:** `Text()` objects are `Mobject`, not `VMobject`. Mixing `Text` with shapes in a `VGroup` fails on Manim CE v0.20+.
|
||||
|
||||
```python
|
||||
# WRONG: Text is not a VMobject
|
||||
group = VGroup(circle, Text("Label"))
|
||||
|
||||
# RIGHT: use Group for mixed types
|
||||
group = Group(circle, Text("Label"))
|
||||
|
||||
# RIGHT: VGroup is fine for shapes-only
|
||||
shapes = VGroup(circle, square, arrow)
|
||||
|
||||
# RIGHT: MathTex IS a VMobject — VGroup works
|
||||
equations = VGroup(MathTex(r"a"), MathTex(r"b"))
|
||||
```
|
||||
|
||||
**Rule:** If the group contains any `Text()`, use `Group`. If it's all shapes or all `MathTex`, `VGroup` is fine.
|
||||
|
||||
**FadeOut everything:** Always use `Group(*self.mobjects)`, not `VGroup(*self.mobjects)`:
|
||||
```python
|
||||
self.play(FadeOut(Group(*self.mobjects))) # safe for mixed types
|
||||
```
|
||||
|
||||
## Group save_state() / restore() Not Supported
|
||||
|
||||
**Error:** `NotImplementedError: Please override in a child class.`
|
||||
|
||||
**Cause:** `Group.save_state()` and `Group.restore()` are not implemented in Manim CE v0.20+. Only `VGroup` and individual `Mobject` subclasses support save/restore.
|
||||
|
||||
```python
|
||||
# WRONG: Group doesn't support save_state
|
||||
group = Group(circle, Text("label"))
|
||||
group.save_state() # NotImplementedError!
|
||||
|
||||
# RIGHT: use FadeIn with shift/scale instead of save_state/restore
|
||||
self.play(FadeIn(group, shift=UP * 0.3, scale=0.8))
|
||||
|
||||
# RIGHT: or save/restore on individual VMobjects
|
||||
circle.save_state()
|
||||
self.play(circle.animate.shift(RIGHT))
|
||||
self.play(Restore(circle))
|
||||
```
|
||||
|
||||
## letter_spacing Is Not a Valid Parameter
|
||||
|
||||
**Error:** `TypeError: Mobject.__init__() got an unexpected keyword argument 'letter_spacing'`
|
||||
|
||||
**Cause:** `Text()` does not accept `letter_spacing`. Manim uses Pango for text rendering and does not expose kerning controls on `Text()`.
|
||||
|
||||
```python
|
||||
# WRONG
|
||||
Text("HERMES", letter_spacing=6)
|
||||
|
||||
# RIGHT: use MarkupText with Pango attributes for spacing control
|
||||
MarkupText('<span letter_spacing="6000">HERMES</span>', font_size=18)
|
||||
# Note: Pango letter_spacing is in 1/1024 of a point
|
||||
```
|
||||
|
||||
## Animation Errors
|
||||
|
||||
**Invisible animation** -- mobject never added:
|
||||
```python
|
||||
# WRONG: circle = Circle(); self.play(circle.animate.set_color(RED))
|
||||
# RIGHT: self.play(Create(circle)); self.play(circle.animate.set_color(RED))
|
||||
```
|
||||
|
||||
**Transform confusion** -- after Transform(A, B), A is on screen, B is not. Use ReplacementTransform if you want B.
|
||||
|
||||
**Duplicate animation** -- same mobject twice in one play():
|
||||
```python
|
||||
# WRONG: self.play(c.animate.shift(RIGHT), c.animate.set_color(RED))
|
||||
# RIGHT: self.play(c.animate.shift(RIGHT).set_color(RED))
|
||||
```
|
||||
|
||||
**Updater fights animation**:
|
||||
```python
|
||||
mob.suspend_updating()
|
||||
self.play(mob.animate.shift(RIGHT))
|
||||
mob.resume_updating()
|
||||
```
|
||||
|
||||
## Rendering Issues
|
||||
|
||||
**Blurry output**: Using -ql (480p). Switch to -qm/-qh for final.
|
||||
|
||||
**Slow render**: Use -ql during development. Reduce Surface resolution. Shorter self.wait().
|
||||
|
||||
**Stale output**: `manim -ql --disable_caching script.py Scene`
|
||||
|
||||
**ffmpeg concat fails**: All clips must match resolution/FPS/codec.
|
||||
|
||||
## Common Mistakes
|
||||
|
||||
**Text clips at edge**: `buff >= 0.5` for `.to_edge()`
|
||||
|
||||
**Overlapping text**: Use `ReplacementTransform(old, new)`, not `Write(new)` on top.
|
||||
|
||||
**Too crowded**: Max 5-6 elements visible. Split into scenes or use opacity layering.
|
||||
|
||||
**No breathing room**: `self.wait(1.5)` minimum after reveals, `self.wait(2.0)` for key moments.
|
||||
|
||||
**Missing background color**: Set `self.camera.background_color = BG` in every scene.
|
||||
|
||||
## Debugging Strategy
|
||||
|
||||
1. Render a still: `manim -ql -s script.py Scene` -- instant layout check
|
||||
2. Isolate the broken scene -- render only that one
|
||||
3. Replace `self.play()` with `self.add()` to see final state instantly
|
||||
4. Print positions: `print(mob.get_center())`
|
||||
5. Clear cache: delete `media/` directory
|
||||
260
skills/creative/manim-video/references/updaters-and-trackers.md
Normal file
260
skills/creative/manim-video/references/updaters-and-trackers.md
Normal file
@@ -0,0 +1,260 @@
|
||||
# Updaters and Value Trackers
|
||||
|
||||
## The problem updaters solve
|
||||
|
||||
Normal animations are discrete: `self.play()` goes from state A to state B. But what if you need continuous relationships — a label that always hovers above a moving dot, or a line that always connects two points?
|
||||
|
||||
Without updaters, you'd manually reposition every dependent object before every `self.play()`. Five animations that move a dot means five manual repositioning calls for the label. Miss one and it freezes in the wrong spot.
|
||||
|
||||
Updaters let you declare a relationship ONCE. Manim calls the updater function EVERY FRAME (15-60 fps depending on quality) to enforce that relationship, no matter what else is happening.
|
||||
|
||||
## ValueTracker: an invisible steering wheel
|
||||
|
||||
A ValueTracker is an invisible Mobject that holds a single float. It never appears on screen. It exists so you can ANIMATE it while other objects REACT to its value.
|
||||
|
||||
Think of it as a slider: drag the slider from 0 to 5, and every object wired to it responds in real time.
|
||||
|
||||
```python
|
||||
tracker = ValueTracker(0) # invisible, stores 0.0
|
||||
tracker.get_value() # read: 0.0
|
||||
tracker.set_value(5) # write: jump to 5.0 instantly
|
||||
tracker.animate.set_value(5) # animate: smoothly interpolate to 5.0
|
||||
```
|
||||
|
||||
### The three-step pattern
|
||||
|
||||
Every ValueTracker usage follows this:
|
||||
|
||||
1. **Create the tracker** (the invisible slider)
|
||||
2. **Create visible objects that READ the tracker** via updaters
|
||||
3. **Animate the tracker** — all dependents update automatically
|
||||
|
||||
```python
|
||||
# Step 1: Create tracker
|
||||
x_tracker = ValueTracker(1)
|
||||
|
||||
# Step 2: Create dependent objects
|
||||
dot = always_redraw(lambda: Dot(axes.c2p(x_tracker.get_value(), 0), color=YELLOW))
|
||||
v_line = always_redraw(lambda: axes.get_vertical_line(
|
||||
axes.c2p(x_tracker.get_value(), func(x_tracker.get_value())), color=BLUE
|
||||
))
|
||||
label = always_redraw(lambda: DecimalNumber(x_tracker.get_value(), font_size=24)
|
||||
.next_to(dot, UP))
|
||||
|
||||
self.add(dot, v_line, label)
|
||||
|
||||
# Step 3: Animate the tracker — everything follows
|
||||
self.play(x_tracker.animate.set_value(5), run_time=3)
|
||||
```
|
||||
|
||||
## Types of updaters
|
||||
|
||||
### Lambda updater (most common)
|
||||
|
||||
Runs a function every frame, passing the mobject itself:
|
||||
|
||||
```python
|
||||
# Label always stays above the dot
|
||||
label.add_updater(lambda m: m.next_to(dot, UP, buff=0.2))
|
||||
|
||||
# Line always connects two points
|
||||
line.add_updater(lambda m: m.put_start_and_end_on(
|
||||
point_a.get_center(), point_b.get_center()
|
||||
))
|
||||
```
|
||||
|
||||
### Time-based updater (with dt)
|
||||
|
||||
The second argument `dt` is the time since the last frame (~0.017s at 60fps):
|
||||
|
||||
```python
|
||||
# Continuous rotation
|
||||
square.add_updater(lambda m, dt: m.rotate(0.5 * dt))
|
||||
|
||||
# Continuous rightward drift
|
||||
dot.add_updater(lambda m, dt: m.shift(RIGHT * 0.3 * dt))
|
||||
|
||||
# Oscillation
|
||||
dot.add_updater(lambda m, dt: m.move_to(
|
||||
axes.c2p(m.get_center()[0], np.sin(self.time))
|
||||
))
|
||||
```
|
||||
|
||||
Use `dt` updaters for physics simulations, continuous motion, and time-dependent effects.
|
||||
|
||||
### always_redraw: full rebuild every frame
|
||||
|
||||
Creates a new mobject from scratch each frame. More expensive than `add_updater` but handles cases where the mobject's structure changes (not just position/color):
|
||||
|
||||
```python
|
||||
# Brace that follows a resizing square
|
||||
brace = always_redraw(Brace, square, UP)
|
||||
|
||||
# Area under curve that updates as function changes
|
||||
area = always_redraw(lambda: axes.get_area(
|
||||
graph, x_range=[0, x_tracker.get_value()], color=BLUE, opacity=0.3
|
||||
))
|
||||
|
||||
# Label that reconstructs its text
|
||||
counter = always_redraw(lambda: Text(
|
||||
f"n = {int(x_tracker.get_value())}", font_size=24, font="Menlo"
|
||||
).to_corner(UR))
|
||||
```
|
||||
|
||||
**When to use which:**
|
||||
- `add_updater` — position, color, opacity changes (cheap, preferred)
|
||||
- `always_redraw` — when the shape/structure itself changes (expensive, use sparingly)
|
||||
|
||||
## DecimalNumber: showing live values
|
||||
|
||||
```python
|
||||
# Counter that tracks a ValueTracker
|
||||
tracker = ValueTracker(0)
|
||||
number = DecimalNumber(0, font_size=48, num_decimal_places=1, color=PRIMARY)
|
||||
number.add_updater(lambda m: m.set_value(tracker.get_value()))
|
||||
number.add_updater(lambda m: m.next_to(dot, RIGHT, buff=0.3))
|
||||
|
||||
self.add(number)
|
||||
self.play(tracker.animate.set_value(100), run_time=3)
|
||||
```
|
||||
|
||||
### Variable: the labeled version
|
||||
|
||||
```python
|
||||
var = Variable(0, Text("x", font_size=24, font="Menlo"), num_decimal_places=2)
|
||||
self.add(var)
|
||||
self.play(var.tracker.animate.set_value(PI), run_time=2)
|
||||
# Displays: x = 3.14
|
||||
```
|
||||
|
||||
## Removing updaters
|
||||
|
||||
```python
|
||||
# Remove all updaters
|
||||
mobject.clear_updaters()
|
||||
|
||||
# Suspend temporarily (during an animation that would fight the updater)
|
||||
mobject.suspend_updating()
|
||||
self.play(mobject.animate.shift(RIGHT))
|
||||
mobject.resume_updating()
|
||||
|
||||
# Remove specific updater (if you stored a reference)
|
||||
def my_updater(m):
|
||||
m.next_to(dot, UP)
|
||||
label.add_updater(my_updater)
|
||||
# ... later ...
|
||||
label.remove_updater(my_updater)
|
||||
```
|
||||
|
||||
## Animation-based updaters
|
||||
|
||||
### UpdateFromFunc / UpdateFromAlphaFunc
|
||||
|
||||
These are ANIMATIONS (passed to `self.play`), not persistent updaters:
|
||||
|
||||
```python
|
||||
# Call a function on each frame of the animation
|
||||
self.play(UpdateFromFunc(mobject, lambda m: m.next_to(moving_target, UP)), run_time=3)
|
||||
|
||||
# With alpha (0 to 1) — useful for custom interpolation
|
||||
self.play(UpdateFromAlphaFunc(circle, lambda m, a: m.set_fill(opacity=a)), run_time=2)
|
||||
```
|
||||
|
||||
### turn_animation_into_updater
|
||||
|
||||
Convert a one-shot animation into a continuous updater:
|
||||
|
||||
```python
|
||||
from manim import turn_animation_into_updater
|
||||
|
||||
# This would normally play once — now it loops forever
|
||||
turn_animation_into_updater(Rotating(gear, rate=PI/4))
|
||||
self.add(gear)
|
||||
self.wait(5) # gear rotates for 5 seconds
|
||||
```
|
||||
|
||||
## Practical patterns
|
||||
|
||||
### Pattern 1: Dot tracing a function
|
||||
|
||||
```python
|
||||
tracker = ValueTracker(0)
|
||||
graph = axes.plot(np.sin, x_range=[0, 2*PI], color=PRIMARY)
|
||||
dot = always_redraw(lambda: Dot(
|
||||
axes.c2p(tracker.get_value(), np.sin(tracker.get_value())),
|
||||
color=YELLOW
|
||||
))
|
||||
tangent = always_redraw(lambda: axes.get_secant_slope_group(
|
||||
x=tracker.get_value(), graph=graph, dx=0.01,
|
||||
secant_line_color=HIGHLIGHT, secant_line_length=3
|
||||
))
|
||||
|
||||
self.add(graph, dot, tangent)
|
||||
self.play(tracker.animate.set_value(2*PI), run_time=6, rate_func=linear)
|
||||
```
|
||||
|
||||
### Pattern 2: Live area under curve
|
||||
|
||||
```python
|
||||
tracker = ValueTracker(0.5)
|
||||
area = always_redraw(lambda: axes.get_area(
|
||||
graph, x_range=[0, tracker.get_value()],
|
||||
color=PRIMARY, opacity=0.3
|
||||
))
|
||||
area_label = always_redraw(lambda: DecimalNumber(
|
||||
# Numerical integration
|
||||
sum(func(x) * 0.01 for x in np.arange(0, tracker.get_value(), 0.01)),
|
||||
font_size=24
|
||||
).next_to(axes, RIGHT))
|
||||
|
||||
self.add(area, area_label)
|
||||
self.play(tracker.animate.set_value(4), run_time=5)
|
||||
```
|
||||
|
||||
### Pattern 3: Connected diagram
|
||||
|
||||
```python
|
||||
# Nodes that can be moved, with edges that auto-follow
|
||||
node_a = Dot(LEFT * 2, color=PRIMARY)
|
||||
node_b = Dot(RIGHT * 2, color=SECONDARY)
|
||||
edge = Line().add_updater(lambda m: m.put_start_and_end_on(
|
||||
node_a.get_center(), node_b.get_center()
|
||||
))
|
||||
label = Text("edge", font_size=18, font="Menlo").add_updater(
|
||||
lambda m: m.move_to(edge.get_center() + UP * 0.3)
|
||||
)
|
||||
|
||||
self.add(node_a, node_b, edge, label)
|
||||
self.play(node_a.animate.shift(UP * 2), run_time=2)
|
||||
self.play(node_b.animate.shift(DOWN + RIGHT), run_time=2)
|
||||
# Edge and label follow automatically
|
||||
```
|
||||
|
||||
### Pattern 4: Parameter exploration
|
||||
|
||||
```python
|
||||
# Explore how a parameter changes a curve
|
||||
a_tracker = ValueTracker(1)
|
||||
curve = always_redraw(lambda: axes.plot(
|
||||
lambda x: a_tracker.get_value() * np.sin(x),
|
||||
x_range=[0, 2*PI], color=PRIMARY
|
||||
))
|
||||
param_label = always_redraw(lambda: Text(
|
||||
f"a = {a_tracker.get_value():.1f}", font_size=24, font="Menlo"
|
||||
).to_corner(UR))
|
||||
|
||||
self.add(curve, param_label)
|
||||
self.play(a_tracker.animate.set_value(3), run_time=3)
|
||||
self.play(a_tracker.animate.set_value(0.5), run_time=2)
|
||||
self.play(a_tracker.animate.set_value(1), run_time=1)
|
||||
```
|
||||
|
||||
## Common mistakes
|
||||
|
||||
1. **Updater fights animation:** If a mobject has an updater that sets its position, and you try to animate it elsewhere, the updater wins every frame. Suspend updating first.
|
||||
|
||||
2. **always_redraw for simple moves:** If you only need to reposition, use `add_updater`. `always_redraw` reconstructs the entire mobject every frame — expensive and unnecessary for position tracking.
|
||||
|
||||
3. **Forgetting to add to scene:** Updaters only run on mobjects that are in the scene. `always_redraw` creates the mobject but you still need `self.add()`.
|
||||
|
||||
4. **Updater creates new mobjects without cleanup:** If your updater creates Text objects every frame, they accumulate. Use `always_redraw` (which handles cleanup) or update properties in-place.
|
||||
124
skills/creative/manim-video/references/visual-design.md
Normal file
124
skills/creative/manim-video/references/visual-design.md
Normal file
@@ -0,0 +1,124 @@
|
||||
# Visual Design Principles
|
||||
|
||||
## 12 Core Principles
|
||||
|
||||
1. **Geometry Before Algebra** — Show the shape first, the equation second.
|
||||
2. **Opacity Layering** — PRIMARY=1.0, CONTEXT=0.4, GRID=0.15. Direct attention through brightness.
|
||||
3. **One New Idea Per Scene** — Each scene introduces exactly one concept.
|
||||
4. **Spatial Consistency** — Same concept occupies the same screen region throughout.
|
||||
5. **Color = Meaning** — Assign colors to concepts, not mobjects. If velocity is blue, it stays blue.
|
||||
6. **Progressive Disclosure** — Show simplest version first, add complexity incrementally.
|
||||
7. **Transform, Don't Replace** — Use Transform/ReplacementTransform to show connections.
|
||||
8. **Breathing Room** — `self.wait(1.5)` minimum after showing something new.
|
||||
9. **Visual Weight Balance** — Don't cluster everything on one side.
|
||||
10. **Consistent Motion Vocabulary** — Pick a small set of animation types and reuse them.
|
||||
11. **Dark Background, Light Content** — #1C1C1C to #2D2B55 backgrounds maximize contrast.
|
||||
12. **Intentional Empty Space** — Leave at least 15% of the frame empty.
|
||||
|
||||
## Layout Templates
|
||||
|
||||
### FULL_CENTER
|
||||
One main element centered, title above, note below.
|
||||
Best for: single equations, single diagrams, title cards.
|
||||
|
||||
### LEFT_RIGHT
|
||||
Two elements side by side at x=-3.5 and x=3.5.
|
||||
Best for: equation + visual, before/after, comparison.
|
||||
|
||||
### TOP_BOTTOM
|
||||
Main element at y=1.5, supporting content at y=-1.5.
|
||||
Best for: concept + examples, theorem + cases.
|
||||
|
||||
### GRID
|
||||
Multiple elements via `arrange_in_grid()`.
|
||||
Best for: comparison matrices, multi-step processes.
|
||||
|
||||
### PROGRESSIVE
|
||||
Elements appear one at a time, arranged DOWN with aligned_edge=LEFT.
|
||||
Best for: algorithms, proofs, step-by-step processes.
|
||||
|
||||
### ANNOTATED_DIAGRAM
|
||||
Central diagram with floating labels connected by arrows.
|
||||
Best for: architecture diagrams, annotated figures.
|
||||
|
||||
## Color Palettes
|
||||
|
||||
### Classic 3B1B
|
||||
```python
|
||||
BG="#1C1C1C"; PRIMARY=BLUE; SECONDARY=GREEN; ACCENT=YELLOW; HIGHLIGHT=RED
|
||||
```
|
||||
|
||||
### Warm Academic
|
||||
```python
|
||||
BG="#2D2B55"; PRIMARY="#FF6B6B"; SECONDARY="#FFD93D"; ACCENT="#6BCB77"
|
||||
```
|
||||
|
||||
### Neon Tech
|
||||
```python
|
||||
BG="#0A0A0A"; PRIMARY="#00F5FF"; SECONDARY="#FF00FF"; ACCENT="#39FF14"
|
||||
```
|
||||
|
||||
## Font Selection
|
||||
|
||||
**Use monospace fonts for all text.** Manim's Pango text renderer produces broken kerning with proportional fonts (Helvetica, Inter, SF Pro, Arial) at all sizes and resolutions. Characters overlap and spacing is inconsistent. This is a fundamental Pango limitation, not a Manim bug.
|
||||
|
||||
Monospace fonts have fixed character widths — zero kerning issues by design.
|
||||
|
||||
### Recommended Fonts
|
||||
|
||||
| Use case | Font | Fallback |
|
||||
|----------|------|----------|
|
||||
| **All text (default)** | `"Menlo"` | `"Courier New"`, `"DejaVu Sans Mono"` |
|
||||
| Code, labels | `"JetBrains Mono"`, `"SF Mono"` | `"Menlo"` |
|
||||
| Math | Use `MathTex` (renders via LaTeX, not Pango) | — |
|
||||
|
||||
```python
|
||||
MONO = "Menlo" # define once at top of file
|
||||
|
||||
title = Text("Fourier Series", font_size=48, color=PRIMARY, weight=BOLD, font=MONO)
|
||||
label = Text("n=1: (4/pi) sin(x)", font_size=20, color=BLUE, font=MONO)
|
||||
note = Text("Convergence at discontinuities", font_size=18, color=DIM, font=MONO)
|
||||
|
||||
# Math — always use MathTex, not Text
|
||||
equation = MathTex(r"\nabla L = \frac{\partial L}{\partial w}")
|
||||
```
|
||||
|
||||
### When Proportional Fonts Are Acceptable
|
||||
|
||||
Large title text (font_size >= 48) with short strings (1-3 words) can use proportional fonts without visible kerning issues. For anything else — labels, descriptions, multi-word text, small sizes — use monospace.
|
||||
|
||||
### Font Availability
|
||||
|
||||
- **macOS**: Menlo (pre-installed), SF Mono
|
||||
- **Linux**: DejaVu Sans Mono (pre-installed), Liberation Mono
|
||||
- **Cross-platform**: JetBrains Mono (install from jetbrains.com)
|
||||
|
||||
`"Menlo"` is the safest default — pre-installed on macOS, and Linux systems fall back to DejaVu Sans Mono.
|
||||
|
||||
### Fine-Grained Text Control
|
||||
|
||||
`Text()` does not support `letter_spacing` or kerning parameters. For fine control, use `MarkupText` with Pango attributes:
|
||||
|
||||
```python
|
||||
# Letter spacing (Pango units: 1/1024 of a point)
|
||||
MarkupText('<span letter_spacing="6000">HERMES</span>', font_size=18, font="Menlo")
|
||||
|
||||
# Bold specific words
|
||||
MarkupText('This is <b>important</b>', font_size=24, font="Menlo")
|
||||
|
||||
# Color specific words
|
||||
MarkupText('Red <span foreground="#FF6B6B">warning</span>', font_size=24, font="Menlo")
|
||||
```
|
||||
|
||||
### Minimum Font Size
|
||||
|
||||
`font_size=18` is the minimum for readable text at any resolution. Below 18, characters become blurry at `-ql` and barely readable even at `-qh`.
|
||||
|
||||
## Visual Hierarchy Checklist
|
||||
|
||||
For every frame:
|
||||
1. What is the ONE thing to look at? (brightest/largest)
|
||||
2. What is context? (dimmed to 0.3-0.4)
|
||||
3. What is structural? (dimmed to 0.15)
|
||||
4. Enough empty space? (>15%)
|
||||
5. All text readable at phone size?
|
||||
14
skills/creative/manim-video/scripts/setup.sh
Executable file
14
skills/creative/manim-video/scripts/setup.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
G="\033[0;32m"; R="\033[0;31m"; N="\033[0m"
|
||||
ok() { echo -e " ${G}+${N} $1"; }
|
||||
fail() { echo -e " ${R}x${N} $1"; }
|
||||
echo ""; echo "Manim Video Skill — Setup Check"; echo ""
|
||||
errors=0
|
||||
command -v python3 &>/dev/null && ok "Python $(python3 --version 2>&1 | awk '{print $2}')" || { fail "Python 3 not found"; errors=$((errors+1)); }
|
||||
python3 -c "import manim" 2>/dev/null && ok "Manim $(manim --version 2>&1 | head -1)" || { fail "Manim not installed: pip install manim"; errors=$((errors+1)); }
|
||||
command -v pdflatex &>/dev/null && ok "LaTeX (pdflatex)" || { fail "LaTeX not found (macOS: brew install --cask mactex-no-gui)"; errors=$((errors+1)); }
|
||||
command -v ffmpeg &>/dev/null && ok "ffmpeg" || { fail "ffmpeg not found"; errors=$((errors+1)); }
|
||||
echo ""
|
||||
[ $errors -eq 0 ] && echo -e "${G}All prerequisites satisfied.${N}" || echo -e "${R}$errors prerequisite(s) missing.${N}"
|
||||
echo ""
|
||||
64
skills/creative/p5js/README.md
Normal file
64
skills/creative/p5js/README.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# p5.js Skill
|
||||
|
||||
Production pipeline for interactive and generative visual art using [p5.js](https://p5js.org/).
|
||||
|
||||
## What it does
|
||||
|
||||
Creates browser-based visual art from text prompts. The agent handles the full pipeline: creative concept, code generation, preview, export, and iterative refinement. Output is a single self-contained HTML file that runs in any browser — no build step, no server, no dependencies beyond a CDN script tag.
|
||||
|
||||
The output is real interactive art. Not tutorial exercises. Generative systems, particle physics, noise fields, shader effects, kinetic typography — composed with intentional color palettes, layered composition, and visual hierarchy.
|
||||
|
||||
## Modes
|
||||
|
||||
| Mode | Input | Output |
|
||||
|------|-------|--------|
|
||||
| **Generative art** | Seed / parameters | Procedural visual composition |
|
||||
| **Data visualization** | Dataset / API | Interactive charts, custom data displays |
|
||||
| **Interactive experience** | None (user drives) | Mouse/keyboard/touch-driven sketch |
|
||||
| **Animation / motion graphics** | Timeline / storyboard | Timed sequences, kinetic typography |
|
||||
| **3D scene** | Concept description | WebGL geometry, lighting, shaders |
|
||||
| **Image processing** | Image file(s) | Pixel manipulation, filters, pointillism |
|
||||
| **Audio-reactive** | Audio file / mic | Sound-driven generative visuals |
|
||||
|
||||
## Export Formats
|
||||
|
||||
| Format | Method |
|
||||
|--------|--------|
|
||||
| **HTML** | Self-contained file, opens in any browser |
|
||||
| **PNG** | `saveCanvas()` — press 's' to capture |
|
||||
| **GIF** | `saveGif()` — press 'g' to capture |
|
||||
| **MP4** | Frame sequence + ffmpeg via `scripts/render.sh` |
|
||||
| **SVG** | p5.js-svg renderer for vector output |
|
||||
|
||||
## Prerequisites
|
||||
|
||||
A modern browser. That's it for basic use.
|
||||
|
||||
For headless export: Node.js, Puppeteer, ffmpeg.
|
||||
|
||||
```bash
|
||||
bash skills/creative/p5js/scripts/setup.sh
|
||||
```
|
||||
|
||||
## File Structure
|
||||
|
||||
```
|
||||
├── SKILL.md # Modes, workflow, creative direction, critical notes
|
||||
├── README.md # This file
|
||||
├── references/
|
||||
│ ├── core-api.md # Canvas, draw loop, transforms, offscreen buffers, math
|
||||
│ ├── shapes-and-geometry.md # Primitives, vertices, curves, vectors, SDFs, clipping
|
||||
│ ├── visual-effects.md # Noise, flow fields, particles, pixels, textures, feedback
|
||||
│ ├── animation.md # Easing, springs, state machines, timelines, transitions
|
||||
│ ├── typography.md # Fonts, textToPoints, kinetic text, text masks
|
||||
│ ├── color-systems.md # HSB/RGB, palettes, gradients, blend modes, curated colors
|
||||
│ ├── webgl-and-3d.md # 3D primitives, camera, lighting, shaders, framebuffers
|
||||
│ ├── interaction.md # Mouse, keyboard, touch, DOM, audio, scroll
|
||||
│ ├── export-pipeline.md # PNG, GIF, MP4, SVG, headless, tiling, batch export
|
||||
│ └── troubleshooting.md # Performance, common mistakes, browser issues, debugging
|
||||
└── scripts/
|
||||
├── setup.sh # Dependency verification
|
||||
├── serve.sh # Local dev server (for loading local assets)
|
||||
├── render.sh # Headless render pipeline (HTML → frames → MP4)
|
||||
└── export-frames.js # Puppeteer frame capture (Node.js)
|
||||
```
|
||||
547
skills/creative/p5js/SKILL.md
Normal file
547
skills/creative/p5js/SKILL.md
Normal file
@@ -0,0 +1,547 @@
|
||||
---
|
||||
name: p5js
|
||||
description: "Production pipeline for interactive and generative visual art using p5.js. Creates browser-based sketches, generative art, data visualizations, interactive experiences, 3D scenes, audio-reactive visuals, and motion graphics — exported as HTML, PNG, GIF, MP4, or SVG. Covers: 2D/3D rendering, noise and particle systems, flow fields, shaders (GLSL), pixel manipulation, kinetic typography, WebGL scenes, audio analysis, mouse/keyboard interaction, and headless high-res export. Use when users request: p5.js sketches, creative coding, generative art, interactive visualizations, canvas animations, browser-based visual art, data viz, shader effects, or any p5.js project."
|
||||
version: 1.0.0
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [creative-coding, generative-art, p5js, canvas, interactive, visualization, webgl, shaders, animation]
|
||||
related_skills: [ascii-video, manim-video, excalidraw]
|
||||
---
|
||||
|
||||
# p5.js Production Pipeline
|
||||
|
||||
## Creative Standard
|
||||
|
||||
This is visual art rendered in the browser. The canvas is the medium; the algorithm is the brush.
|
||||
|
||||
**Before writing a single line of code**, articulate the creative concept. What does this piece communicate? What makes the viewer stop scrolling? What separates this from a code tutorial example? The user's prompt is a starting point — interpret it with creative ambition.
|
||||
|
||||
**First-render excellence is non-negotiable.** The output must be visually striking on first load. If it looks like a p5.js tutorial exercise, a default configuration, or "AI-generated creative coding," it is wrong. Rethink before shipping.
|
||||
|
||||
**Go beyond the reference vocabulary.** The noise functions, particle systems, color palettes, and shader effects in the references are a starting vocabulary. For every project, combine, layer, and invent. The catalog is a palette of paints — you write the painting.
|
||||
|
||||
**Be proactively creative.** If the user asks for "a particle system," deliver a particle system with emergent flocking behavior, trailing ghost echoes, palette-shifted depth fog, and a background noise field that breathes. Include at least one visual detail the user didn't ask for but will appreciate.
|
||||
|
||||
**Dense, layered, considered.** Every frame should reward viewing. Never flat white backgrounds. Always compositional hierarchy. Always intentional color. Always micro-detail that only appears on close inspection.
|
||||
|
||||
**Cohesive aesthetic over feature count.** All elements must serve a unified visual language — shared color temperature, consistent stroke weight vocabulary, harmonious motion speeds. A sketch with ten unrelated effects is worse than one with three that belong together.
|
||||
|
||||
## Modes
|
||||
|
||||
| Mode | Input | Output | Reference |
|
||||
|------|-------|--------|-----------|
|
||||
| **Generative art** | Seed / parameters | Procedural visual composition (still or animated) | `references/visual-effects.md` |
|
||||
| **Data visualization** | Dataset / API | Interactive charts, graphs, custom data displays | `references/interaction.md` |
|
||||
| **Interactive experience** | None (user drives) | Mouse/keyboard/touch-driven sketch | `references/interaction.md` |
|
||||
| **Animation / motion graphics** | Timeline / storyboard | Timed sequences, kinetic typography, transitions | `references/animation.md` |
|
||||
| **3D scene** | Concept description | WebGL geometry, lighting, camera, materials | `references/webgl-and-3d.md` |
|
||||
| **Image processing** | Image file(s) | Pixel manipulation, filters, mosaic, pointillism | `references/visual-effects.md` § Pixel Manipulation |
|
||||
| **Audio-reactive** | Audio file / mic | Sound-driven generative visuals | `references/interaction.md` § Audio Input |
|
||||
|
||||
## Stack
|
||||
|
||||
Single self-contained HTML file per project. No build step required.
|
||||
|
||||
| Layer | Tool | Purpose |
|
||||
|-------|------|---------|
|
||||
| Core | p5.js 1.11.3 (CDN) | Canvas rendering, math, transforms, event handling |
|
||||
| 3D | p5.js WebGL mode | 3D geometry, camera, lighting, GLSL shaders |
|
||||
| Audio | p5.sound.js (CDN) | FFT analysis, amplitude, mic input, oscillators |
|
||||
| Export | Built-in `saveCanvas()` / `saveGif()` / `saveFrames()` | PNG, GIF, frame sequence output |
|
||||
| Capture | CCapture.js (optional) | Deterministic framerate video capture (WebM, GIF) |
|
||||
| Headless | Puppeteer + Node.js (optional) | Automated high-res rendering, MP4 via ffmpeg |
|
||||
| SVG | p5.js-svg 1.6.0 (optional) | Vector output for print — requires p5.js 1.x |
|
||||
| Natural media | p5.brush (optional) | Watercolor, charcoal, pen — requires p5.js 2.x + WEBGL |
|
||||
| Texture | p5.grain (optional) | Film grain, texture overlays |
|
||||
| Fonts | Google Fonts / `loadFont()` | Custom typography via OTF/TTF/WOFF2 |
|
||||
|
||||
### Version Note
|
||||
|
||||
**p5.js 1.x** (1.11.3) is the default — stable, well-documented, broadest library compatibility. Use this unless a project requires 2.x features.
|
||||
|
||||
**p5.js 2.x** (2.2+) adds: `async setup()` replacing `preload()`, OKLCH/OKLAB color modes, `splineVertex()`, shader `.modify()` API, variable fonts, `textToContours()`, pointer events. Required for p5.brush. See `references/core-api.md` § p5.js 2.0.
|
||||
|
||||
## Pipeline
|
||||
|
||||
Every project follows the same 6-stage path:
|
||||
|
||||
```
|
||||
CONCEPT → DESIGN → CODE → PREVIEW → EXPORT → VERIFY
|
||||
```
|
||||
|
||||
1. **CONCEPT** — Articulate the creative vision: mood, color world, motion vocabulary, what makes this unique
|
||||
2. **DESIGN** — Choose mode, canvas size, interaction model, color system, export format. Map concept to technical decisions
|
||||
3. **CODE** — Write single HTML file with inline p5.js. Structure: globals → `preload()` → `setup()` → `draw()` → helpers → classes → event handlers
|
||||
4. **PREVIEW** — Open in browser, verify visual quality. Test at target resolution. Check performance
|
||||
5. **EXPORT** — Capture output: `saveCanvas()` for PNG, `saveGif()` for GIF, `saveFrames()` + ffmpeg for MP4, Puppeteer for headless batch
|
||||
6. **VERIFY** — Does the output match the concept? Is it visually striking at the intended display size? Would you frame it?
|
||||
|
||||
## Creative Direction
|
||||
|
||||
### Aesthetic Dimensions
|
||||
|
||||
| Dimension | Options | Reference |
|
||||
|-----------|---------|-----------|
|
||||
| **Color system** | HSB/HSL, RGB, named palettes, procedural harmony, gradient interpolation | `references/color-systems.md` |
|
||||
| **Noise vocabulary** | Perlin noise, simplex, fractal (octaved), domain warping, curl noise | `references/visual-effects.md` § Noise |
|
||||
| **Particle systems** | Physics-based, flocking, trail-drawing, attractor-driven, flow-field following | `references/visual-effects.md` § Particles |
|
||||
| **Shape language** | Geometric primitives, custom vertices, bezier curves, SVG paths | `references/shapes-and-geometry.md` |
|
||||
| **Motion style** | Eased, spring-based, noise-driven, physics sim, lerped, stepped | `references/animation.md` |
|
||||
| **Typography** | System fonts, loaded OTF, `textToPoints()` particle text, kinetic | `references/typography.md` |
|
||||
| **Shader effects** | GLSL fragment/vertex, filter shaders, post-processing, feedback loops | `references/webgl-and-3d.md` § Shaders |
|
||||
| **Composition** | Grid, radial, golden ratio, rule of thirds, organic scatter, tiled | `references/core-api.md` § Composition |
|
||||
| **Interaction model** | Mouse follow, click spawn, drag, keyboard state, scroll-driven, mic input | `references/interaction.md` |
|
||||
| **Blend modes** | `BLEND`, `ADD`, `MULTIPLY`, `SCREEN`, `DIFFERENCE`, `EXCLUSION`, `OVERLAY` | `references/color-systems.md` § Blend Modes |
|
||||
| **Layering** | `createGraphics()` offscreen buffers, alpha compositing, masking | `references/core-api.md` § Offscreen Buffers |
|
||||
| **Texture** | Perlin surface, stippling, hatching, halftone, pixel sorting | `references/visual-effects.md` § Texture Generation |
|
||||
|
||||
### Per-Project Variation Rules
|
||||
|
||||
Never use default configurations. For every project:
|
||||
- **Custom color palette** — never raw `fill(255, 0, 0)`. Always a designed palette with 3-7 colors
|
||||
- **Custom stroke weight vocabulary** — thin accents (0.5), medium structure (1-2), bold emphasis (3-5)
|
||||
- **Background treatment** — never plain `background(0)` or `background(255)`. Always textured, gradient, or layered
|
||||
- **Motion variety** — different speeds for different elements. Primary at 1x, secondary at 0.3x, ambient at 0.1x
|
||||
- **At least one invented element** — a custom particle behavior, a novel noise application, a unique interaction response
|
||||
|
||||
### Project-Specific Invention
|
||||
|
||||
For every project, invent at least one of:
|
||||
- A custom color palette matching the mood (not a preset)
|
||||
- A novel noise field combination (e.g., curl noise + domain warp + feedback)
|
||||
- A unique particle behavior (custom forces, custom trails, custom spawning)
|
||||
- An interaction mechanic the user didn't request but that elevates the piece
|
||||
- A compositional technique that creates visual hierarchy
|
||||
|
||||
### Parameter Design Philosophy
|
||||
|
||||
Parameters should emerge from the algorithm, not from a generic menu. Ask: "What properties of *this* system should be tunable?"
|
||||
|
||||
**Good parameters** expose the algorithm's character:
|
||||
- **Quantities** — how many particles, branches, cells (controls density)
|
||||
- **Scales** — noise frequency, element size, spacing (controls texture)
|
||||
- **Rates** — speed, growth rate, decay (controls energy)
|
||||
- **Thresholds** — when does behavior change? (controls drama)
|
||||
- **Ratios** — proportions, balance between forces (controls harmony)
|
||||
|
||||
**Bad parameters** are generic controls unrelated to the algorithm:
|
||||
- "color1", "color2", "size" — meaningless without context
|
||||
- Toggle switches for unrelated effects
|
||||
- Parameters that only change cosmetics, not behavior
|
||||
|
||||
Every parameter should change how the algorithm *thinks*, not just how it *looks*. A "turbulence" parameter that changes noise octaves is good. A "particle size" slider that only changes `ellipse()` radius is shallow.
|
||||
|
||||
## Workflow
|
||||
|
||||
### Step 1: Creative Vision
|
||||
|
||||
Before any code, articulate:
|
||||
|
||||
- **Mood / atmosphere**: What should the viewer feel? Contemplative? Energized? Unsettled? Playful?
|
||||
- **Visual story**: What happens over time (or on interaction)? Build? Decay? Transform? Oscillate?
|
||||
- **Color world**: Warm/cool? Monochrome? Complementary? What's the dominant hue? The accent?
|
||||
- **Shape language**: Organic curves? Sharp geometry? Dots? Lines? Mixed?
|
||||
- **Motion vocabulary**: Slow drift? Explosive burst? Breathing pulse? Mechanical precision?
|
||||
- **What makes THIS different**: What is the one thing that makes this sketch unique?
|
||||
|
||||
Map the user's prompt to aesthetic choices. "Relaxing generative background" demands different everything from "glitch data visualization."
|
||||
|
||||
### Step 2: Technical Design
|
||||
|
||||
- **Mode** — which of the 7 modes from the table above
|
||||
- **Canvas size** — landscape 1920x1080, portrait 1080x1920, square 1080x1080, or responsive `windowWidth/windowHeight`
|
||||
- **Renderer** — `P2D` (default) or `WEBGL` (for 3D, shaders, advanced blend modes)
|
||||
- **Frame rate** — 60fps (interactive), 30fps (ambient animation), or `noLoop()` (static generative)
|
||||
- **Export target** — browser display, PNG still, GIF loop, MP4 video, SVG vector
|
||||
- **Interaction model** — passive (no input), mouse-driven, keyboard-driven, audio-reactive, scroll-driven
|
||||
- **Viewer UI** — for interactive generative art, start from `templates/viewer.html` which provides seed navigation, parameter sliders, and download. For simple sketches or video export, use bare HTML
|
||||
|
||||
### Step 3: Code the Sketch
|
||||
|
||||
For **interactive generative art** (seed exploration, parameter tuning): start from `templates/viewer.html`. Read the template first, keep the fixed sections (seed nav, actions), replace the algorithm and parameter controls. This gives the user seed prev/next/random/jump, parameter sliders with live update, and PNG download — all wired up.
|
||||
|
||||
For **animations, video export, or simple sketches**: use bare HTML:
|
||||
|
||||
Single HTML file. Structure:
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Project Name</title>
|
||||
<script>p5.disableFriendlyErrors = true;</script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.3/p5.min.js"></script>
|
||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.3/addons/p5.sound.min.js"></script> -->
|
||||
<!-- <script src="https://unpkg.com/p5.js-svg@1.6.0"></script> --> <!-- SVG export -->
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/ccapture.js-npmfixed/build/CCapture.all.min.js"></script> --> <!-- video capture -->
|
||||
<style>
|
||||
html, body { margin: 0; padding: 0; overflow: hidden; }
|
||||
canvas { display: block; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
// === Configuration ===
|
||||
const CONFIG = {
|
||||
seed: 42,
|
||||
// ... project-specific params
|
||||
};
|
||||
|
||||
// === Color Palette ===
|
||||
const PALETTE = {
|
||||
bg: '#0a0a0f',
|
||||
primary: '#e8d5b7',
|
||||
// ...
|
||||
};
|
||||
|
||||
// === Global State ===
|
||||
let particles = [];
|
||||
|
||||
// === Preload (fonts, images, data) ===
|
||||
function preload() {
|
||||
// font = loadFont('...');
|
||||
}
|
||||
|
||||
// === Setup ===
|
||||
function setup() {
|
||||
createCanvas(1920, 1080);
|
||||
randomSeed(CONFIG.seed);
|
||||
noiseSeed(CONFIG.seed);
|
||||
colorMode(HSB, 360, 100, 100, 100);
|
||||
// Initialize state...
|
||||
}
|
||||
|
||||
// === Draw Loop ===
|
||||
function draw() {
|
||||
// Render frame...
|
||||
}
|
||||
|
||||
// === Helper Functions ===
|
||||
// ...
|
||||
|
||||
// === Classes ===
|
||||
class Particle {
|
||||
// ...
|
||||
}
|
||||
|
||||
// === Event Handlers ===
|
||||
function mousePressed() { /* ... */ }
|
||||
function keyPressed() { /* ... */ }
|
||||
function windowResized() { resizeCanvas(windowWidth, windowHeight); }
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
Key implementation patterns:
|
||||
- **Seeded randomness**: Always `randomSeed()` + `noiseSeed()` for reproducibility
|
||||
- **Color mode**: Use `colorMode(HSB, 360, 100, 100, 100)` for intuitive color control
|
||||
- **State separation**: CONFIG for parameters, PALETTE for colors, globals for mutable state
|
||||
- **Class-based entities**: Particles, agents, shapes as classes with `update()` + `display()` methods
|
||||
- **Offscreen buffers**: `createGraphics()` for layered composition, trails, masks
|
||||
|
||||
### Step 4: Preview & Iterate
|
||||
|
||||
- Open HTML file directly in browser — no server needed for basic sketches
|
||||
- For `loadImage()`/`loadFont()` from local files: use `scripts/serve.sh` or `python3 -m http.server`
|
||||
- Chrome DevTools Performance tab to verify 60fps
|
||||
- Test at target export resolution, not just the window size
|
||||
- Adjust parameters until the visual matches the concept from Step 1
|
||||
|
||||
### Step 5: Export
|
||||
|
||||
| Format | Method | Command |
|
||||
|--------|--------|---------|
|
||||
| **PNG** | `saveCanvas('output', 'png')` in `keyPressed()` | Press 's' to save |
|
||||
| **High-res PNG** | Puppeteer headless capture | `node scripts/export-frames.js sketch.html --width 3840 --height 2160 --frames 1` |
|
||||
| **GIF** | `saveGif('output', 5)` — captures N seconds | Press 'g' to save |
|
||||
| **Frame sequence** | `saveFrames('frame', 'png', 10, 30)` — 10s at 30fps | Then `ffmpeg -i frame-%04d.png -c:v libx264 output.mp4` |
|
||||
| **MP4** | Puppeteer frame capture + ffmpeg | `bash scripts/render.sh sketch.html output.mp4 --duration 30 --fps 30` |
|
||||
| **SVG** | `createCanvas(w, h, SVG)` with p5.js-svg | `save('output.svg')` |
|
||||
|
||||
### Step 6: Quality Verification
|
||||
|
||||
- **Does it match the vision?** Compare output to the creative concept. If it looks generic, go back to Step 1
|
||||
- **Resolution check**: Is it sharp at the target display size? No aliasing artifacts?
|
||||
- **Performance check**: Does it hold 60fps in browser? (30fps minimum for animations)
|
||||
- **Color check**: Do the colors work together? Test on both light and dark monitors
|
||||
- **Edge cases**: What happens at canvas edges? On resize? After running for 10 minutes?
|
||||
|
||||
## Critical Implementation Notes
|
||||
|
||||
### Performance — Disable FES First
|
||||
|
||||
The Friendly Error System (FES) adds up to 10x overhead. Disable it in every production sketch:
|
||||
|
||||
```javascript
|
||||
p5.disableFriendlyErrors = true; // BEFORE setup()
|
||||
|
||||
function setup() {
|
||||
pixelDensity(1); // prevent 2x-4x overdraw on retina
|
||||
createCanvas(1920, 1080);
|
||||
}
|
||||
```
|
||||
|
||||
In hot loops (particles, pixel ops), use `Math.*` instead of p5 wrappers — measurably faster:
|
||||
|
||||
```javascript
|
||||
// In draw() or update() hot paths:
|
||||
let a = Math.sin(t); // not sin(t)
|
||||
let r = Math.sqrt(dx*dx+dy*dy); // not dist() — or better: skip sqrt, compare magSq
|
||||
let v = Math.random(); // not random() — when seed not needed
|
||||
let m = Math.min(a, b); // not min(a, b)
|
||||
```
|
||||
|
||||
Never `console.log()` inside `draw()`. Never manipulate DOM in `draw()`. See `references/troubleshooting.md` § Performance.
|
||||
|
||||
### Seeded Randomness — Always
|
||||
|
||||
Every generative sketch must be reproducible. Same seed, same output.
|
||||
|
||||
```javascript
|
||||
function setup() {
|
||||
randomSeed(CONFIG.seed);
|
||||
noiseSeed(CONFIG.seed);
|
||||
// All random() and noise() calls now deterministic
|
||||
}
|
||||
```
|
||||
|
||||
Never use `Math.random()` for generative content — only for performance-critical non-visual code. Always `random()` for visual elements. If you need a random seed: `CONFIG.seed = floor(random(99999))`.
|
||||
|
||||
### Generative Art Platform Support (fxhash / Art Blocks)
|
||||
|
||||
For generative art platforms, replace p5's PRNG with the platform's deterministic random:
|
||||
|
||||
```javascript
|
||||
// fxhash convention
|
||||
const SEED = $fx.hash; // unique per mint
|
||||
const rng = $fx.rand; // deterministic PRNG
|
||||
$fx.features({ palette: 'warm', complexity: 'high' });
|
||||
|
||||
// In setup():
|
||||
randomSeed(SEED); // for p5's noise()
|
||||
noiseSeed(SEED);
|
||||
|
||||
// Replace random() with rng() for platform determinism
|
||||
let x = rng() * width; // instead of random(width)
|
||||
```
|
||||
|
||||
See `references/export-pipeline.md` § Platform Export.
|
||||
|
||||
### Color Mode — Use HSB
|
||||
|
||||
HSB (Hue, Saturation, Brightness) is dramatically easier to work with than RGB for generative art:
|
||||
|
||||
```javascript
|
||||
colorMode(HSB, 360, 100, 100, 100);
|
||||
// Now: fill(hue, sat, bri, alpha)
|
||||
// Rotate hue: fill((baseHue + offset) % 360, 80, 90)
|
||||
// Desaturate: fill(hue, sat * 0.3, bri)
|
||||
// Darken: fill(hue, sat, bri * 0.5)
|
||||
```
|
||||
|
||||
Never hardcode raw RGB values. Define a palette object, derive variations procedurally. See `references/color-systems.md`.
|
||||
|
||||
### Noise — Multi-Octave, Not Raw
|
||||
|
||||
Raw `noise(x, y)` looks like smooth blobs. Layer octaves for natural texture:
|
||||
|
||||
```javascript
|
||||
function fbm(x, y, octaves = 4) {
|
||||
let val = 0, amp = 1, freq = 1, sum = 0;
|
||||
for (let i = 0; i < octaves; i++) {
|
||||
val += noise(x * freq, y * freq) * amp;
|
||||
sum += amp;
|
||||
amp *= 0.5;
|
||||
freq *= 2;
|
||||
}
|
||||
return val / sum;
|
||||
}
|
||||
```
|
||||
|
||||
For flowing organic forms, use **domain warping**: feed noise output back as noise input coordinates. See `references/visual-effects.md`.
|
||||
|
||||
### createGraphics() for Layers — Not Optional
|
||||
|
||||
Flat single-pass rendering looks flat. Use offscreen buffers for composition:
|
||||
|
||||
```javascript
|
||||
let bgLayer, fgLayer, trailLayer;
|
||||
function setup() {
|
||||
createCanvas(1920, 1080);
|
||||
bgLayer = createGraphics(width, height);
|
||||
fgLayer = createGraphics(width, height);
|
||||
trailLayer = createGraphics(width, height);
|
||||
}
|
||||
function draw() {
|
||||
renderBackground(bgLayer);
|
||||
renderTrails(trailLayer); // persistent, fading
|
||||
renderForeground(fgLayer); // cleared each frame
|
||||
image(bgLayer, 0, 0);
|
||||
image(trailLayer, 0, 0);
|
||||
image(fgLayer, 0, 0);
|
||||
}
|
||||
```
|
||||
|
||||
### Performance — Vectorize Where Possible
|
||||
|
||||
p5.js draw calls are expensive. For thousands of particles:
|
||||
|
||||
```javascript
|
||||
// SLOW: individual shapes
|
||||
for (let p of particles) {
|
||||
ellipse(p.x, p.y, p.size);
|
||||
}
|
||||
|
||||
// FAST: single shape with beginShape()
|
||||
beginShape(POINTS);
|
||||
for (let p of particles) {
|
||||
vertex(p.x, p.y);
|
||||
}
|
||||
endShape();
|
||||
|
||||
// FASTEST: pixel buffer for massive counts
|
||||
loadPixels();
|
||||
for (let p of particles) {
|
||||
let idx = 4 * (floor(p.y) * width + floor(p.x));
|
||||
pixels[idx] = r; pixels[idx+1] = g; pixels[idx+2] = b; pixels[idx+3] = 255;
|
||||
}
|
||||
updatePixels();
|
||||
```
|
||||
|
||||
See `references/troubleshooting.md` § Performance.
|
||||
|
||||
### Instance Mode for Multiple Sketches
|
||||
|
||||
Global mode pollutes `window`. For production, use instance mode:
|
||||
|
||||
```javascript
|
||||
const sketch = (p) => {
|
||||
p.setup = function() {
|
||||
p.createCanvas(800, 800);
|
||||
};
|
||||
p.draw = function() {
|
||||
p.background(0);
|
||||
p.ellipse(p.mouseX, p.mouseY, 50);
|
||||
};
|
||||
};
|
||||
new p5(sketch, 'canvas-container');
|
||||
```
|
||||
|
||||
Required when embedding multiple sketches on one page or integrating with frameworks.
|
||||
|
||||
### WebGL Mode Gotchas
|
||||
|
||||
- `createCanvas(w, h, WEBGL)` — origin is center, not top-left
|
||||
- Y-axis is inverted (positive Y goes up in WEBGL, down in P2D)
|
||||
- `translate(-width/2, -height/2)` to get P2D-like coordinates
|
||||
- `push()`/`pop()` around every transform — matrix stack overflows silently
|
||||
- `texture()` before `rect()`/`plane()` — not after
|
||||
- Custom shaders: `createShader(vert, frag)` — test on multiple browsers
|
||||
|
||||
### Export — Key Bindings Convention
|
||||
|
||||
Every sketch should include these in `keyPressed()`:
|
||||
|
||||
```javascript
|
||||
function keyPressed() {
|
||||
if (key === 's' || key === 'S') saveCanvas('output', 'png');
|
||||
if (key === 'g' || key === 'G') saveGif('output', 5);
|
||||
if (key === 'r' || key === 'R') { randomSeed(millis()); noiseSeed(millis()); }
|
||||
if (key === ' ') CONFIG.paused = !CONFIG.paused;
|
||||
}
|
||||
```
|
||||
|
||||
### Headless Video Export — Use noLoop()
|
||||
|
||||
For headless rendering via Puppeteer, the sketch **must** use `noLoop()` in setup. Without it, p5's draw loop runs freely while screenshots are slow — the sketch races ahead and you get skipped/duplicate frames.
|
||||
|
||||
```javascript
|
||||
function setup() {
|
||||
createCanvas(1920, 1080);
|
||||
pixelDensity(1);
|
||||
noLoop(); // capture script controls frame advance
|
||||
window._p5Ready = true; // signal readiness to capture script
|
||||
}
|
||||
```
|
||||
|
||||
The bundled `scripts/export-frames.js` detects `_p5Ready` and calls `redraw()` once per capture for exact 1:1 frame correspondence. See `references/export-pipeline.md` § Deterministic Capture.
|
||||
|
||||
For multi-scene videos, use the per-clip architecture: one HTML per scene, render independently, stitch with `ffmpeg -f concat`. See `references/export-pipeline.md` § Per-Clip Architecture.
|
||||
|
||||
### Agent Workflow
|
||||
|
||||
When building p5.js sketches:
|
||||
|
||||
1. **Write the HTML file** — single self-contained file, all code inline
|
||||
2. **Open in browser** — `open sketch.html` (macOS) or `xdg-open sketch.html` (Linux)
|
||||
3. **Local assets** (fonts, images) require a server: `python3 -m http.server 8080` in the project directory, then open `http://localhost:8080/sketch.html`
|
||||
4. **Export PNG/GIF** — add `keyPressed()` shortcuts as shown above, tell the user which key to press
|
||||
5. **Headless export** — `node scripts/export-frames.js sketch.html --frames 300` for automated frame capture (sketch must use `noLoop()` + `_p5Ready`)
|
||||
6. **MP4 rendering** — `bash scripts/render.sh sketch.html output.mp4 --duration 30`
|
||||
7. **Iterative refinement** — edit the HTML file, user refreshes browser to see changes
|
||||
8. **Load references on demand** — use `skill_view(name="p5js", file_path="references/...")` to load specific reference files as needed during implementation
|
||||
|
||||
## Performance Targets
|
||||
|
||||
| Metric | Target |
|
||||
|--------|--------|
|
||||
| Frame rate (interactive) | 60fps sustained |
|
||||
| Frame rate (animated export) | 30fps minimum |
|
||||
| Particle count (P2D shapes) | 5,000-10,000 at 60fps |
|
||||
| Particle count (pixel buffer) | 50,000-100,000 at 60fps |
|
||||
| Canvas resolution | Up to 3840x2160 (export), 1920x1080 (interactive) |
|
||||
| File size (HTML) | < 100KB (excluding CDN libraries) |
|
||||
| Load time | < 2s to first frame |
|
||||
|
||||
## References
|
||||
|
||||
| File | Contents |
|
||||
|------|----------|
|
||||
| `references/core-api.md` | Canvas setup, coordinate system, draw loop, `push()`/`pop()`, offscreen buffers, composition patterns, `pixelDensity()`, responsive design |
|
||||
| `references/shapes-and-geometry.md` | 2D primitives, `beginShape()`/`endShape()`, Bezier/Catmull-Rom curves, `vertex()` systems, custom shapes, `p5.Vector`, signed distance fields, SVG path conversion |
|
||||
| `references/visual-effects.md` | Noise (Perlin, fractal, domain warp, curl), flow fields, particle systems (physics, flocking, trails), pixel manipulation, texture generation (stipple, hatch, halftone), feedback loops, reaction-diffusion |
|
||||
| `references/animation.md` | Frame-based animation, easing functions, `lerp()`/`map()`, spring physics, state machines, timeline sequencing, `millis()`-based timing, transition patterns |
|
||||
| `references/typography.md` | `text()`, `loadFont()`, `textToPoints()`, kinetic typography, text masks, font metrics, responsive text sizing |
|
||||
| `references/color-systems.md` | `colorMode()`, HSB/HSL/RGB, `lerpColor()`, `paletteLerp()`, procedural palettes, color harmony, `blendMode()`, gradient rendering, curated palette library |
|
||||
| `references/webgl-and-3d.md` | WEBGL renderer, 3D primitives, camera, lighting, materials, custom geometry, GLSL shaders (`createShader()`, `createFilterShader()`), framebuffers, post-processing |
|
||||
| `references/interaction.md` | Mouse events, keyboard state, touch input, DOM elements, `createSlider()`/`createButton()`, audio input (p5.sound FFT/amplitude), scroll-driven animation, responsive events |
|
||||
| `references/export-pipeline.md` | `saveCanvas()`, `saveGif()`, `saveFrames()`, deterministic headless capture, ffmpeg frame-to-video, CCapture.js, SVG export, per-clip architecture, platform export (fxhash), video gotchas |
|
||||
| `references/troubleshooting.md` | Performance profiling, per-pixel budgets, common mistakes, browser compatibility, WebGL debugging, font loading issues, pixel density traps, memory leaks, CORS |
|
||||
| `templates/viewer.html` | Interactive viewer template: seed navigation (prev/next/random/jump), parameter sliders, download PNG, responsive canvas. Start from this for explorable generative art |
|
||||
|
||||
---
|
||||
|
||||
## Creative Divergence (use only when user requests experimental/creative/unique output)
|
||||
|
||||
If the user asks for creative, experimental, surprising, or unconventional output, select the strategy that best fits and reason through its steps BEFORE generating code.
|
||||
|
||||
- **Conceptual Blending** — when the user names two things to combine or wants hybrid aesthetics
|
||||
- **SCAMPER** — when the user wants a twist on a known generative art pattern
|
||||
- **Distance Association** — when the user gives a single concept and wants exploration ("make something about time")
|
||||
|
||||
### Conceptual Blending
|
||||
1. Name two distinct visual systems (e.g., particle physics + handwriting)
|
||||
2. Map correspondences (particles = ink drops, forces = pen pressure, fields = letterforms)
|
||||
3. Blend selectively — keep mappings that produce interesting emergent visuals
|
||||
4. Code the blend as a unified system, not two systems side-by-side
|
||||
|
||||
### SCAMPER Transformation
|
||||
Take a known generative pattern (flow field, particle system, L-system, cellular automata) and systematically transform it:
|
||||
- **Substitute**: replace circles with text characters, lines with gradients
|
||||
- **Combine**: merge two patterns (flow field + voronoi)
|
||||
- **Adapt**: apply a 2D pattern to a 3D projection
|
||||
- **Modify**: exaggerate scale, warp the coordinate space
|
||||
- **Purpose**: use a physics sim for typography, a sorting algorithm for color
|
||||
- **Eliminate**: remove the grid, remove color, remove symmetry
|
||||
- **Reverse**: run the simulation backward, invert the parameter space
|
||||
|
||||
### Distance Association
|
||||
1. Anchor on the user's concept (e.g., "loneliness")
|
||||
2. Generate associations at three distances:
|
||||
- Close (obvious): empty room, single figure, silence
|
||||
- Medium (interesting): one fish in a school swimming the wrong way, a phone with no notifications, the gap between subway cars
|
||||
- Far (abstract): prime numbers, asymptotic curves, the color of 3am
|
||||
3. Develop the medium-distance associations — they're specific enough to visualize but unexpected enough to be interesting
|
||||
439
skills/creative/p5js/references/animation.md
Normal file
439
skills/creative/p5js/references/animation.md
Normal file
@@ -0,0 +1,439 @@
|
||||
# Animation
|
||||
|
||||
## Frame-Based Animation
|
||||
|
||||
### The Draw Loop
|
||||
|
||||
```javascript
|
||||
function draw() {
|
||||
// Called ~60 times/sec by default
|
||||
// frameCount — integer, starts at 1
|
||||
// deltaTime — ms since last frame (use for framerate-independent motion)
|
||||
// millis() — ms since sketch start
|
||||
}
|
||||
```
|
||||
|
||||
### Time-Based vs Frame-Based
|
||||
|
||||
```javascript
|
||||
// Frame-based (speed varies with framerate)
|
||||
x += speed;
|
||||
|
||||
// Time-based (consistent speed regardless of framerate)
|
||||
x += speed * (deltaTime / 16.67); // normalized to 60fps
|
||||
```
|
||||
|
||||
### Normalized Time
|
||||
|
||||
```javascript
|
||||
// Progress from 0 to 1 over N seconds
|
||||
let duration = 5000; // 5 seconds in ms
|
||||
let t = constrain(millis() / duration, 0, 1);
|
||||
|
||||
// Looping progress (0 → 1 → 0 → 1...)
|
||||
let period = 3000; // 3 second loop
|
||||
let t = (millis() % period) / period;
|
||||
|
||||
// Ping-pong (0 → 1 → 0 → 1...)
|
||||
let raw = (millis() % (period * 2)) / period;
|
||||
let t = raw <= 1 ? raw : 2 - raw;
|
||||
```
|
||||
|
||||
## Easing Functions
|
||||
|
||||
### Built-in Lerp
|
||||
|
||||
```javascript
|
||||
// Linear interpolation — smooth but mechanical
|
||||
let x = lerp(startX, endX, t);
|
||||
|
||||
// Map for non-0-1 ranges
|
||||
let y = map(t, 0, 1, startY, endY);
|
||||
```
|
||||
|
||||
### Common Easing Curves
|
||||
|
||||
```javascript
|
||||
// Ease in (slow start)
|
||||
function easeInQuad(t) { return t * t; }
|
||||
function easeInCubic(t) { return t * t * t; }
|
||||
function easeInExpo(t) { return t === 0 ? 0 : pow(2, 10 * (t - 1)); }
|
||||
|
||||
// Ease out (slow end)
|
||||
function easeOutQuad(t) { return 1 - (1 - t) * (1 - t); }
|
||||
function easeOutCubic(t) { return 1 - pow(1 - t, 3); }
|
||||
function easeOutExpo(t) { return t === 1 ? 1 : 1 - pow(2, -10 * t); }
|
||||
|
||||
// Ease in-out (slow both ends)
|
||||
function easeInOutCubic(t) {
|
||||
return t < 0.5 ? 4 * t * t * t : 1 - pow(-2 * t + 2, 3) / 2;
|
||||
}
|
||||
function easeInOutQuint(t) {
|
||||
return t < 0.5 ? 16 * t * t * t * t * t : 1 - pow(-2 * t + 2, 5) / 2;
|
||||
}
|
||||
|
||||
// Elastic (spring overshoot)
|
||||
function easeOutElastic(t) {
|
||||
if (t === 0 || t === 1) return t;
|
||||
return pow(2, -10 * t) * sin((t * 10 - 0.75) * (2 * PI / 3)) + 1;
|
||||
}
|
||||
|
||||
// Bounce
|
||||
function easeOutBounce(t) {
|
||||
if (t < 1/2.75) return 7.5625 * t * t;
|
||||
else if (t < 2/2.75) { t -= 1.5/2.75; return 7.5625 * t * t + 0.75; }
|
||||
else if (t < 2.5/2.75) { t -= 2.25/2.75; return 7.5625 * t * t + 0.9375; }
|
||||
else { t -= 2.625/2.75; return 7.5625 * t * t + 0.984375; }
|
||||
}
|
||||
|
||||
// Smooth step (Hermite interpolation — great default)
|
||||
function smoothstep(t) { return t * t * (3 - 2 * t); }
|
||||
|
||||
// Smoother step (Ken Perlin)
|
||||
function smootherstep(t) { return t * t * t * (t * (t * 6 - 15) + 10); }
|
||||
```
|
||||
|
||||
### Applying Easing
|
||||
|
||||
```javascript
|
||||
// Animate from startVal to endVal over duration ms
|
||||
function easedValue(startVal, endVal, startTime, duration, easeFn) {
|
||||
let t = constrain((millis() - startTime) / duration, 0, 1);
|
||||
return lerp(startVal, endVal, easeFn(t));
|
||||
}
|
||||
|
||||
// Usage
|
||||
let x = easedValue(100, 700, animStartTime, 2000, easeOutCubic);
|
||||
```
|
||||
|
||||
## Spring Physics
|
||||
|
||||
More natural than easing — responds to force, overshoots, settles.
|
||||
|
||||
```javascript
|
||||
class Spring {
|
||||
constructor(value, target, stiffness = 0.1, damping = 0.7) {
|
||||
this.value = value;
|
||||
this.target = target;
|
||||
this.velocity = 0;
|
||||
this.stiffness = stiffness;
|
||||
this.damping = damping;
|
||||
}
|
||||
|
||||
update() {
|
||||
let force = (this.target - this.value) * this.stiffness;
|
||||
this.velocity += force;
|
||||
this.velocity *= this.damping;
|
||||
this.value += this.velocity;
|
||||
return this.value;
|
||||
}
|
||||
|
||||
setTarget(t) { this.target = t; }
|
||||
isSettled(threshold = 0.01) {
|
||||
return abs(this.velocity) < threshold && abs(this.value - this.target) < threshold;
|
||||
}
|
||||
}
|
||||
|
||||
// Usage
|
||||
let springX = new Spring(0, 0, 0.08, 0.85);
|
||||
function draw() {
|
||||
springX.setTarget(mouseX);
|
||||
let x = springX.update();
|
||||
ellipse(x, height/2, 50);
|
||||
}
|
||||
```
|
||||
|
||||
### 2D Spring
|
||||
|
||||
```javascript
|
||||
class Spring2D {
|
||||
constructor(x, y) {
|
||||
this.pos = createVector(x, y);
|
||||
this.target = createVector(x, y);
|
||||
this.vel = createVector(0, 0);
|
||||
this.stiffness = 0.08;
|
||||
this.damping = 0.85;
|
||||
}
|
||||
|
||||
update() {
|
||||
let force = p5.Vector.sub(this.target, this.pos).mult(this.stiffness);
|
||||
this.vel.add(force).mult(this.damping);
|
||||
this.pos.add(this.vel);
|
||||
return this.pos;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## State Machines
|
||||
|
||||
For complex multi-phase animations.
|
||||
|
||||
```javascript
|
||||
const STATES = { IDLE: 0, ENTER: 1, ACTIVE: 2, EXIT: 3 };
|
||||
let state = STATES.IDLE;
|
||||
let stateStart = 0;
|
||||
|
||||
function setState(newState) {
|
||||
state = newState;
|
||||
stateStart = millis();
|
||||
}
|
||||
|
||||
function stateTime() {
|
||||
return millis() - stateStart;
|
||||
}
|
||||
|
||||
function draw() {
|
||||
switch (state) {
|
||||
case STATES.IDLE:
|
||||
// waiting...
|
||||
break;
|
||||
case STATES.ENTER:
|
||||
let t = constrain(stateTime() / 1000, 0, 1);
|
||||
let alpha = easeOutCubic(t) * 255;
|
||||
// fade in...
|
||||
if (t >= 1) setState(STATES.ACTIVE);
|
||||
break;
|
||||
case STATES.ACTIVE:
|
||||
// main animation...
|
||||
break;
|
||||
case STATES.EXIT:
|
||||
let t2 = constrain(stateTime() / 500, 0, 1);
|
||||
// fade out...
|
||||
if (t2 >= 1) setState(STATES.IDLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Timeline Sequencing
|
||||
|
||||
For timed multi-scene animations (motion graphics, title sequences).
|
||||
|
||||
```javascript
|
||||
class Timeline {
|
||||
constructor() {
|
||||
this.events = [];
|
||||
}
|
||||
|
||||
at(timeMs, duration, fn) {
|
||||
this.events.push({ start: timeMs, end: timeMs + duration, fn });
|
||||
return this;
|
||||
}
|
||||
|
||||
update() {
|
||||
let now = millis();
|
||||
for (let e of this.events) {
|
||||
if (now >= e.start && now < e.end) {
|
||||
let t = (now - e.start) / (e.end - e.start);
|
||||
e.fn(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Usage
|
||||
let timeline = new Timeline();
|
||||
timeline
|
||||
.at(0, 2000, (t) => {
|
||||
// Scene 1: title fade in (0-2s)
|
||||
let alpha = easeOutCubic(t) * 255;
|
||||
fill(255, alpha);
|
||||
textSize(48);
|
||||
text("Hello", width/2, height/2);
|
||||
})
|
||||
.at(2000, 1000, (t) => {
|
||||
// Scene 2: title fade out (2-3s)
|
||||
let alpha = (1 - easeInCubic(t)) * 255;
|
||||
fill(255, alpha);
|
||||
textSize(48);
|
||||
text("Hello", width/2, height/2);
|
||||
})
|
||||
.at(3000, 5000, (t) => {
|
||||
// Scene 3: main content (3-8s)
|
||||
renderMainContent(t);
|
||||
});
|
||||
|
||||
function draw() {
|
||||
background(0);
|
||||
timeline.update();
|
||||
}
|
||||
```
|
||||
|
||||
## Noise-Driven Motion
|
||||
|
||||
More organic than deterministic animation.
|
||||
|
||||
```javascript
|
||||
// Smooth wandering position
|
||||
let x = map(noise(frameCount * 0.005, 0), 0, 1, 0, width);
|
||||
let y = map(noise(0, frameCount * 0.005), 0, 1, 0, height);
|
||||
|
||||
// Noise-driven rotation
|
||||
let angle = noise(frameCount * 0.01) * TWO_PI;
|
||||
|
||||
// Noise-driven scale (breathing effect)
|
||||
let s = map(noise(frameCount * 0.02), 0, 1, 0.8, 1.2);
|
||||
|
||||
// Noise-driven color shift
|
||||
let hue = map(noise(frameCount * 0.003), 0, 1, 0, 360);
|
||||
```
|
||||
|
||||
## Transition Patterns
|
||||
|
||||
### Fade In/Out
|
||||
|
||||
```javascript
|
||||
function fadeIn(t) { return constrain(t, 0, 1); }
|
||||
function fadeOut(t) { return constrain(1 - t, 0, 1); }
|
||||
```
|
||||
|
||||
### Slide
|
||||
|
||||
```javascript
|
||||
function slideIn(t, direction = 'left') {
|
||||
let et = easeOutCubic(t);
|
||||
switch (direction) {
|
||||
case 'left': return lerp(-width, 0, et);
|
||||
case 'right': return lerp(width, 0, et);
|
||||
case 'up': return lerp(-height, 0, et);
|
||||
case 'down': return lerp(height, 0, et);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Scale Reveal
|
||||
|
||||
```javascript
|
||||
function scaleReveal(t) {
|
||||
let et = easeOutElastic(constrain(t, 0, 1));
|
||||
push();
|
||||
translate(width/2, height/2);
|
||||
scale(et);
|
||||
translate(-width/2, -height/2);
|
||||
// draw content...
|
||||
pop();
|
||||
}
|
||||
```
|
||||
|
||||
### Staggered Entry
|
||||
|
||||
```javascript
|
||||
// N elements appear one after another
|
||||
let staggerDelay = 100; // ms between each
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
let itemStart = baseTime + i * staggerDelay;
|
||||
let t = constrain((millis() - itemStart) / 500, 0, 1);
|
||||
let alpha = easeOutCubic(t) * 255;
|
||||
let yOffset = lerp(30, 0, easeOutCubic(t));
|
||||
// draw element with alpha and yOffset
|
||||
}
|
||||
```
|
||||
|
||||
## Recording Deterministic Animations
|
||||
|
||||
For frame-perfect export, use frame count instead of millis():
|
||||
|
||||
```javascript
|
||||
const TOTAL_FRAMES = 300; // 10 seconds at 30fps
|
||||
const FPS = 30;
|
||||
|
||||
function draw() {
|
||||
let t = frameCount / TOTAL_FRAMES; // 0 to 1 over full duration
|
||||
if (t > 1) { noLoop(); return; }
|
||||
|
||||
// Use t for all animation timing — deterministic
|
||||
renderFrame(t);
|
||||
|
||||
// Export
|
||||
if (CONFIG.recording) {
|
||||
saveCanvas('frame-' + nf(frameCount, 4), 'png');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Scene Fade Envelopes (Video)
|
||||
|
||||
Every scene in a multi-scene video needs fade-in and fade-out. Hard cuts between visually different generative scenes are jarring.
|
||||
|
||||
```javascript
|
||||
const SCENE_FRAMES = 150; // 5 seconds at 30fps
|
||||
const FADE = 15; // half-second fade
|
||||
|
||||
function draw() {
|
||||
let lf = frameCount - 1; // 0-indexed local frame
|
||||
let t = lf / SCENE_FRAMES; // 0..1 normalized progress
|
||||
|
||||
// Fade envelope: ramp up at start, ramp down at end
|
||||
let fade = 1;
|
||||
if (lf < FADE) fade = lf / FADE;
|
||||
if (lf > SCENE_FRAMES - FADE) fade = (SCENE_FRAMES - lf) / FADE;
|
||||
fade = fade * fade * (3 - 2 * fade); // smoothstep for organic feel
|
||||
|
||||
// Apply fade to all visual output
|
||||
// Option 1: multiply alpha values by fade
|
||||
fill(r, g, b, alpha * fade);
|
||||
|
||||
// Option 2: tint entire composited image
|
||||
tint(255, fade * 255);
|
||||
image(sceneBuffer, 0, 0);
|
||||
noTint();
|
||||
|
||||
// Option 3: multiply pixel brightness (for pixel-level scenes)
|
||||
pixels[i] = r * fade;
|
||||
}
|
||||
```
|
||||
|
||||
## Animating Static Algorithms
|
||||
|
||||
Some generative algorithms produce a single static result (attractors, circle packing, Voronoi). In video, static content reads as frozen/broken. Techniques to add motion:
|
||||
|
||||
### Progressive Reveal
|
||||
|
||||
Expand a mask from center outward to reveal the precomputed result:
|
||||
|
||||
```javascript
|
||||
let revealRadius = easeOutCubic(min(t * 1.5, 1)) * (width * 0.8);
|
||||
// In the render loop, skip pixels beyond revealRadius from center
|
||||
let dx = x - width/2, dy = y - height/2;
|
||||
if (sqrt(dx*dx + dy*dy) > revealRadius) continue;
|
||||
// Soft edge:
|
||||
let edgeFade = constrain((revealRadius - dist) / 40, 0, 1);
|
||||
```
|
||||
|
||||
### Parameter Sweep
|
||||
|
||||
Slowly change a parameter to show the algorithm evolving:
|
||||
|
||||
```javascript
|
||||
// Attractor with drifting parameters
|
||||
let a = -1.7 + sin(t * 0.5) * 0.2; // oscillate around base value
|
||||
let b = 1.3 + cos(t * 0.3) * 0.15;
|
||||
```
|
||||
|
||||
### Slow Camera Motion
|
||||
|
||||
Apply subtle zoom or rotation to the final image:
|
||||
|
||||
```javascript
|
||||
push();
|
||||
translate(width/2, height/2);
|
||||
scale(1 + t * 0.05); // slow 5% zoom over scene duration
|
||||
rotate(t * 0.1); // gentle rotation
|
||||
translate(-width/2, -height/2);
|
||||
image(precomputedResult, 0, 0);
|
||||
pop();
|
||||
```
|
||||
|
||||
### Overlay Dynamic Elements
|
||||
|
||||
Add particles, grain, or subtle noise on top of static content:
|
||||
|
||||
```javascript
|
||||
// Static background
|
||||
image(staticResult, 0, 0);
|
||||
// Dynamic overlay
|
||||
for (let p of ambientParticles) {
|
||||
p.update();
|
||||
p.display(); // slow-moving specks add life
|
||||
}
|
||||
```
|
||||
352
skills/creative/p5js/references/color-systems.md
Normal file
352
skills/creative/p5js/references/color-systems.md
Normal file
@@ -0,0 +1,352 @@
|
||||
# Color Systems
|
||||
|
||||
## Color Modes
|
||||
|
||||
### HSB (Recommended for Generative Art)
|
||||
|
||||
```javascript
|
||||
colorMode(HSB, 360, 100, 100, 100);
|
||||
// Hue: 0-360 (color wheel position)
|
||||
// Saturation: 0-100 (gray to vivid)
|
||||
// Brightness: 0-100 (black to full)
|
||||
// Alpha: 0-100
|
||||
|
||||
fill(200, 80, 90); // blue, vivid, bright
|
||||
fill(200, 80, 90, 50); // 50% transparent
|
||||
```
|
||||
|
||||
HSB advantages:
|
||||
- Rotate hue: `(baseHue + offset) % 360`
|
||||
- Desaturate: reduce S
|
||||
- Darken: reduce B
|
||||
- Monochrome variations: fix H, vary S and B
|
||||
- Complementary: `(hue + 180) % 360`
|
||||
- Analogous: `hue +/- 30`
|
||||
|
||||
### HSL
|
||||
|
||||
```javascript
|
||||
colorMode(HSL, 360, 100, 100, 100);
|
||||
// Lightness 50 = pure color, 0 = black, 100 = white
|
||||
// More intuitive for tints (L > 50) and shades (L < 50)
|
||||
```
|
||||
|
||||
### RGB
|
||||
|
||||
```javascript
|
||||
colorMode(RGB, 255, 255, 255, 255); // default
|
||||
// Direct channel control, less intuitive for procedural palettes
|
||||
```
|
||||
|
||||
## Color Objects
|
||||
|
||||
```javascript
|
||||
let c = color(200, 80, 90); // create color object
|
||||
fill(c);
|
||||
|
||||
// Extract components
|
||||
let h = hue(c);
|
||||
let s = saturation(c);
|
||||
let b = brightness(c);
|
||||
let r = red(c);
|
||||
let g = green(c);
|
||||
let bl = blue(c);
|
||||
let a = alpha(c);
|
||||
|
||||
// Hex colors work everywhere
|
||||
fill('#e8d5b7');
|
||||
fill('#e8d5b7cc'); // with alpha
|
||||
|
||||
// Modify via setters
|
||||
c.setAlpha(128);
|
||||
c.setRed(200);
|
||||
```
|
||||
|
||||
## Color Interpolation
|
||||
|
||||
### lerpColor
|
||||
|
||||
```javascript
|
||||
let c1 = color(0, 80, 100); // red
|
||||
let c2 = color(200, 80, 100); // blue
|
||||
let mixed = lerpColor(c1, c2, 0.5); // midpoint blend
|
||||
// Works in current colorMode
|
||||
```
|
||||
|
||||
### paletteLerp (p5.js 1.11+)
|
||||
|
||||
Interpolate through multiple colors at once.
|
||||
|
||||
```javascript
|
||||
let colors = [
|
||||
color('#2E0854'),
|
||||
color('#850E35'),
|
||||
color('#EE6C4D'),
|
||||
color('#F5E663')
|
||||
];
|
||||
let c = paletteLerp(colors, t); // t = 0..1, interpolates through all
|
||||
```
|
||||
|
||||
### Manual Multi-Stop Gradient
|
||||
|
||||
```javascript
|
||||
function multiLerp(colors, t) {
|
||||
t = constrain(t, 0, 1);
|
||||
let segment = t * (colors.length - 1);
|
||||
let idx = floor(segment);
|
||||
let frac = segment - idx;
|
||||
idx = min(idx, colors.length - 2);
|
||||
return lerpColor(colors[idx], colors[idx + 1], frac);
|
||||
}
|
||||
```
|
||||
|
||||
## Gradient Rendering
|
||||
|
||||
### Linear Gradient
|
||||
|
||||
```javascript
|
||||
function linearGradient(x1, y1, x2, y2, c1, c2) {
|
||||
let steps = dist(x1, y1, x2, y2);
|
||||
for (let i = 0; i <= steps; i++) {
|
||||
let t = i / steps;
|
||||
let c = lerpColor(c1, c2, t);
|
||||
stroke(c);
|
||||
let x = lerp(x1, x2, t);
|
||||
let y = lerp(y1, y2, t);
|
||||
// Draw perpendicular line at each point
|
||||
let dx = -(y2 - y1) / steps * 1000;
|
||||
let dy = (x2 - x1) / steps * 1000;
|
||||
line(x - dx, y - dy, x + dx, y + dy);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Radial Gradient
|
||||
|
||||
```javascript
|
||||
function radialGradient(cx, cy, r, innerColor, outerColor) {
|
||||
noStroke();
|
||||
for (let i = r; i > 0; i--) {
|
||||
let t = 1 - i / r;
|
||||
fill(lerpColor(innerColor, outerColor, t));
|
||||
ellipse(cx, cy, i * 2);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Noise-Based Gradient
|
||||
|
||||
```javascript
|
||||
function noiseGradient(colors, noiseScale, time) {
|
||||
loadPixels();
|
||||
for (let y = 0; y < height; y++) {
|
||||
for (let x = 0; x < width; x++) {
|
||||
let n = noise(x * noiseScale, y * noiseScale, time);
|
||||
let c = multiLerp(colors, n);
|
||||
let idx = 4 * (y * width + x);
|
||||
pixels[idx] = red(c);
|
||||
pixels[idx+1] = green(c);
|
||||
pixels[idx+2] = blue(c);
|
||||
pixels[idx+3] = 255;
|
||||
}
|
||||
}
|
||||
updatePixels();
|
||||
}
|
||||
```
|
||||
|
||||
## Procedural Palette Generation
|
||||
|
||||
### Complementary
|
||||
|
||||
```javascript
|
||||
function complementary(baseHue) {
|
||||
return [baseHue, (baseHue + 180) % 360];
|
||||
}
|
||||
```
|
||||
|
||||
### Analogous
|
||||
|
||||
```javascript
|
||||
function analogous(baseHue, spread = 30) {
|
||||
return [
|
||||
(baseHue - spread + 360) % 360,
|
||||
baseHue,
|
||||
(baseHue + spread) % 360
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
### Triadic
|
||||
|
||||
```javascript
|
||||
function triadic(baseHue) {
|
||||
return [baseHue, (baseHue + 120) % 360, (baseHue + 240) % 360];
|
||||
}
|
||||
```
|
||||
|
||||
### Split Complementary
|
||||
|
||||
```javascript
|
||||
function splitComplementary(baseHue) {
|
||||
return [baseHue, (baseHue + 150) % 360, (baseHue + 210) % 360];
|
||||
}
|
||||
```
|
||||
|
||||
### Tetradic (Rectangle)
|
||||
|
||||
```javascript
|
||||
function tetradic(baseHue) {
|
||||
return [baseHue, (baseHue + 60) % 360, (baseHue + 180) % 360, (baseHue + 240) % 360];
|
||||
}
|
||||
```
|
||||
|
||||
### Monochromatic Variations
|
||||
|
||||
```javascript
|
||||
function monoVariations(hue, count = 5) {
|
||||
let colors = [];
|
||||
for (let i = 0; i < count; i++) {
|
||||
let s = map(i, 0, count - 1, 20, 90);
|
||||
let b = map(i, 0, count - 1, 95, 40);
|
||||
colors.push(color(hue, s, b));
|
||||
}
|
||||
return colors;
|
||||
}
|
||||
```
|
||||
|
||||
## Curated Palette Library
|
||||
|
||||
### Warm Palettes
|
||||
|
||||
```javascript
|
||||
const SUNSET = ['#2E0854', '#850E35', '#EE6C4D', '#F5E663'];
|
||||
const EMBER = ['#1a0000', '#4a0000', '#8b2500', '#cd5c00', '#ffd700'];
|
||||
const PEACH = ['#fff5eb', '#ffdab9', '#ff9a76', '#ff6b6b', '#c94c4c'];
|
||||
const COPPER = ['#1c1108', '#3d2b1f', '#7b4b2a', '#b87333', '#daa06d'];
|
||||
```
|
||||
|
||||
### Cool Palettes
|
||||
|
||||
```javascript
|
||||
const OCEAN = ['#0a0e27', '#1a1b4b', '#2a4a7f', '#3d7cb8', '#87ceeb'];
|
||||
const ARCTIC = ['#0d1b2a', '#1b263b', '#415a77', '#778da9', '#e0e1dd'];
|
||||
const FOREST = ['#0b1a0b', '#1a3a1a', '#2d5a2d', '#4a8c4a', '#90c990'];
|
||||
const DEEP_SEA = ['#000814', '#001d3d', '#003566', '#006d77', '#83c5be'];
|
||||
```
|
||||
|
||||
### Neutral Palettes
|
||||
|
||||
```javascript
|
||||
const GRAPHITE = ['#1a1a1a', '#333333', '#555555', '#888888', '#cccccc'];
|
||||
const CREAM = ['#f4f0e8', '#e8dcc8', '#c9b99a', '#a89070', '#7a6450'];
|
||||
const SLATE = ['#1e293b', '#334155', '#475569', '#64748b', '#94a3b8'];
|
||||
```
|
||||
|
||||
### Vivid Palettes
|
||||
|
||||
```javascript
|
||||
const NEON = ['#ff00ff', '#00ffff', '#ff0080', '#80ff00', '#0080ff'];
|
||||
const RAINBOW = ['#ff0000', '#ff8000', '#ffff00', '#00ff00', '#0000ff', '#8000ff'];
|
||||
const VAPOR = ['#ff71ce', '#01cdfe', '#05ffa1', '#b967ff', '#fffb96'];
|
||||
const CYBER = ['#0f0f0f', '#00ff41', '#ff0090', '#00d4ff', '#ffd000'];
|
||||
```
|
||||
|
||||
### Earth Tones
|
||||
|
||||
```javascript
|
||||
const TERRA = ['#2c1810', '#5c3a2a', '#8b6b4a', '#c4a672', '#e8d5b7'];
|
||||
const MOSS = ['#1a1f16', '#3d4a2e', '#6b7c4f', '#9aab7a', '#c8d4a9'];
|
||||
const CLAY = ['#3b2f2f', '#6b4c4c', '#9e7676', '#c9a0a0', '#e8caca'];
|
||||
```
|
||||
|
||||
## Blend Modes
|
||||
|
||||
```javascript
|
||||
blendMode(BLEND); // default — alpha compositing
|
||||
blendMode(ADD); // additive — bright glow effects
|
||||
blendMode(MULTIPLY); // darkening — shadows, texture overlay
|
||||
blendMode(SCREEN); // lightening — soft glow
|
||||
blendMode(OVERLAY); // contrast boost — high/low emphasis
|
||||
blendMode(DIFFERENCE); // color subtraction — psychedelic
|
||||
blendMode(EXCLUSION); // softer difference
|
||||
blendMode(REPLACE); // overwrite (no alpha blending)
|
||||
blendMode(REMOVE); // subtract alpha
|
||||
blendMode(LIGHTEST); // keep brighter pixel
|
||||
blendMode(DARKEST); // keep darker pixel
|
||||
blendMode(BURN); // darken + saturate
|
||||
blendMode(DODGE); // lighten + saturate
|
||||
blendMode(SOFT_LIGHT); // subtle overlay
|
||||
blendMode(HARD_LIGHT); // strong overlay
|
||||
|
||||
// ALWAYS reset after use
|
||||
blendMode(BLEND);
|
||||
```
|
||||
|
||||
### Blend Mode Recipes
|
||||
|
||||
| Effect | Mode | Use case |
|
||||
|--------|------|----------|
|
||||
| Additive glow | `ADD` | Light beams, fire, particles |
|
||||
| Shadow overlay | `MULTIPLY` | Texture, vignette |
|
||||
| Soft light mix | `SCREEN` | Fog, mist, backlight |
|
||||
| High contrast | `OVERLAY` | Dramatic compositing |
|
||||
| Color negative | `DIFFERENCE` | Glitch, psychedelic |
|
||||
| Layer compositing | `BLEND` | Standard alpha layering |
|
||||
|
||||
## Background Techniques
|
||||
|
||||
### Textured Background
|
||||
|
||||
```javascript
|
||||
function texturedBackground(baseColor, noiseScale, noiseAmount) {
|
||||
loadPixels();
|
||||
let r = red(baseColor), g = green(baseColor), b = blue(baseColor);
|
||||
for (let i = 0; i < pixels.length; i += 4) {
|
||||
let x = (i / 4) % width;
|
||||
let y = floor((i / 4) / width);
|
||||
let n = (noise(x * noiseScale, y * noiseScale) - 0.5) * noiseAmount;
|
||||
pixels[i] = constrain(r + n, 0, 255);
|
||||
pixels[i+1] = constrain(g + n, 0, 255);
|
||||
pixels[i+2] = constrain(b + n, 0, 255);
|
||||
pixels[i+3] = 255;
|
||||
}
|
||||
updatePixels();
|
||||
}
|
||||
```
|
||||
|
||||
### Vignette
|
||||
|
||||
```javascript
|
||||
function vignette(strength = 0.5, radius = 0.7) {
|
||||
loadPixels();
|
||||
let cx = width / 2, cy = height / 2;
|
||||
let maxDist = dist(0, 0, cx, cy);
|
||||
for (let i = 0; i < pixels.length; i += 4) {
|
||||
let x = (i / 4) % width;
|
||||
let y = floor((i / 4) / width);
|
||||
let d = dist(x, y, cx, cy) / maxDist;
|
||||
let factor = 1.0 - smoothstep(constrain((d - radius) / (1 - radius), 0, 1)) * strength;
|
||||
pixels[i] *= factor;
|
||||
pixels[i+1] *= factor;
|
||||
pixels[i+2] *= factor;
|
||||
}
|
||||
updatePixels();
|
||||
}
|
||||
|
||||
function smoothstep(t) { return t * t * (3 - 2 * t); }
|
||||
```
|
||||
|
||||
### Film Grain
|
||||
|
||||
```javascript
|
||||
function filmGrain(amount = 30) {
|
||||
loadPixels();
|
||||
for (let i = 0; i < pixels.length; i += 4) {
|
||||
let grain = random(-amount, amount);
|
||||
pixels[i] = constrain(pixels[i] + grain, 0, 255);
|
||||
pixels[i+1] = constrain(pixels[i+1] + grain, 0, 255);
|
||||
pixels[i+2] = constrain(pixels[i+2] + grain, 0, 255);
|
||||
}
|
||||
updatePixels();
|
||||
}
|
||||
```
|
||||
410
skills/creative/p5js/references/core-api.md
Normal file
410
skills/creative/p5js/references/core-api.md
Normal file
@@ -0,0 +1,410 @@
|
||||
# Core API Reference
|
||||
|
||||
## Canvas Setup
|
||||
|
||||
### createCanvas()
|
||||
|
||||
```javascript
|
||||
// 2D (default renderer)
|
||||
createCanvas(1920, 1080);
|
||||
|
||||
// WebGL (3D, shaders)
|
||||
createCanvas(1920, 1080, WEBGL);
|
||||
|
||||
// Responsive
|
||||
createCanvas(windowWidth, windowHeight);
|
||||
```
|
||||
|
||||
### Pixel Density
|
||||
|
||||
High-DPI displays render at 2x by default. This doubles memory usage and halves performance.
|
||||
|
||||
```javascript
|
||||
// Force 1x for consistent export and performance
|
||||
pixelDensity(1);
|
||||
|
||||
// Match display (default) — sharp on retina but expensive
|
||||
pixelDensity(displayDensity());
|
||||
|
||||
// ALWAYS call before createCanvas()
|
||||
function setup() {
|
||||
pixelDensity(1); // first
|
||||
createCanvas(1920, 1080); // second
|
||||
}
|
||||
```
|
||||
|
||||
For export, always `pixelDensity(1)` and use the exact target resolution. Never rely on device scaling for final output.
|
||||
|
||||
### Responsive Resize
|
||||
|
||||
```javascript
|
||||
function windowResized() {
|
||||
resizeCanvas(windowWidth, windowHeight);
|
||||
// Recreate offscreen buffers at new size
|
||||
bgLayer = createGraphics(width, height);
|
||||
// Reinitialize any size-dependent state
|
||||
}
|
||||
```
|
||||
|
||||
## Coordinate System
|
||||
|
||||
### P2D (Default)
|
||||
- Origin: top-left (0, 0)
|
||||
- X increases rightward
|
||||
- Y increases downward
|
||||
- Angles: radians by default, `angleMode(DEGREES)` to switch
|
||||
|
||||
### WEBGL
|
||||
- Origin: center of canvas
|
||||
- X increases rightward, Y increases **upward**, Z increases toward viewer
|
||||
- To get P2D-like coordinates in WEBGL: `translate(-width/2, -height/2)`
|
||||
|
||||
## Draw Loop
|
||||
|
||||
```javascript
|
||||
function preload() {
|
||||
// Load assets before setup — fonts, images, JSON, CSV
|
||||
// Blocks execution until all loads complete
|
||||
font = loadFont('font.otf');
|
||||
img = loadImage('texture.png');
|
||||
data = loadJSON('data.json');
|
||||
}
|
||||
|
||||
function setup() {
|
||||
// Runs once. Create canvas, initialize state.
|
||||
createCanvas(1920, 1080);
|
||||
colorMode(HSB, 360, 100, 100, 100);
|
||||
randomSeed(CONFIG.seed);
|
||||
noiseSeed(CONFIG.seed);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// Runs every frame (default 60fps).
|
||||
// Set frameRate(30) in setup() to change.
|
||||
// Call noLoop() for static sketches (render once).
|
||||
}
|
||||
```
|
||||
|
||||
### Frame Control
|
||||
|
||||
```javascript
|
||||
frameRate(30); // set target FPS
|
||||
noLoop(); // stop draw loop (static pieces)
|
||||
loop(); // restart draw loop
|
||||
redraw(); // call draw() once (manual refresh)
|
||||
frameCount // frames since start (integer)
|
||||
deltaTime // milliseconds since last frame (float)
|
||||
millis() // milliseconds since sketch started
|
||||
```
|
||||
|
||||
## Transform Stack
|
||||
|
||||
Every transform is cumulative. Use `push()`/`pop()` to isolate.
|
||||
|
||||
```javascript
|
||||
push();
|
||||
translate(width / 2, height / 2);
|
||||
rotate(angle);
|
||||
scale(1.5);
|
||||
// draw something at transformed position
|
||||
ellipse(0, 0, 100, 100);
|
||||
pop();
|
||||
// back to original coordinate system
|
||||
```
|
||||
|
||||
### Transform Functions
|
||||
|
||||
| Function | Effect |
|
||||
|----------|--------|
|
||||
| `translate(x, y)` | Move origin |
|
||||
| `rotate(angle)` | Rotate around origin (radians) |
|
||||
| `scale(s)` / `scale(sx, sy)` | Scale from origin |
|
||||
| `shearX(angle)` | Skew X axis |
|
||||
| `shearY(angle)` | Skew Y axis |
|
||||
| `applyMatrix(a, b, c, d, e, f)` | Arbitrary 2D affine transform |
|
||||
| `resetMatrix()` | Clear all transforms |
|
||||
|
||||
### Composition Pattern: Rotate Around Center
|
||||
|
||||
```javascript
|
||||
push();
|
||||
translate(cx, cy); // move origin to center
|
||||
rotate(angle); // rotate around that center
|
||||
translate(-cx, -cy); // move origin back
|
||||
// draw at original coordinates, but rotated around (cx, cy)
|
||||
rect(cx - 50, cy - 50, 100, 100);
|
||||
pop();
|
||||
```
|
||||
|
||||
## Offscreen Buffers (createGraphics)
|
||||
|
||||
Offscreen buffers are separate canvases you can draw to and composite. Essential for:
|
||||
- **Layered composition** — background, midground, foreground
|
||||
- **Persistent trails** — draw to buffer, fade with semi-transparent rect, never clear
|
||||
- **Masking** — draw mask to buffer, apply with `image()` or pixel operations
|
||||
- **Post-processing** — render scene to buffer, apply effects, draw to main canvas
|
||||
|
||||
```javascript
|
||||
let layer;
|
||||
|
||||
function setup() {
|
||||
createCanvas(1920, 1080);
|
||||
layer = createGraphics(width, height);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// Draw to offscreen buffer
|
||||
layer.background(0, 10); // semi-transparent clear = trails
|
||||
layer.fill(255);
|
||||
layer.ellipse(mouseX, mouseY, 20);
|
||||
|
||||
// Composite to main canvas
|
||||
image(layer, 0, 0);
|
||||
}
|
||||
```
|
||||
|
||||
### Trail Effect Pattern
|
||||
|
||||
```javascript
|
||||
let trailBuffer;
|
||||
|
||||
function setup() {
|
||||
createCanvas(1920, 1080);
|
||||
trailBuffer = createGraphics(width, height);
|
||||
trailBuffer.background(0);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// Fade previous frame (lower alpha = longer trails)
|
||||
trailBuffer.noStroke();
|
||||
trailBuffer.fill(0, 0, 0, 15); // RGBA — 15/255 alpha
|
||||
trailBuffer.rect(0, 0, width, height);
|
||||
|
||||
// Draw new content
|
||||
trailBuffer.fill(255);
|
||||
trailBuffer.ellipse(mouseX, mouseY, 10);
|
||||
|
||||
// Show
|
||||
image(trailBuffer, 0, 0);
|
||||
}
|
||||
```
|
||||
|
||||
### Multi-Layer Composition
|
||||
|
||||
```javascript
|
||||
let bgLayer, contentLayer, fxLayer;
|
||||
|
||||
function setup() {
|
||||
createCanvas(1920, 1080);
|
||||
bgLayer = createGraphics(width, height);
|
||||
contentLayer = createGraphics(width, height);
|
||||
fxLayer = createGraphics(width, height);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// Background — drawn once or slowly evolving
|
||||
renderBackground(bgLayer);
|
||||
|
||||
// Content — main visual elements
|
||||
contentLayer.clear();
|
||||
renderContent(contentLayer);
|
||||
|
||||
// FX — overlays, vignettes, grain
|
||||
fxLayer.clear();
|
||||
renderEffects(fxLayer);
|
||||
|
||||
// Composite with blend modes
|
||||
image(bgLayer, 0, 0);
|
||||
blendMode(ADD);
|
||||
image(contentLayer, 0, 0);
|
||||
blendMode(MULTIPLY);
|
||||
image(fxLayer, 0, 0);
|
||||
blendMode(BLEND); // reset
|
||||
}
|
||||
```
|
||||
|
||||
## Composition Patterns
|
||||
|
||||
### Grid Layout
|
||||
|
||||
```javascript
|
||||
let cols = 10, rows = 10;
|
||||
let cellW = width / cols;
|
||||
let cellH = height / rows;
|
||||
for (let i = 0; i < cols; i++) {
|
||||
for (let j = 0; j < rows; j++) {
|
||||
let cx = cellW * (i + 0.5);
|
||||
let cy = cellH * (j + 0.5);
|
||||
// draw element at (cx, cy) within cell size (cellW, cellH)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Radial Layout
|
||||
|
||||
```javascript
|
||||
let n = 12;
|
||||
for (let i = 0; i < n; i++) {
|
||||
let angle = TWO_PI * i / n;
|
||||
let r = 300;
|
||||
let x = width/2 + cos(angle) * r;
|
||||
let y = height/2 + sin(angle) * r;
|
||||
// draw element at (x, y)
|
||||
}
|
||||
```
|
||||
|
||||
### Golden Ratio Spiral
|
||||
|
||||
```javascript
|
||||
let phi = (1 + sqrt(5)) / 2;
|
||||
let n = 500;
|
||||
for (let i = 0; i < n; i++) {
|
||||
let angle = i * TWO_PI / (phi * phi);
|
||||
let r = sqrt(i) * 10;
|
||||
let x = width/2 + cos(angle) * r;
|
||||
let y = height/2 + sin(angle) * r;
|
||||
let size = map(i, 0, n, 8, 2);
|
||||
ellipse(x, y, size);
|
||||
}
|
||||
```
|
||||
|
||||
### Margin-Aware Composition
|
||||
|
||||
```javascript
|
||||
const MARGIN = 80; // pixels from edge
|
||||
const drawW = width - 2 * MARGIN;
|
||||
const drawH = height - 2 * MARGIN;
|
||||
|
||||
// Map normalized [0,1] coordinates to drawable area
|
||||
function mapX(t) { return MARGIN + t * drawW; }
|
||||
function mapY(t) { return MARGIN + t * drawH; }
|
||||
```
|
||||
|
||||
## Random and Noise
|
||||
|
||||
### Seeded Random
|
||||
|
||||
```javascript
|
||||
randomSeed(42);
|
||||
let x = random(100); // always same value for seed 42
|
||||
let y = random(-1, 1); // range
|
||||
let item = random(myArray); // random element
|
||||
```
|
||||
|
||||
### Gaussian Random
|
||||
|
||||
```javascript
|
||||
let x = randomGaussian(0, 1); // mean=0, stddev=1
|
||||
// Useful for natural-looking distributions
|
||||
```
|
||||
|
||||
### Perlin Noise
|
||||
|
||||
```javascript
|
||||
noiseSeed(42);
|
||||
noiseDetail(4, 0.5); // 4 octaves, 0.5 falloff
|
||||
|
||||
let v = noise(x * 0.01, y * 0.01); // returns 0.0 to 1.0
|
||||
// Scale factor (0.01) controls feature size — smaller = smoother
|
||||
```
|
||||
|
||||
## Math Utilities
|
||||
|
||||
| Function | Description |
|
||||
|----------|-------------|
|
||||
| `map(v, lo1, hi1, lo2, hi2)` | Remap value between ranges |
|
||||
| `constrain(v, lo, hi)` | Clamp to range |
|
||||
| `lerp(a, b, t)` | Linear interpolation |
|
||||
| `norm(v, lo, hi)` | Normalize to 0-1 |
|
||||
| `dist(x1, y1, x2, y2)` | Euclidean distance |
|
||||
| `mag(x, y)` | Vector magnitude |
|
||||
| `abs()`, `ceil()`, `floor()`, `round()` | Standard math |
|
||||
| `sq(n)`, `sqrt(n)`, `pow(b, e)` | Powers |
|
||||
| `sin()`, `cos()`, `tan()`, `atan2()` | Trig (radians) |
|
||||
| `degrees(r)`, `radians(d)` | Angle conversion |
|
||||
| `fract(n)` | Fractional part |
|
||||
|
||||
## p5.js 2.0 Changes
|
||||
|
||||
p5.js 2.0 (released Apr 2025, current: 2.2) introduces breaking changes. The p5.js editor defaults to 1.x until Aug 2026. Use 2.x only when you need its features.
|
||||
|
||||
### async setup() replaces preload()
|
||||
|
||||
```javascript
|
||||
// p5.js 1.x
|
||||
let img;
|
||||
function preload() { img = loadImage('cat.jpg'); }
|
||||
function setup() { createCanvas(800, 800); }
|
||||
|
||||
// p5.js 2.x
|
||||
let img;
|
||||
async function setup() {
|
||||
createCanvas(800, 800);
|
||||
img = await loadImage('cat.jpg');
|
||||
}
|
||||
```
|
||||
|
||||
### New Color Modes
|
||||
|
||||
```javascript
|
||||
colorMode(OKLCH); // perceptually uniform — better gradients
|
||||
// L: 0-1 (lightness), C: 0-0.4 (chroma), H: 0-360 (hue)
|
||||
fill(0.7, 0.15, 200); // medium-bright saturated blue
|
||||
|
||||
colorMode(OKLAB); // perceptually uniform, no hue angle
|
||||
colorMode(HWB); // Hue-Whiteness-Blackness
|
||||
```
|
||||
|
||||
### splineVertex() replaces curveVertex()
|
||||
|
||||
No more doubling first/last control points:
|
||||
|
||||
```javascript
|
||||
// p5.js 1.x — must repeat first and last
|
||||
beginShape();
|
||||
curveVertex(pts[0].x, pts[0].y); // doubled
|
||||
for (let p of pts) curveVertex(p.x, p.y);
|
||||
curveVertex(pts[pts.length-1].x, pts[pts.length-1].y); // doubled
|
||||
endShape();
|
||||
|
||||
// p5.js 2.x — clean
|
||||
beginShape();
|
||||
for (let p of pts) splineVertex(p.x, p.y);
|
||||
endShape();
|
||||
```
|
||||
|
||||
### Shader .modify() API
|
||||
|
||||
Modify built-in shaders without writing full GLSL:
|
||||
|
||||
```javascript
|
||||
let myShader = baseMaterialShader().modify({
|
||||
vertexDeclarations: 'uniform float uTime;',
|
||||
'vec4 getWorldPosition': `(vec4 pos) {
|
||||
pos.y += sin(pos.x * 0.1 + uTime) * 20.0;
|
||||
return pos;
|
||||
}`
|
||||
});
|
||||
```
|
||||
|
||||
### Variable Fonts
|
||||
|
||||
```javascript
|
||||
textWeight(700); // dynamic weight without loading multiple files
|
||||
```
|
||||
|
||||
### textToContours() and textToModel()
|
||||
|
||||
```javascript
|
||||
let contours = font.textToContours('HELLO', 0, 0, 200);
|
||||
// Returns array of contour arrays (closed paths)
|
||||
|
||||
let geo = font.textToModel('HELLO', 0, 0, 200);
|
||||
// Returns p5.Geometry for 3D extruded text
|
||||
```
|
||||
|
||||
### CDN for p5.js 2.x
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/p5@2/lib/p5.min.js"></script>
|
||||
```
|
||||
566
skills/creative/p5js/references/export-pipeline.md
Normal file
566
skills/creative/p5js/references/export-pipeline.md
Normal file
@@ -0,0 +1,566 @@
|
||||
# Export Pipeline
|
||||
|
||||
## PNG Export
|
||||
|
||||
### In-Sketch (Keyboard Shortcut)
|
||||
|
||||
```javascript
|
||||
function keyPressed() {
|
||||
if (key === 's' || key === 'S') {
|
||||
saveCanvas('output', 'png');
|
||||
// Downloads output.png immediately
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Timed Export (Static Generative)
|
||||
|
||||
```javascript
|
||||
function setup() {
|
||||
createCanvas(3840, 2160);
|
||||
pixelDensity(1);
|
||||
randomSeed(CONFIG.seed);
|
||||
noiseSeed(CONFIG.seed);
|
||||
noLoop();
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// ... render everything ...
|
||||
saveCanvas('output-seed-' + CONFIG.seed, 'png');
|
||||
}
|
||||
```
|
||||
|
||||
### High-Resolution Export
|
||||
|
||||
For resolutions beyond screen size, use `pixelDensity()` or a large offscreen buffer:
|
||||
|
||||
```javascript
|
||||
function exportHighRes(scale) {
|
||||
let buffer = createGraphics(width * scale, height * scale);
|
||||
buffer.scale(scale);
|
||||
// Re-render everything to buffer at higher resolution
|
||||
renderScene(buffer);
|
||||
buffer.save('highres-output.png');
|
||||
}
|
||||
```
|
||||
|
||||
### Batch Seed Export
|
||||
|
||||
```javascript
|
||||
function exportBatch(startSeed, count) {
|
||||
for (let i = 0; i < count; i++) {
|
||||
CONFIG.seed = startSeed + i;
|
||||
randomSeed(CONFIG.seed);
|
||||
noiseSeed(CONFIG.seed);
|
||||
// Render
|
||||
background(0);
|
||||
renderScene();
|
||||
saveCanvas('seed-' + nf(CONFIG.seed, 5), 'png');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## GIF Export
|
||||
|
||||
### saveGif()
|
||||
|
||||
```javascript
|
||||
function keyPressed() {
|
||||
if (key === 'g' || key === 'G') {
|
||||
saveGif('output', 5);
|
||||
// Captures 5 seconds of animation
|
||||
// Options: saveGif(filename, duration, options)
|
||||
}
|
||||
}
|
||||
|
||||
// With options
|
||||
saveGif('output', 5, {
|
||||
delay: 0, // delay before starting capture (seconds)
|
||||
units: 'seconds' // or 'frames'
|
||||
});
|
||||
```
|
||||
|
||||
Limitations:
|
||||
- GIF is 256 colors max — dithering artifacts on gradients
|
||||
- Large canvases produce huge files
|
||||
- Use a smaller canvas (640x360) for GIF, higher for PNG/MP4
|
||||
- Frame rate is approximate
|
||||
|
||||
### Optimal GIF Settings
|
||||
|
||||
```javascript
|
||||
// For GIF output, use smaller canvas and lower framerate
|
||||
function setup() {
|
||||
createCanvas(640, 360);
|
||||
frameRate(15); // GIF standard
|
||||
pixelDensity(1);
|
||||
}
|
||||
```
|
||||
|
||||
## Frame Sequence Export
|
||||
|
||||
### saveFrames()
|
||||
|
||||
```javascript
|
||||
function keyPressed() {
|
||||
if (key === 'f') {
|
||||
saveFrames('frame', 'png', 10, 30);
|
||||
// 10 seconds, 30 fps → 300 PNG files
|
||||
// Downloads as individual files (browser may block bulk downloads)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Manual Frame Export (More Control)
|
||||
|
||||
```javascript
|
||||
let recording = false;
|
||||
let frameNum = 0;
|
||||
const TOTAL_FRAMES = 300;
|
||||
|
||||
function keyPressed() {
|
||||
if (key === 'r') recording = !recording;
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// ... render frame ...
|
||||
|
||||
if (recording) {
|
||||
saveCanvas('frame-' + nf(frameNum, 4), 'png');
|
||||
frameNum++;
|
||||
if (frameNum >= TOTAL_FRAMES) {
|
||||
recording = false;
|
||||
noLoop();
|
||||
console.log('Recording complete: ' + frameNum + ' frames');
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Deterministic Capture (Critical for Video)
|
||||
|
||||
The `noLoop()` + `redraw()` pattern is **required** for frame-perfect headless capture. Without it, p5's draw loop runs freely in Chrome while Puppeteer screenshots are slow — the sketch runs ahead and you get duplicate/missing frames.
|
||||
|
||||
```javascript
|
||||
function setup() {
|
||||
createCanvas(1920, 1080);
|
||||
pixelDensity(1);
|
||||
noLoop(); // STOP the automatic draw loop
|
||||
window._p5Ready = true; // Signal to capture script
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// This only runs when redraw() is called by the capture script
|
||||
// frameCount increments exactly once per redraw()
|
||||
}
|
||||
```
|
||||
|
||||
The bundled `scripts/export-frames.js` detects `window._p5Ready` and switches to deterministic mode automatically. Without it, falls back to timed capture (less precise).
|
||||
|
||||
### ffmpeg: Frames to MP4
|
||||
|
||||
```bash
|
||||
# Basic encoding
|
||||
ffmpeg -framerate 30 -i frame-%04d.png -c:v libx264 -pix_fmt yuv420p output.mp4
|
||||
|
||||
# High quality
|
||||
ffmpeg -framerate 30 -i frame-%04d.png \
|
||||
-c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p \
|
||||
output.mp4
|
||||
|
||||
# With audio
|
||||
ffmpeg -framerate 30 -i frame-%04d.png -i audio.mp3 \
|
||||
-c:v libx264 -c:a aac -shortest \
|
||||
output.mp4
|
||||
|
||||
# Loop for social media (3 loops)
|
||||
ffmpeg -stream_loop 2 -i output.mp4 -c copy output-looped.mp4
|
||||
```
|
||||
|
||||
### Video Export Gotchas
|
||||
|
||||
**YUV420 clips dark values.** H.264 encodes in YUV420 color space, which rounds dark RGB values. Content below RGB(8,8,8) may become pure black. Subtle dark details (dim particle trails, faint noise textures) disappear in the encoded video even though they're visible in the PNG frames.
|
||||
|
||||
**Fix:** Ensure minimum brightness of ~10 for any visible content. Test by encoding a few frames and comparing the MP4 frame vs the source PNG.
|
||||
|
||||
```bash
|
||||
# Extract a frame from MP4 for comparison
|
||||
ffmpeg -i output.mp4 -vf "select=eq(n\,100)" -vframes 1 check.png
|
||||
```
|
||||
|
||||
**Static frames look broken in video.** If an algorithm produces a single static image (like a pre-computed attractor heatmap), it reads as a freeze/glitch in video. Always add animation even to static content:
|
||||
- Progressive reveal (expand from center, sweep across)
|
||||
- Slow parameter drift (rotate color mapping, shift noise offset)
|
||||
- Camera-like motion (slow zoom, slight pan)
|
||||
- Overlay animated particles or grain
|
||||
|
||||
**Scene transitions are mandatory.** Hard cuts between visually different scenes are jarring. Use fade envelopes:
|
||||
|
||||
```javascript
|
||||
const FADE_FRAMES = 15; // half-second at 30fps
|
||||
let fade = 1;
|
||||
if (localFrame < FADE_FRAMES) fade = localFrame / FADE_FRAMES;
|
||||
if (localFrame > SCENE_FRAMES - FADE_FRAMES) fade = (SCENE_FRAMES - localFrame) / FADE_FRAMES;
|
||||
fade = fade * fade * (3 - 2 * fade); // smoothstep
|
||||
// Apply: multiply all alpha/brightness by fade
|
||||
```
|
||||
|
||||
### Per-Clip Architecture (Multi-Scene Videos)
|
||||
|
||||
For videos with multiple scenes, render each as a separate HTML file + MP4 clip, then stitch with ffmpeg. This enables re-rendering individual scenes without touching the rest.
|
||||
|
||||
**Directory structure:**
|
||||
```
|
||||
project/
|
||||
├── capture-scene.js # Shared: node capture-scene.js <html> <outdir> <frames>
|
||||
├── render-all.sh # Renders all + stitches
|
||||
├── scenes/
|
||||
│ ├── 00-intro.html # Each scene is self-contained
|
||||
│ ├── 01-particles.html
|
||||
│ ├── 02-noise.html
|
||||
│ └── 03-outro.html
|
||||
└── clips/
|
||||
├── 00-intro.mp4 # Each clip rendered independently
|
||||
├── 01-particles.mp4
|
||||
├── 02-noise.mp4
|
||||
├── 03-outro.mp4
|
||||
└── concat.txt
|
||||
```
|
||||
|
||||
**Stitch clips with ffmpeg concat:**
|
||||
```bash
|
||||
# concat.txt (order determines final sequence)
|
||||
file '00-intro.mp4'
|
||||
file '01-particles.mp4'
|
||||
file '02-noise.mp4'
|
||||
file '03-outro.mp4'
|
||||
|
||||
# Lossless stitch (all clips must have same codec/resolution/fps)
|
||||
ffmpeg -f concat -safe 0 -i concat.txt -c copy final.mp4
|
||||
```
|
||||
|
||||
**Re-render a single scene:**
|
||||
```bash
|
||||
node capture-scene.js scenes/01-particles.html clips/01-particles 150
|
||||
ffmpeg -y -framerate 30 -i clips/01-particles/frame-%04d.png \
|
||||
-c:v libx264 -preset slow -crf 16 -pix_fmt yuv420p clips/01-particles.mp4
|
||||
# Then re-stitch
|
||||
ffmpeg -y -f concat -safe 0 -i clips/concat.txt -c copy final.mp4
|
||||
```
|
||||
|
||||
**Re-order without re-rendering:** Just change the order in concat.txt and re-stitch. No frames need re-rendering.
|
||||
|
||||
**Each scene HTML must:**
|
||||
- Call `noLoop()` in setup and set `window._p5Ready = true`
|
||||
- Use `frameCount`-based timing (not `millis()`) for deterministic output
|
||||
- Handle its own fade-in/fade-out envelope
|
||||
- Be fully self-contained (no shared state between scenes)
|
||||
|
||||
### ffmpeg: Frames to GIF (Better Quality)
|
||||
|
||||
```bash
|
||||
# Generate palette first for optimal colors
|
||||
ffmpeg -i frame-%04d.png -vf "fps=15,palettegen=max_colors=256" palette.png
|
||||
|
||||
# Render GIF using palette
|
||||
ffmpeg -i frame-%04d.png -i palette.png \
|
||||
-lavfi "fps=15 [x]; [x][1:v] paletteuse=dither=bayer:bayer_scale=3" \
|
||||
output.gif
|
||||
```
|
||||
|
||||
## Headless Export (Puppeteer)
|
||||
|
||||
For automated, server-side, or CI rendering. Uses a headless Chrome browser to run the sketch.
|
||||
|
||||
### export-frames.js (Node.js Script)
|
||||
|
||||
See `scripts/export-frames.js` for the full implementation. Basic pattern:
|
||||
|
||||
```javascript
|
||||
const puppeteer = require('puppeteer');
|
||||
|
||||
async function captureFrames(htmlPath, outputDir, options) {
|
||||
const browser = await puppeteer.launch({
|
||||
headless: true,
|
||||
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
||||
});
|
||||
const page = await browser.newPage();
|
||||
|
||||
await page.setViewport({
|
||||
width: options.width || 1920,
|
||||
height: options.height || 1080,
|
||||
deviceScaleFactor: 1
|
||||
});
|
||||
|
||||
await page.goto(`file://${path.resolve(htmlPath)}`, {
|
||||
waitUntil: 'networkidle0'
|
||||
});
|
||||
|
||||
// Wait for sketch to initialize
|
||||
await page.waitForSelector('canvas');
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
for (let i = 0; i < options.frames; i++) {
|
||||
const canvas = await page.$('canvas');
|
||||
await canvas.screenshot({
|
||||
path: path.join(outputDir, `frame-${String(i).padStart(4, '0')}.png`)
|
||||
});
|
||||
|
||||
// Advance one frame
|
||||
await page.evaluate(() => { redraw(); });
|
||||
await page.waitForTimeout(1000 / options.fps);
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
}
|
||||
```
|
||||
|
||||
### render.sh (Full Pipeline)
|
||||
|
||||
See `scripts/render.sh` for the complete render script. Pipeline:
|
||||
|
||||
```
|
||||
1. Launch Puppeteer → open sketch HTML
|
||||
2. Capture N frames as PNG sequence
|
||||
3. Pipe to ffmpeg → encode H.264 MP4
|
||||
4. Optional: add audio track
|
||||
5. Clean up temp frames
|
||||
```
|
||||
|
||||
## SVG Export
|
||||
|
||||
### Using p5.js-svg Library
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/p5.js-svg@1.5.1"></script>
|
||||
```
|
||||
|
||||
```javascript
|
||||
function setup() {
|
||||
createCanvas(1920, 1080, SVG); // SVG renderer
|
||||
noLoop();
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// Only vector operations (no pixels, no blend modes)
|
||||
stroke(0);
|
||||
noFill();
|
||||
for (let i = 0; i < 100; i++) {
|
||||
let x = random(width);
|
||||
let y = random(height);
|
||||
ellipse(x, y, random(10, 50));
|
||||
}
|
||||
save('output.svg');
|
||||
}
|
||||
```
|
||||
|
||||
Limitations:
|
||||
- No `loadPixels()`, `updatePixels()`, `filter()`, `blendMode()`
|
||||
- No WebGL
|
||||
- No pixel-level effects
|
||||
- Great for: line art, geometric patterns, plots
|
||||
|
||||
### Hybrid: Raster Background + SVG Overlay
|
||||
|
||||
Render background effects to PNG, then SVG for crisp vector elements on top.
|
||||
|
||||
## Export Format Decision Guide
|
||||
|
||||
| Need | Format | Method |
|
||||
|------|--------|--------|
|
||||
| Single still image | PNG | `saveCanvas()` or `keyPressed()` |
|
||||
| Print-quality still | PNG (high-res) | `pixelDensity(1)` + large canvas |
|
||||
| Short animated loop | GIF | `saveGif()` |
|
||||
| Long animation | MP4 | Frame sequence + ffmpeg |
|
||||
| Social media video | MP4 | `scripts/render.sh` |
|
||||
| Vector/print | SVG | p5.js-svg renderer |
|
||||
| Batch variations | PNG sequence | Seed loop + `saveCanvas()` |
|
||||
| Interactive deployment | HTML | Single self-contained file |
|
||||
| Headless rendering | PNG/MP4 | Puppeteer + ffmpeg |
|
||||
|
||||
## Tiling for Ultra-High-Resolution
|
||||
|
||||
For resolutions too large for a single canvas (e.g., 10000x10000 for print):
|
||||
|
||||
```javascript
|
||||
function renderTiled(totalW, totalH, tileSize) {
|
||||
let cols = ceil(totalW / tileSize);
|
||||
let rows = ceil(totalH / tileSize);
|
||||
|
||||
for (let ty = 0; ty < rows; ty++) {
|
||||
for (let tx = 0; tx < cols; tx++) {
|
||||
let buffer = createGraphics(tileSize, tileSize);
|
||||
buffer.push();
|
||||
buffer.translate(-tx * tileSize, -ty * tileSize);
|
||||
renderScene(buffer, totalW, totalH);
|
||||
buffer.pop();
|
||||
buffer.save(`tile-${tx}-${ty}.png`);
|
||||
buffer.remove(); // free memory
|
||||
}
|
||||
}
|
||||
// Stitch with ImageMagick:
|
||||
// montage tile-*.png -tile 4x4 -geometry +0+0 final.png
|
||||
}
|
||||
```
|
||||
|
||||
## CCapture.js — Deterministic Video Capture
|
||||
|
||||
The built-in `saveFrames()` has limitations: small frame counts, memory issues, browser download blocking. CCapture.js solves all of these by hooking into the browser's timing functions to simulate constant time steps regardless of actual render speed.
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/ccapture.js-npmfixed/build/CCapture.all.min.js"></script>
|
||||
```
|
||||
|
||||
### Basic Setup
|
||||
|
||||
```javascript
|
||||
let capturer;
|
||||
let recording = false;
|
||||
|
||||
function setup() {
|
||||
createCanvas(1920, 1080);
|
||||
pixelDensity(1);
|
||||
|
||||
capturer = new CCapture({
|
||||
format: 'webm', // 'webm', 'gif', 'png', 'jpg'
|
||||
framerate: 30,
|
||||
quality: 99, // 0-100 for webm/jpg
|
||||
// timeLimit: 10, // auto-stop after N seconds
|
||||
// motionBlurFrames: 4 // supersampled motion blur
|
||||
});
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// ... render frame ...
|
||||
|
||||
if (recording) {
|
||||
capturer.capture(document.querySelector('canvas'));
|
||||
}
|
||||
}
|
||||
|
||||
function keyPressed() {
|
||||
if (key === 'c') {
|
||||
if (!recording) {
|
||||
capturer.start();
|
||||
recording = true;
|
||||
console.log('Recording started');
|
||||
} else {
|
||||
capturer.stop();
|
||||
capturer.save(); // triggers download
|
||||
recording = false;
|
||||
console.log('Recording saved');
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Format Comparison
|
||||
|
||||
| Format | Quality | Size | Browser Support |
|
||||
|--------|---------|------|-----------------|
|
||||
| **WebM** | High | Medium | Chrome only |
|
||||
| **GIF** | 256 colors | Large | All (via gif.js worker) |
|
||||
| **PNG sequence** | Lossless | Very large (TAR) | All |
|
||||
| **JPEG sequence** | Lossy | Large (TAR) | All |
|
||||
|
||||
### Important: Timing Hook
|
||||
|
||||
CCapture.js overrides `Date.now()`, `setTimeout`, `requestAnimationFrame`, and `performance.now()`. This means:
|
||||
- `millis()` returns simulated time (perfect for recording)
|
||||
- `deltaTime` is constant (1000/framerate)
|
||||
- Complex sketches that take 500ms per frame still record at smooth 30fps
|
||||
- **Caveat**: Audio sync breaks (audio plays in real-time, not simulated time)
|
||||
|
||||
## Programmatic Export (canvas API)
|
||||
|
||||
For custom export workflows beyond `saveCanvas()`:
|
||||
|
||||
```javascript
|
||||
// Canvas to Blob (for upload, processing)
|
||||
document.querySelector('canvas').toBlob((blob) => {
|
||||
// Upload to server, process, etc.
|
||||
let url = URL.createObjectURL(blob);
|
||||
console.log('Blob URL:', url);
|
||||
}, 'image/png');
|
||||
|
||||
// Canvas to Data URL (for inline embedding)
|
||||
let dataUrl = document.querySelector('canvas').toDataURL('image/png');
|
||||
// Use in <img src="..."> or send as base64
|
||||
```
|
||||
|
||||
## SVG Export (p5.js-svg)
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/p5.js-svg@1.6.0"></script>
|
||||
```
|
||||
|
||||
```javascript
|
||||
function setup() {
|
||||
createCanvas(1920, 1080, SVG); // SVG renderer
|
||||
noLoop();
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// Only vector operations work (no pixel ops, no blendMode)
|
||||
stroke(0);
|
||||
noFill();
|
||||
for (let i = 0; i < 100; i++) {
|
||||
ellipse(random(width), random(height), random(10, 50));
|
||||
}
|
||||
save('output.svg');
|
||||
}
|
||||
```
|
||||
|
||||
**Critical SVG caveats:**
|
||||
- **Must call `clear()` in `draw()`** for animated sketches — SVG DOM accumulates child elements, causing memory bloat
|
||||
- `blendMode()` is **not implemented** in SVG renderer
|
||||
- `filter()`, `loadPixels()`, `updatePixels()` don't work
|
||||
- Requires **p5.js 1.11.x** — not compatible with p5.js 2.x
|
||||
- Perfect for: line art, geometric patterns, pen plotter output
|
||||
|
||||
## Platform Export
|
||||
|
||||
### fxhash Conventions
|
||||
|
||||
```javascript
|
||||
// Replace p5's random with fxhash's deterministic PRNG
|
||||
const rng = $fx.rand;
|
||||
|
||||
// Declare features for rarity/filtering
|
||||
$fx.features({
|
||||
'Palette': paletteName,
|
||||
'Complexity': complexity > 0.7 ? 'High' : 'Low',
|
||||
'Has Particles': particleCount > 0
|
||||
});
|
||||
|
||||
// Declare on-chain parameters
|
||||
$fx.params([
|
||||
{ id: 'density', name: 'Density', type: 'number',
|
||||
options: { min: 1, max: 100, step: 1 } },
|
||||
{ id: 'palette', name: 'Palette', type: 'select',
|
||||
options: { options: ['Warm', 'Cool', 'Mono'] } },
|
||||
{ id: 'accent', name: 'Accent Color', type: 'color' }
|
||||
]);
|
||||
|
||||
// Read params
|
||||
let density = $fx.getParam('density');
|
||||
|
||||
// Build: npx fxhash build → upload.zip
|
||||
// Dev: npx fxhash dev → localhost:3300
|
||||
```
|
||||
|
||||
### Art Blocks / Generic Platform
|
||||
|
||||
```javascript
|
||||
// Platform provides a hash string
|
||||
const hash = tokenData.hash; // Art Blocks convention
|
||||
|
||||
// Build deterministic PRNG from hash
|
||||
function prngFromHash(hash) {
|
||||
let seed = parseInt(hash.slice(0, 16), 16);
|
||||
// xoshiro128** or similar
|
||||
return function() { /* ... */ };
|
||||
}
|
||||
|
||||
const rng = prngFromHash(hash);
|
||||
```
|
||||
398
skills/creative/p5js/references/interaction.md
Normal file
398
skills/creative/p5js/references/interaction.md
Normal file
@@ -0,0 +1,398 @@
|
||||
# Interaction
|
||||
|
||||
## Mouse Events
|
||||
|
||||
### Continuous State
|
||||
|
||||
```javascript
|
||||
mouseX, mouseY // current position (relative to canvas)
|
||||
pmouseX, pmouseY // previous frame position
|
||||
mouseIsPressed // boolean
|
||||
mouseButton // LEFT, RIGHT, CENTER (during press)
|
||||
movedX, movedY // delta since last frame
|
||||
winMouseX, winMouseY // relative to window (not canvas)
|
||||
```
|
||||
|
||||
### Event Callbacks
|
||||
|
||||
```javascript
|
||||
function mousePressed() {
|
||||
// fires once on press
|
||||
// mouseButton tells you which button
|
||||
}
|
||||
|
||||
function mouseReleased() {
|
||||
// fires once on release
|
||||
}
|
||||
|
||||
function mouseClicked() {
|
||||
// fires after press+release (same element)
|
||||
}
|
||||
|
||||
function doubleClicked() {
|
||||
// fires on double-click
|
||||
}
|
||||
|
||||
function mouseMoved() {
|
||||
// fires when mouse moves (no button pressed)
|
||||
}
|
||||
|
||||
function mouseDragged() {
|
||||
// fires when mouse moves WITH button pressed
|
||||
}
|
||||
|
||||
function mouseWheel(event) {
|
||||
// event.delta: positive = scroll down, negative = scroll up
|
||||
zoom += event.delta * -0.01;
|
||||
return false; // prevent page scroll
|
||||
}
|
||||
```
|
||||
|
||||
### Mouse Interaction Patterns
|
||||
|
||||
**Spawn on click:**
|
||||
```javascript
|
||||
function mousePressed() {
|
||||
particles.push(new Particle(mouseX, mouseY));
|
||||
}
|
||||
```
|
||||
|
||||
**Mouse follow with spring:**
|
||||
```javascript
|
||||
let springX, springY;
|
||||
function setup() {
|
||||
springX = new Spring(width/2, width/2);
|
||||
springY = new Spring(height/2, height/2);
|
||||
}
|
||||
function draw() {
|
||||
springX.setTarget(mouseX);
|
||||
springY.setTarget(mouseY);
|
||||
let x = springX.update();
|
||||
let y = springY.update();
|
||||
ellipse(x, y, 50);
|
||||
}
|
||||
```
|
||||
|
||||
**Drag interaction:**
|
||||
```javascript
|
||||
let dragging = false;
|
||||
let dragObj = null;
|
||||
let offsetX, offsetY;
|
||||
|
||||
function mousePressed() {
|
||||
for (let obj of objects) {
|
||||
if (dist(mouseX, mouseY, obj.x, obj.y) < obj.radius) {
|
||||
dragging = true;
|
||||
dragObj = obj;
|
||||
offsetX = mouseX - obj.x;
|
||||
offsetY = mouseY - obj.y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function mouseDragged() {
|
||||
if (dragging && dragObj) {
|
||||
dragObj.x = mouseX - offsetX;
|
||||
dragObj.y = mouseY - offsetY;
|
||||
}
|
||||
}
|
||||
|
||||
function mouseReleased() {
|
||||
dragging = false;
|
||||
dragObj = null;
|
||||
}
|
||||
```
|
||||
|
||||
**Mouse repulsion (particles flee cursor):**
|
||||
```javascript
|
||||
function draw() {
|
||||
let mousePos = createVector(mouseX, mouseY);
|
||||
for (let p of particles) {
|
||||
let d = p.pos.dist(mousePos);
|
||||
if (d < 150) {
|
||||
let repel = p5.Vector.sub(p.pos, mousePos);
|
||||
repel.normalize();
|
||||
repel.mult(map(d, 0, 150, 5, 0));
|
||||
p.applyForce(repel);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Keyboard Events
|
||||
|
||||
### State
|
||||
|
||||
```javascript
|
||||
keyIsPressed // boolean
|
||||
key // last key as string ('a', 'A', ' ')
|
||||
keyCode // numeric code (LEFT_ARROW, UP_ARROW, etc.)
|
||||
```
|
||||
|
||||
### Event Callbacks
|
||||
|
||||
```javascript
|
||||
function keyPressed() {
|
||||
// fires once on press
|
||||
if (keyCode === LEFT_ARROW) { /* ... */ }
|
||||
if (key === 's') saveCanvas('output', 'png');
|
||||
if (key === ' ') CONFIG.paused = !CONFIG.paused;
|
||||
return false; // prevent default browser behavior
|
||||
}
|
||||
|
||||
function keyReleased() {
|
||||
// fires once on release
|
||||
}
|
||||
|
||||
function keyTyped() {
|
||||
// fires for printable characters only (not arrows, shift, etc.)
|
||||
}
|
||||
```
|
||||
|
||||
### Continuous Key State (Multiple Keys)
|
||||
|
||||
```javascript
|
||||
let keys = {};
|
||||
|
||||
function keyPressed() { keys[keyCode] = true; }
|
||||
function keyReleased() { keys[keyCode] = false; }
|
||||
|
||||
function draw() {
|
||||
if (keys[LEFT_ARROW]) player.x -= 5;
|
||||
if (keys[RIGHT_ARROW]) player.x += 5;
|
||||
if (keys[UP_ARROW]) player.y -= 5;
|
||||
if (keys[DOWN_ARROW]) player.y += 5;
|
||||
}
|
||||
```
|
||||
|
||||
### Key Constants
|
||||
|
||||
```
|
||||
LEFT_ARROW, RIGHT_ARROW, UP_ARROW, DOWN_ARROW
|
||||
BACKSPACE, DELETE, ENTER, RETURN, TAB, ESCAPE
|
||||
SHIFT, CONTROL, OPTION, ALT
|
||||
```
|
||||
|
||||
## Touch Events
|
||||
|
||||
```javascript
|
||||
touches // array of { x, y, id } — all current touches
|
||||
|
||||
function touchStarted() {
|
||||
// fires on first touch
|
||||
return false; // prevent default (stops scroll on mobile)
|
||||
}
|
||||
|
||||
function touchMoved() {
|
||||
// fires on touch drag
|
||||
return false;
|
||||
}
|
||||
|
||||
function touchEnded() {
|
||||
// fires on touch release
|
||||
}
|
||||
```
|
||||
|
||||
### Pinch Zoom
|
||||
|
||||
```javascript
|
||||
let prevDist = 0;
|
||||
let zoomLevel = 1;
|
||||
|
||||
function touchMoved() {
|
||||
if (touches.length === 2) {
|
||||
let d = dist(touches[0].x, touches[0].y, touches[1].x, touches[1].y);
|
||||
if (prevDist > 0) {
|
||||
zoomLevel *= d / prevDist;
|
||||
}
|
||||
prevDist = d;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function touchEnded() {
|
||||
prevDist = 0;
|
||||
}
|
||||
```
|
||||
|
||||
## DOM Elements
|
||||
|
||||
### Creating Controls
|
||||
|
||||
```javascript
|
||||
function setup() {
|
||||
createCanvas(800, 800);
|
||||
|
||||
// Slider
|
||||
let slider = createSlider(0, 255, 100, 1); // min, max, default, step
|
||||
slider.position(10, height + 10);
|
||||
slider.input(() => { CONFIG.value = slider.value(); });
|
||||
|
||||
// Button
|
||||
let btn = createButton('Reset');
|
||||
btn.position(10, height + 40);
|
||||
btn.mousePressed(() => { resetSketch(); });
|
||||
|
||||
// Checkbox
|
||||
let check = createCheckbox('Show grid', false);
|
||||
check.position(10, height + 70);
|
||||
check.changed(() => { CONFIG.showGrid = check.checked(); });
|
||||
|
||||
// Select / dropdown
|
||||
let sel = createSelect();
|
||||
sel.position(10, height + 100);
|
||||
sel.option('Mode A');
|
||||
sel.option('Mode B');
|
||||
sel.changed(() => { CONFIG.mode = sel.value(); });
|
||||
|
||||
// Color picker
|
||||
let picker = createColorPicker('#ff0000');
|
||||
picker.position(10, height + 130);
|
||||
picker.input(() => { CONFIG.color = picker.value(); });
|
||||
|
||||
// Text input
|
||||
let inp = createInput('Hello');
|
||||
inp.position(10, height + 160);
|
||||
inp.input(() => { CONFIG.text = inp.value(); });
|
||||
}
|
||||
```
|
||||
|
||||
### Styling DOM Elements
|
||||
|
||||
```javascript
|
||||
let slider = createSlider(0, 100, 50);
|
||||
slider.position(10, 10);
|
||||
slider.style('width', '200px');
|
||||
slider.class('my-slider');
|
||||
slider.parent('controls-div'); // attach to specific DOM element
|
||||
```
|
||||
|
||||
## Audio Input (p5.sound)
|
||||
|
||||
Requires `p5.sound.min.js` addon.
|
||||
|
||||
```html
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.3/addons/p5.sound.min.js"></script>
|
||||
```
|
||||
|
||||
### Microphone Input
|
||||
|
||||
```javascript
|
||||
let mic, fft, amplitude;
|
||||
|
||||
function setup() {
|
||||
createCanvas(800, 800);
|
||||
userStartAudio(); // required — user gesture to enable audio
|
||||
|
||||
mic = new p5.AudioIn();
|
||||
mic.start();
|
||||
|
||||
fft = new p5.FFT(0.8, 256); // smoothing, bins
|
||||
fft.setInput(mic);
|
||||
|
||||
amplitude = new p5.Amplitude();
|
||||
amplitude.setInput(mic);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
let level = amplitude.getLevel(); // 0.0 to 1.0 (overall volume)
|
||||
let spectrum = fft.analyze(); // array of 256 frequency values (0-255)
|
||||
let waveform = fft.waveform(); // array of 256 time-domain samples (-1 to 1)
|
||||
|
||||
// Get energy in frequency bands
|
||||
let bass = fft.getEnergy('bass'); // 20-140 Hz
|
||||
let lowMid = fft.getEnergy('lowMid'); // 140-400 Hz
|
||||
let mid = fft.getEnergy('mid'); // 400-2600 Hz
|
||||
let highMid = fft.getEnergy('highMid'); // 2600-5200 Hz
|
||||
let treble = fft.getEnergy('treble'); // 5200-14000 Hz
|
||||
// Each returns 0-255
|
||||
}
|
||||
```
|
||||
|
||||
### Audio File Playback
|
||||
|
||||
```javascript
|
||||
let song, fft;
|
||||
|
||||
function preload() {
|
||||
song = loadSound('track.mp3');
|
||||
}
|
||||
|
||||
function setup() {
|
||||
createCanvas(800, 800);
|
||||
fft = new p5.FFT(0.8, 512);
|
||||
fft.setInput(song);
|
||||
}
|
||||
|
||||
function mousePressed() {
|
||||
if (song.isPlaying()) {
|
||||
song.pause();
|
||||
} else {
|
||||
song.play();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Beat Detection (Simple)
|
||||
|
||||
```javascript
|
||||
let prevBass = 0;
|
||||
let beatThreshold = 30;
|
||||
let beatCooldown = 0;
|
||||
|
||||
function detectBeat() {
|
||||
let bass = fft.getEnergy('bass');
|
||||
let isBeat = bass - prevBass > beatThreshold && beatCooldown <= 0;
|
||||
prevBass = bass;
|
||||
if (isBeat) beatCooldown = 10; // frames
|
||||
beatCooldown--;
|
||||
return isBeat;
|
||||
}
|
||||
```
|
||||
|
||||
## Scroll-Driven Animation
|
||||
|
||||
```javascript
|
||||
let scrollProgress = 0;
|
||||
|
||||
function setup() {
|
||||
let canvas = createCanvas(windowWidth, windowHeight);
|
||||
canvas.style('position', 'fixed');
|
||||
// Make page scrollable
|
||||
document.body.style.height = '500vh';
|
||||
}
|
||||
|
||||
window.addEventListener('scroll', () => {
|
||||
let maxScroll = document.body.scrollHeight - window.innerHeight;
|
||||
scrollProgress = window.scrollY / maxScroll;
|
||||
});
|
||||
|
||||
function draw() {
|
||||
background(0);
|
||||
// Use scrollProgress (0 to 1) to drive animation
|
||||
let x = lerp(0, width, scrollProgress);
|
||||
ellipse(x, height/2, 50);
|
||||
}
|
||||
```
|
||||
|
||||
## Responsive Events
|
||||
|
||||
```javascript
|
||||
function windowResized() {
|
||||
resizeCanvas(windowWidth, windowHeight);
|
||||
// Recreate buffers
|
||||
bgLayer = createGraphics(width, height);
|
||||
// Recalculate layout
|
||||
recalculateLayout();
|
||||
}
|
||||
|
||||
// Visibility change (tab switching)
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
if (document.hidden) {
|
||||
noLoop(); // pause when tab not visible
|
||||
} else {
|
||||
loop();
|
||||
}
|
||||
});
|
||||
```
|
||||
300
skills/creative/p5js/references/shapes-and-geometry.md
Normal file
300
skills/creative/p5js/references/shapes-and-geometry.md
Normal file
@@ -0,0 +1,300 @@
|
||||
# Shapes and Geometry
|
||||
|
||||
## 2D Primitives
|
||||
|
||||
```javascript
|
||||
point(x, y);
|
||||
line(x1, y1, x2, y2);
|
||||
rect(x, y, w, h); // default: corner mode
|
||||
rect(x, y, w, h, r); // rounded corners
|
||||
rect(x, y, w, h, tl, tr, br, bl); // per-corner radius
|
||||
square(x, y, size);
|
||||
ellipse(x, y, w, h);
|
||||
circle(x, y, d); // diameter, not radius
|
||||
triangle(x1, y1, x2, y2, x3, y3);
|
||||
quad(x1, y1, x2, y2, x3, y3, x4, y4);
|
||||
arc(x, y, w, h, start, stop, mode); // mode: OPEN, CHORD, PIE
|
||||
```
|
||||
|
||||
### Drawing Modes
|
||||
|
||||
```javascript
|
||||
rectMode(CENTER); // x,y is center (default: CORNER)
|
||||
rectMode(CORNERS); // x1,y1 to x2,y2
|
||||
ellipseMode(CORNER); // x,y is top-left corner
|
||||
ellipseMode(CENTER); // default — x,y is center
|
||||
```
|
||||
|
||||
## Stroke and Fill
|
||||
|
||||
```javascript
|
||||
fill(r, g, b, a); // or fill(gray), fill('#hex'), fill(h, s, b) in HSB mode
|
||||
noFill();
|
||||
stroke(r, g, b, a);
|
||||
noStroke();
|
||||
strokeWeight(2);
|
||||
strokeCap(ROUND); // ROUND, SQUARE, PROJECT
|
||||
strokeJoin(ROUND); // ROUND, MITER, BEVEL
|
||||
```
|
||||
|
||||
## Custom Shapes with Vertices
|
||||
|
||||
### Basic vertex shape
|
||||
|
||||
```javascript
|
||||
beginShape();
|
||||
vertex(100, 100);
|
||||
vertex(200, 50);
|
||||
vertex(300, 100);
|
||||
vertex(250, 200);
|
||||
vertex(150, 200);
|
||||
endShape(CLOSE); // CLOSE connects last vertex to first
|
||||
```
|
||||
|
||||
### Shape modes
|
||||
|
||||
```javascript
|
||||
beginShape(); // default: polygon connecting all vertices
|
||||
beginShape(POINTS); // individual points
|
||||
beginShape(LINES); // pairs of vertices as lines
|
||||
beginShape(TRIANGLES); // triplets as triangles
|
||||
beginShape(TRIANGLE_FAN);
|
||||
beginShape(TRIANGLE_STRIP);
|
||||
beginShape(QUADS); // groups of 4
|
||||
beginShape(QUAD_STRIP);
|
||||
```
|
||||
|
||||
### Contours (holes in shapes)
|
||||
|
||||
```javascript
|
||||
beginShape();
|
||||
// outer shape
|
||||
vertex(100, 100);
|
||||
vertex(300, 100);
|
||||
vertex(300, 300);
|
||||
vertex(100, 300);
|
||||
// inner hole
|
||||
beginContour();
|
||||
vertex(150, 150);
|
||||
vertex(150, 250);
|
||||
vertex(250, 250);
|
||||
vertex(250, 150);
|
||||
endContour();
|
||||
endShape(CLOSE);
|
||||
```
|
||||
|
||||
## Bezier Curves
|
||||
|
||||
### Cubic Bezier
|
||||
|
||||
```javascript
|
||||
bezier(x1, y1, cx1, cy1, cx2, cy2, x2, y2);
|
||||
// x1,y1 = start point
|
||||
// cx1,cy1 = first control point
|
||||
// cx2,cy2 = second control point
|
||||
// x2,y2 = end point
|
||||
```
|
||||
|
||||
### Bezier in custom shapes
|
||||
|
||||
```javascript
|
||||
beginShape();
|
||||
vertex(100, 200);
|
||||
bezierVertex(150, 50, 250, 50, 300, 200);
|
||||
// control1, control2, endpoint
|
||||
endShape();
|
||||
```
|
||||
|
||||
### Quadratic Bezier
|
||||
|
||||
```javascript
|
||||
beginShape();
|
||||
vertex(100, 200);
|
||||
quadraticVertex(200, 50, 300, 200);
|
||||
// single control point + endpoint
|
||||
endShape();
|
||||
```
|
||||
|
||||
### Interpolation along Bezier
|
||||
|
||||
```javascript
|
||||
let x = bezierPoint(x1, cx1, cx2, x2, t); // t = 0..1
|
||||
let y = bezierPoint(y1, cy1, cy2, y2, t);
|
||||
let tx = bezierTangent(x1, cx1, cx2, x2, t); // tangent
|
||||
```
|
||||
|
||||
## Catmull-Rom Splines
|
||||
|
||||
```javascript
|
||||
curve(cpx1, cpy1, x1, y1, x2, y2, cpx2, cpy2);
|
||||
// cpx1,cpy1 = control point before start
|
||||
// x1,y1 = start point (visible)
|
||||
// x2,y2 = end point (visible)
|
||||
// cpx2,cpy2 = control point after end
|
||||
|
||||
curveVertex(x, y); // in beginShape() — smooth curve through all points
|
||||
curveTightness(0); // 0 = Catmull-Rom, 1 = straight lines, -1 = loose
|
||||
```
|
||||
|
||||
### Smooth curve through points
|
||||
|
||||
```javascript
|
||||
let points = [/* array of {x, y} */];
|
||||
beginShape();
|
||||
curveVertex(points[0].x, points[0].y); // repeat first for tangent
|
||||
for (let p of points) {
|
||||
curveVertex(p.x, p.y);
|
||||
}
|
||||
curveVertex(points[points.length-1].x, points[points.length-1].y); // repeat last
|
||||
endShape();
|
||||
```
|
||||
|
||||
## p5.Vector
|
||||
|
||||
Essential for physics, particle systems, and geometric computation.
|
||||
|
||||
```javascript
|
||||
let v = createVector(x, y);
|
||||
|
||||
// Arithmetic (modifies in place)
|
||||
v.add(other); // vector addition
|
||||
v.sub(other); // subtraction
|
||||
v.mult(scalar); // scale
|
||||
v.div(scalar); // inverse scale
|
||||
v.normalize(); // unit vector (length 1)
|
||||
v.limit(max); // cap magnitude
|
||||
v.setMag(len); // set exact magnitude
|
||||
|
||||
// Queries (non-destructive)
|
||||
v.mag(); // magnitude (length)
|
||||
v.magSq(); // squared magnitude (faster, no sqrt)
|
||||
v.heading(); // angle in radians
|
||||
v.dist(other); // distance to other vector
|
||||
v.dot(other); // dot product
|
||||
v.cross(other); // cross product (3D)
|
||||
v.angleBetween(other); // angle between vectors
|
||||
|
||||
// Static methods (return new vector)
|
||||
p5.Vector.add(a, b); // a + b → new vector
|
||||
p5.Vector.sub(a, b); // a - b → new vector
|
||||
p5.Vector.fromAngle(a); // unit vector at angle
|
||||
p5.Vector.random2D(); // random unit vector
|
||||
p5.Vector.lerp(a, b, t); // interpolate
|
||||
|
||||
// Copy
|
||||
let copy = v.copy();
|
||||
```
|
||||
|
||||
## Signed Distance Fields (2D)
|
||||
|
||||
SDFs return the distance from a point to the nearest edge of a shape. Negative inside, positive outside. Useful for smooth shapes, glow effects, boolean operations.
|
||||
|
||||
```javascript
|
||||
// Circle SDF
|
||||
function sdCircle(px, py, cx, cy, r) {
|
||||
return dist(px, py, cx, cy) - r;
|
||||
}
|
||||
|
||||
// Box SDF
|
||||
function sdBox(px, py, cx, cy, hw, hh) {
|
||||
let dx = abs(px - cx) - hw;
|
||||
let dy = abs(py - cy) - hh;
|
||||
return sqrt(max(dx, 0) ** 2 + max(dy, 0) ** 2) + min(max(dx, dy), 0);
|
||||
}
|
||||
|
||||
// Line segment SDF
|
||||
function sdSegment(px, py, ax, ay, bx, by) {
|
||||
let pa = createVector(px - ax, py - ay);
|
||||
let ba = createVector(bx - ax, by - ay);
|
||||
let t = constrain(pa.dot(ba) / ba.dot(ba), 0, 1);
|
||||
let closest = p5.Vector.add(createVector(ax, ay), p5.Vector.mult(ba, t));
|
||||
return dist(px, py, closest.x, closest.y);
|
||||
}
|
||||
|
||||
// Smooth boolean union
|
||||
function opSmoothUnion(d1, d2, k) {
|
||||
let h = constrain(0.5 + 0.5 * (d2 - d1) / k, 0, 1);
|
||||
return lerp(d2, d1, h) - k * h * (1 - h);
|
||||
}
|
||||
|
||||
// Rendering SDF as glow
|
||||
let d = sdCircle(x, y, width/2, height/2, 200);
|
||||
let glow = exp(-abs(d) * 0.02); // exponential falloff
|
||||
fill(glow * 255);
|
||||
```
|
||||
|
||||
## Useful Geometry Patterns
|
||||
|
||||
### Regular Polygon
|
||||
|
||||
```javascript
|
||||
function regularPolygon(cx, cy, r, sides) {
|
||||
beginShape();
|
||||
for (let i = 0; i < sides; i++) {
|
||||
let a = TWO_PI * i / sides - HALF_PI;
|
||||
vertex(cx + cos(a) * r, cy + sin(a) * r);
|
||||
}
|
||||
endShape(CLOSE);
|
||||
}
|
||||
```
|
||||
|
||||
### Star Shape
|
||||
|
||||
```javascript
|
||||
function star(cx, cy, r1, r2, npoints) {
|
||||
beginShape();
|
||||
let angle = TWO_PI / npoints;
|
||||
let halfAngle = angle / 2;
|
||||
for (let a = -HALF_PI; a < TWO_PI - HALF_PI; a += angle) {
|
||||
vertex(cx + cos(a) * r2, cy + sin(a) * r2);
|
||||
vertex(cx + cos(a + halfAngle) * r1, cy + sin(a + halfAngle) * r1);
|
||||
}
|
||||
endShape(CLOSE);
|
||||
}
|
||||
```
|
||||
|
||||
### Rounded Line (Capsule)
|
||||
|
||||
```javascript
|
||||
function capsule(x1, y1, x2, y2, weight) {
|
||||
strokeWeight(weight);
|
||||
strokeCap(ROUND);
|
||||
line(x1, y1, x2, y2);
|
||||
}
|
||||
```
|
||||
|
||||
### Soft Body / Blob
|
||||
|
||||
```javascript
|
||||
function blob(cx, cy, baseR, noiseScale, noiseOffset, detail = 64) {
|
||||
beginShape();
|
||||
for (let i = 0; i < detail; i++) {
|
||||
let a = TWO_PI * i / detail;
|
||||
let r = baseR + noise(cos(a) * noiseScale + noiseOffset,
|
||||
sin(a) * noiseScale + noiseOffset) * baseR * 0.4;
|
||||
vertex(cx + cos(a) * r, cy + sin(a) * r);
|
||||
}
|
||||
endShape(CLOSE);
|
||||
}
|
||||
```
|
||||
|
||||
## Clipping and Masking
|
||||
|
||||
```javascript
|
||||
// Clip shape — everything drawn after is masked by the clip shape
|
||||
beginClip();
|
||||
circle(width/2, height/2, 400);
|
||||
endClip();
|
||||
// Only content inside the circle is visible
|
||||
image(myImage, 0, 0);
|
||||
|
||||
// Or functional form
|
||||
clip(() => {
|
||||
circle(width/2, height/2, 400);
|
||||
});
|
||||
|
||||
// Erase mode — cut holes
|
||||
erase();
|
||||
circle(mouseX, mouseY, 100); // this area becomes transparent
|
||||
noErase();
|
||||
```
|
||||
532
skills/creative/p5js/references/troubleshooting.md
Normal file
532
skills/creative/p5js/references/troubleshooting.md
Normal file
@@ -0,0 +1,532 @@
|
||||
# Troubleshooting
|
||||
|
||||
## Performance
|
||||
|
||||
### Step Zero — Disable FES
|
||||
|
||||
The Friendly Error System (FES) adds massive overhead — up to 10x slowdown. Disable it in every production sketch:
|
||||
|
||||
```javascript
|
||||
// BEFORE any p5 code
|
||||
p5.disableFriendlyErrors = true;
|
||||
|
||||
// Or use p5.min.js instead of p5.js — FES is stripped from minified build
|
||||
```
|
||||
|
||||
### Step One — pixelDensity(1)
|
||||
|
||||
Retina/HiDPI displays default to 2x or 3x density, multiplying pixel count by 4-9x:
|
||||
|
||||
```javascript
|
||||
function setup() {
|
||||
pixelDensity(1); // force 1:1 — always do this first
|
||||
createCanvas(1920, 1080);
|
||||
}
|
||||
```
|
||||
|
||||
### Use Math.* in Hot Loops
|
||||
|
||||
p5's `sin()`, `cos()`, `random()`, `min()`, `max()`, `abs()` are wrapper functions with overhead. In hot loops (thousands of iterations per frame), use native `Math.*`:
|
||||
|
||||
```javascript
|
||||
// SLOW — p5 wrappers
|
||||
for (let p of particles) {
|
||||
let a = sin(p.angle);
|
||||
let d = dist(p.x, p.y, mx, my);
|
||||
}
|
||||
|
||||
// FAST — native Math
|
||||
for (let p of particles) {
|
||||
let a = Math.sin(p.angle);
|
||||
let dx = p.x - mx, dy = p.y - my;
|
||||
let dSq = dx * dx + dy * dy; // skip sqrt entirely
|
||||
}
|
||||
```
|
||||
|
||||
Use `magSq()` instead of `mag()` for distance comparisons — avoids expensive `sqrt()`.
|
||||
|
||||
### Diagnosis
|
||||
|
||||
Open Chrome DevTools > Performance tab > Record while sketch runs.
|
||||
|
||||
Common bottlenecks:
|
||||
1. **FES enabled** — 10x overhead on every p5 function call
|
||||
2. **pixelDensity > 1** — 4x pixel count, 4x slower
|
||||
3. **Too many draw calls** — thousands of `ellipse()`, `rect()` per frame
|
||||
4. **Large canvas + pixel operations** — `loadPixels()`/`updatePixels()` on 4K canvas
|
||||
5. **Unoptimized particle systems** — checking all-vs-all distances (O(n^2))
|
||||
6. **Memory leaks** — creating objects every frame without cleanup
|
||||
7. **Shader compilation** — calling `createShader()` in `draw()` instead of `setup()`
|
||||
8. **console.log() in draw()** — DOM write per frame, destroys performance
|
||||
9. **DOM manipulation in draw()** — layout thrashing (400-500x slower than canvas ops)
|
||||
|
||||
### Solutions
|
||||
|
||||
**Reduce draw calls:**
|
||||
```javascript
|
||||
// BAD: 10000 individual circles
|
||||
for (let p of particles) {
|
||||
ellipse(p.x, p.y, p.size);
|
||||
}
|
||||
|
||||
// GOOD: single shape with vertices
|
||||
beginShape(POINTS);
|
||||
for (let p of particles) {
|
||||
vertex(p.x, p.y);
|
||||
}
|
||||
endShape();
|
||||
|
||||
// BEST: direct pixel manipulation
|
||||
loadPixels();
|
||||
for (let p of particles) {
|
||||
let idx = 4 * (floor(p.y) * width + floor(p.x));
|
||||
pixels[idx] = p.r;
|
||||
pixels[idx+1] = p.g;
|
||||
pixels[idx+2] = p.b;
|
||||
pixels[idx+3] = 255;
|
||||
}
|
||||
updatePixels();
|
||||
```
|
||||
|
||||
**Spatial hashing for neighbor queries:**
|
||||
```javascript
|
||||
class SpatialHash {
|
||||
constructor(cellSize) {
|
||||
this.cellSize = cellSize;
|
||||
this.cells = new Map();
|
||||
}
|
||||
|
||||
clear() { this.cells.clear(); }
|
||||
|
||||
_key(x, y) {
|
||||
return `${floor(x / this.cellSize)},${floor(y / this.cellSize)}`;
|
||||
}
|
||||
|
||||
insert(obj) {
|
||||
let key = this._key(obj.pos.x, obj.pos.y);
|
||||
if (!this.cells.has(key)) this.cells.set(key, []);
|
||||
this.cells.get(key).push(obj);
|
||||
}
|
||||
|
||||
query(x, y, radius) {
|
||||
let results = [];
|
||||
let minCX = floor((x - radius) / this.cellSize);
|
||||
let maxCX = floor((x + radius) / this.cellSize);
|
||||
let minCY = floor((y - radius) / this.cellSize);
|
||||
let maxCY = floor((y + radius) / this.cellSize);
|
||||
|
||||
for (let cx = minCX; cx <= maxCX; cx++) {
|
||||
for (let cy = minCY; cy <= maxCY; cy++) {
|
||||
let key = `${cx},${cy}`;
|
||||
let cell = this.cells.get(key);
|
||||
if (cell) {
|
||||
for (let obj of cell) {
|
||||
if (dist(x, y, obj.pos.x, obj.pos.y) <= radius) {
|
||||
results.push(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Object pooling:**
|
||||
```javascript
|
||||
class ParticlePool {
|
||||
constructor(maxSize) {
|
||||
this.pool = [];
|
||||
this.active = [];
|
||||
for (let i = 0; i < maxSize; i++) {
|
||||
this.pool.push(new Particle(0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
spawn(x, y) {
|
||||
let p = this.pool.pop();
|
||||
if (p) {
|
||||
p.reset(x, y);
|
||||
this.active.push(p);
|
||||
}
|
||||
}
|
||||
|
||||
update() {
|
||||
for (let i = this.active.length - 1; i >= 0; i--) {
|
||||
this.active[i].update();
|
||||
if (this.active[i].isDead()) {
|
||||
this.pool.push(this.active.splice(i, 1)[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Throttle heavy operations:**
|
||||
```javascript
|
||||
// Only update flow field every N frames
|
||||
if (frameCount % 5 === 0) {
|
||||
flowField.update(frameCount * 0.001);
|
||||
}
|
||||
```
|
||||
|
||||
### Frame Rate Targets
|
||||
|
||||
| Context | Target | Acceptable |
|
||||
|---------|--------|------------|
|
||||
| Interactive sketch | 60fps | 30fps |
|
||||
| Ambient animation | 30fps | 20fps |
|
||||
| Export/recording | 30fps render | Any (offline) |
|
||||
| Mobile | 30fps | 20fps |
|
||||
|
||||
### Per-Pixel Rendering Budgets
|
||||
|
||||
Pixel-level operations (`loadPixels()` loops) are the most expensive common pattern. Budget depends on canvas size and computation per pixel.
|
||||
|
||||
| Canvas | Pixels | Simple noise (1 call) | fBM (4 octave) | Domain warp (3-layer fBM) |
|
||||
|--------|--------|----------------------|----------------|--------------------------|
|
||||
| 540x540 | 291K | ~5ms | ~20ms | ~80ms |
|
||||
| 1080x1080 | 1.17M | ~20ms | ~80ms | ~300ms+ |
|
||||
| 1920x1080 | 2.07M | ~35ms | ~140ms | ~500ms+ |
|
||||
| 3840x2160 | 8.3M | ~140ms | ~560ms | WILL CRASH |
|
||||
|
||||
**Rules of thumb:**
|
||||
- 1 `noise()` call per pixel at 1080x1080 = ~20ms/frame (OK at 30fps)
|
||||
- 4-octave fBM per pixel at 1080x1080 = ~80ms/frame (borderline)
|
||||
- Multi-layer domain warp at 1080x1080 = 300ms+ (too slow for real-time, fine for `noLoop()` export)
|
||||
- **Headless Chrome is 2-5x slower** than desktop Chrome for pixel ops
|
||||
|
||||
**Solution: render at lower resolution, fill blocks:**
|
||||
```javascript
|
||||
let step = 3; // render 1/9 of pixels, fill 3x3 blocks
|
||||
loadPixels();
|
||||
for (let y = 0; y < H; y += step) {
|
||||
for (let x = 0; x < W; x += step) {
|
||||
let v = expensiveNoise(x, y);
|
||||
for (let dy = 0; dy < step && y+dy < H; dy++)
|
||||
for (let dx = 0; dx < step && x+dx < W; dx++) {
|
||||
let i = 4 * ((y+dy) * W + (x+dx));
|
||||
pixels[i] = v; pixels[i+1] = v; pixels[i+2] = v; pixels[i+3] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
updatePixels();
|
||||
```
|
||||
|
||||
Step=2 gives 4x speedup. Step=3 gives 9x. Visible at 1080p but acceptable for video (motion hides it).
|
||||
|
||||
## Common Mistakes
|
||||
|
||||
### 1. Forgetting to reset blend mode
|
||||
|
||||
```javascript
|
||||
blendMode(ADD);
|
||||
image(glowLayer, 0, 0);
|
||||
// WRONG: everything after this is ADD blended
|
||||
blendMode(BLEND); // ALWAYS reset
|
||||
```
|
||||
|
||||
### 2. Creating objects in draw()
|
||||
|
||||
```javascript
|
||||
// BAD: creates new font object every frame
|
||||
function draw() {
|
||||
let f = loadFont('font.otf'); // NEVER load in draw()
|
||||
}
|
||||
|
||||
// GOOD: load in preload, use in draw
|
||||
let f;
|
||||
function preload() { f = loadFont('font.otf'); }
|
||||
```
|
||||
|
||||
### 3. Not using push()/pop() with transforms
|
||||
|
||||
```javascript
|
||||
// BAD: transforms accumulate
|
||||
translate(100, 0);
|
||||
rotate(0.1);
|
||||
ellipse(0, 0, 50);
|
||||
// Everything after this is also translated and rotated
|
||||
|
||||
// GOOD: isolated transforms
|
||||
push();
|
||||
translate(100, 0);
|
||||
rotate(0.1);
|
||||
ellipse(0, 0, 50);
|
||||
pop();
|
||||
```
|
||||
|
||||
### 4. Integer coordinates for crisp lines
|
||||
|
||||
```javascript
|
||||
// BLURRY: sub-pixel rendering
|
||||
line(10.5, 20.3, 100.7, 80.2);
|
||||
|
||||
// CRISP: integer + 0.5 for 1px lines
|
||||
line(10.5, 20.5, 100.5, 80.5); // on pixel boundary
|
||||
```
|
||||
|
||||
### 5. Pixel density confusion
|
||||
|
||||
```javascript
|
||||
// WRONG: assuming pixel array matches canvas dimensions
|
||||
loadPixels();
|
||||
let idx = 4 * (y * width + x); // wrong if pixelDensity > 1
|
||||
|
||||
// RIGHT: account for pixel density
|
||||
let d = pixelDensity();
|
||||
loadPixels();
|
||||
let idx = 4 * ((y * d) * (width * d) + (x * d));
|
||||
|
||||
// SIMPLEST: set pixelDensity(1) at the start
|
||||
```
|
||||
|
||||
### 6. Color mode confusion
|
||||
|
||||
```javascript
|
||||
// In HSB mode, fill(255) is NOT white
|
||||
colorMode(HSB, 360, 100, 100);
|
||||
fill(255); // This is hue=255, sat=100, bri=100 = vivid purple
|
||||
|
||||
// White in HSB:
|
||||
fill(0, 0, 100); // any hue, 0 saturation, 100 brightness
|
||||
|
||||
// Black in HSB:
|
||||
fill(0, 0, 0);
|
||||
```
|
||||
|
||||
### 7. WebGL origin is center
|
||||
|
||||
```javascript
|
||||
// In WEBGL mode, (0,0) is CENTER, not top-left
|
||||
function draw() {
|
||||
// This draws at the center, not the corner
|
||||
rect(0, 0, 100, 100);
|
||||
|
||||
// For top-left behavior:
|
||||
translate(-width/2, -height/2);
|
||||
rect(0, 0, 100, 100); // now at top-left
|
||||
}
|
||||
```
|
||||
|
||||
### 8. createGraphics cleanup
|
||||
|
||||
```javascript
|
||||
// BAD: memory leak — buffer never freed
|
||||
function draw() {
|
||||
let temp = createGraphics(width, height); // new buffer every frame!
|
||||
// ...
|
||||
}
|
||||
|
||||
// GOOD: create once, reuse
|
||||
let temp;
|
||||
function setup() {
|
||||
temp = createGraphics(width, height);
|
||||
}
|
||||
function draw() {
|
||||
temp.clear();
|
||||
// ... reuse temp
|
||||
}
|
||||
|
||||
// If you must create/destroy:
|
||||
temp.remove(); // explicitly free
|
||||
```
|
||||
|
||||
### 9. noise() returns 0-1, not -1 to 1
|
||||
|
||||
```javascript
|
||||
let n = noise(x); // 0.0 to 1.0 (biased toward 0.5)
|
||||
|
||||
// For -1 to 1 range:
|
||||
let n = noise(x) * 2 - 1;
|
||||
|
||||
// For a specific range:
|
||||
let n = map(noise(x), 0, 1, -100, 100);
|
||||
```
|
||||
|
||||
### 10. saveCanvas() in draw() saves every frame
|
||||
|
||||
```javascript
|
||||
// BAD: saves a PNG every single frame
|
||||
function draw() {
|
||||
// ... render ...
|
||||
saveCanvas('output', 'png'); // DON'T DO THIS
|
||||
}
|
||||
|
||||
// GOOD: save once via keyboard
|
||||
function keyPressed() {
|
||||
if (key === 's') saveCanvas('output', 'png');
|
||||
}
|
||||
|
||||
// GOOD: save once after rendering static piece
|
||||
function draw() {
|
||||
// ... render ...
|
||||
saveCanvas('output', 'png');
|
||||
noLoop(); // stop after saving
|
||||
}
|
||||
```
|
||||
|
||||
### 11. console.log() in draw()
|
||||
|
||||
```javascript
|
||||
// BAD: writes to DOM console every frame — massive overhead
|
||||
function draw() {
|
||||
console.log(particles.length); // 60 DOM writes/second
|
||||
}
|
||||
|
||||
// GOOD: log periodically or conditionally
|
||||
function draw() {
|
||||
if (frameCount % 60 === 0) console.log('FPS:', frameRate().toFixed(1));
|
||||
}
|
||||
```
|
||||
|
||||
### 12. DOM manipulation in draw()
|
||||
|
||||
```javascript
|
||||
// BAD: layout thrashing — 400-500x slower than canvas ops
|
||||
function draw() {
|
||||
document.getElementById('counter').innerText = frameCount;
|
||||
let el = document.querySelector('.info'); // DOM query per frame
|
||||
}
|
||||
|
||||
// GOOD: cache DOM refs, update infrequently
|
||||
let counterEl;
|
||||
function setup() { counterEl = document.getElementById('counter'); }
|
||||
function draw() {
|
||||
if (frameCount % 30 === 0) counterEl.innerText = frameCount;
|
||||
}
|
||||
```
|
||||
|
||||
### 13. Not disabling FES in production
|
||||
|
||||
```javascript
|
||||
// BAD: every p5 function call has error-checking overhead (up to 10x slower)
|
||||
function setup() { createCanvas(800, 800); }
|
||||
|
||||
// GOOD: disable before any p5 code
|
||||
p5.disableFriendlyErrors = true;
|
||||
function setup() { createCanvas(800, 800); }
|
||||
|
||||
// ALSO GOOD: use p5.min.js (FES stripped from minified build)
|
||||
```
|
||||
|
||||
## Browser Compatibility
|
||||
|
||||
### Safari Issues
|
||||
- WebGL shader precision: always declare `precision mediump float;`
|
||||
- `AudioContext` requires user gesture (`userStartAudio()`)
|
||||
- Some `blendMode()` options behave differently
|
||||
|
||||
### Firefox Issues
|
||||
- `textToPoints()` may return slightly different point counts
|
||||
- WebGL extensions may differ from Chrome
|
||||
- Color profile handling can shift colors
|
||||
|
||||
### Mobile Issues
|
||||
- Touch events need `return false` to prevent scroll
|
||||
- `devicePixelRatio` can be 2x or 3x — use `pixelDensity(1)` for performance
|
||||
- Smaller canvas recommended (720p or less)
|
||||
- Audio requires explicit user gesture to start
|
||||
|
||||
## CORS Issues
|
||||
|
||||
```javascript
|
||||
// Loading images/fonts from external URLs requires CORS headers
|
||||
// Local files need a server:
|
||||
// python3 -m http.server 8080
|
||||
|
||||
// Or use a CORS proxy for external resources (not recommended for production)
|
||||
```
|
||||
|
||||
## Memory Leaks
|
||||
|
||||
### Symptoms
|
||||
- Framerate degrading over time
|
||||
- Browser tab memory growing unbounded
|
||||
- Page becomes unresponsive after minutes
|
||||
|
||||
### Common Causes
|
||||
|
||||
```javascript
|
||||
// 1. Growing arrays
|
||||
let history = [];
|
||||
function draw() {
|
||||
history.push(someData); // grows forever
|
||||
}
|
||||
// FIX: cap the array
|
||||
if (history.length > 1000) history.shift();
|
||||
|
||||
// 2. Creating p5 objects in draw()
|
||||
function draw() {
|
||||
let v = createVector(0, 0); // allocation every frame
|
||||
}
|
||||
// FIX: reuse pre-allocated objects
|
||||
|
||||
// 3. Unreleased graphics buffers
|
||||
let layers = [];
|
||||
function reset() {
|
||||
for (let l of layers) l.remove(); // free old buffers
|
||||
layers = [];
|
||||
}
|
||||
|
||||
// 4. Event listener accumulation
|
||||
function setup() {
|
||||
// BAD: adds new listener every time setup runs
|
||||
window.addEventListener('resize', handler);
|
||||
}
|
||||
// FIX: use p5's built-in windowResized()
|
||||
```
|
||||
|
||||
## Debugging Tips
|
||||
|
||||
### Console Logging
|
||||
|
||||
```javascript
|
||||
// Log once (not every frame)
|
||||
if (frameCount === 1) {
|
||||
console.log('Canvas:', width, 'x', height);
|
||||
console.log('Pixel density:', pixelDensity());
|
||||
console.log('Renderer:', drawingContext.constructor.name);
|
||||
}
|
||||
|
||||
// Log periodically
|
||||
if (frameCount % 60 === 0) {
|
||||
console.log('FPS:', frameRate().toFixed(1));
|
||||
console.log('Particles:', particles.length);
|
||||
}
|
||||
```
|
||||
|
||||
### Visual Debugging
|
||||
|
||||
```javascript
|
||||
// Show frame rate
|
||||
function draw() {
|
||||
// ... your sketch ...
|
||||
if (CONFIG.debug) {
|
||||
fill(255, 0, 0);
|
||||
noStroke();
|
||||
textSize(14);
|
||||
textAlign(LEFT, TOP);
|
||||
text('FPS: ' + frameRate().toFixed(1), 10, 10);
|
||||
text('Particles: ' + particles.length, 10, 28);
|
||||
text('Frame: ' + frameCount, 10, 46);
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle debug with 'd' key
|
||||
function keyPressed() {
|
||||
if (key === 'd') CONFIG.debug = !CONFIG.debug;
|
||||
}
|
||||
```
|
||||
|
||||
### Isolating Issues
|
||||
|
||||
```javascript
|
||||
// Comment out layers to find the slow one
|
||||
function draw() {
|
||||
renderBackground(); // comment out to test
|
||||
// renderParticles(); // this might be slow
|
||||
// renderPostEffects(); // or this
|
||||
}
|
||||
```
|
||||
302
skills/creative/p5js/references/typography.md
Normal file
302
skills/creative/p5js/references/typography.md
Normal file
@@ -0,0 +1,302 @@
|
||||
# Typography
|
||||
|
||||
## Loading Fonts
|
||||
|
||||
### System Fonts
|
||||
|
||||
```javascript
|
||||
textFont('Helvetica');
|
||||
textFont('Georgia');
|
||||
textFont('monospace');
|
||||
```
|
||||
|
||||
### Custom Fonts (OTF/TTF/WOFF2)
|
||||
|
||||
```javascript
|
||||
let myFont;
|
||||
|
||||
function preload() {
|
||||
myFont = loadFont('path/to/font.otf');
|
||||
// Requires local server or CORS-enabled URL
|
||||
}
|
||||
|
||||
function setup() {
|
||||
textFont(myFont);
|
||||
}
|
||||
```
|
||||
|
||||
### Google Fonts via CSS
|
||||
|
||||
```html
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<script>
|
||||
function setup() {
|
||||
textFont('Inter');
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
Google Fonts work without `loadFont()` but only for `text()` — not for `textToPoints()`. For particle text, you need `loadFont()` with an OTF/TTF file.
|
||||
|
||||
## Text Rendering
|
||||
|
||||
### Basic Text
|
||||
|
||||
```javascript
|
||||
textSize(32);
|
||||
textAlign(CENTER, CENTER);
|
||||
text('Hello World', width/2, height/2);
|
||||
```
|
||||
|
||||
### Text Properties
|
||||
|
||||
```javascript
|
||||
textSize(48); // pixel size
|
||||
textAlign(LEFT, TOP); // horizontal: LEFT, CENTER, RIGHT
|
||||
// vertical: TOP, CENTER, BOTTOM, BASELINE
|
||||
textLeading(40); // line spacing (for multi-line text)
|
||||
textStyle(BOLD); // NORMAL, BOLD, ITALIC, BOLDITALIC
|
||||
textWrap(WORD); // WORD or CHAR (for text() with max width)
|
||||
```
|
||||
|
||||
### Text Metrics
|
||||
|
||||
```javascript
|
||||
let w = textWidth('Hello'); // pixel width of string
|
||||
let a = textAscent(); // height above baseline
|
||||
let d = textDescent(); // height below baseline
|
||||
let totalH = a + d; // full line height
|
||||
```
|
||||
|
||||
### Text Bounding Box
|
||||
|
||||
```javascript
|
||||
let bounds = myFont.textBounds('Hello', x, y, size);
|
||||
// bounds = { x, y, w, h }
|
||||
// Useful for positioning, collision, background rectangles
|
||||
```
|
||||
|
||||
### Multi-Line Text
|
||||
|
||||
```javascript
|
||||
// With max width — auto wraps
|
||||
textWrap(WORD);
|
||||
text('Long text that wraps within the given width', x, y, maxWidth);
|
||||
|
||||
// With max width AND height — clips
|
||||
text('Very long text', x, y, maxWidth, maxHeight);
|
||||
```
|
||||
|
||||
## textToPoints() — Text as Particles
|
||||
|
||||
Convert text outline to array of points. Requires a loaded font (OTF/TTF via `loadFont()`).
|
||||
|
||||
```javascript
|
||||
let font;
|
||||
let points;
|
||||
|
||||
function preload() {
|
||||
font = loadFont('font.otf'); // MUST be loadFont, not CSS
|
||||
}
|
||||
|
||||
function setup() {
|
||||
createCanvas(1200, 600);
|
||||
points = font.textToPoints('HELLO', 100, 400, 200, {
|
||||
sampleFactor: 0.1, // lower = more points (0.1-0.5 typical)
|
||||
simplifyThreshold: 0
|
||||
});
|
||||
}
|
||||
|
||||
function draw() {
|
||||
background(0);
|
||||
for (let pt of points) {
|
||||
let n = noise(pt.x * 0.01, pt.y * 0.01, frameCount * 0.01);
|
||||
fill(255, n * 255);
|
||||
noStroke();
|
||||
ellipse(pt.x + random(-2, 2), pt.y + random(-2, 2), 3);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Particle Text Class
|
||||
|
||||
```javascript
|
||||
class TextParticle {
|
||||
constructor(target) {
|
||||
this.target = createVector(target.x, target.y);
|
||||
this.pos = createVector(random(width), random(height));
|
||||
this.vel = createVector(0, 0);
|
||||
this.acc = createVector(0, 0);
|
||||
this.maxSpeed = 10;
|
||||
this.maxForce = 0.5;
|
||||
}
|
||||
|
||||
arrive() {
|
||||
let desired = p5.Vector.sub(this.target, this.pos);
|
||||
let d = desired.mag();
|
||||
let speed = d < 100 ? map(d, 0, 100, 0, this.maxSpeed) : this.maxSpeed;
|
||||
desired.setMag(speed);
|
||||
let steer = p5.Vector.sub(desired, this.vel);
|
||||
steer.limit(this.maxForce);
|
||||
this.acc.add(steer);
|
||||
}
|
||||
|
||||
flee(target, radius) {
|
||||
let d = this.pos.dist(target);
|
||||
if (d < radius) {
|
||||
let desired = p5.Vector.sub(this.pos, target);
|
||||
desired.setMag(this.maxSpeed);
|
||||
let steer = p5.Vector.sub(desired, this.vel);
|
||||
steer.limit(this.maxForce * 2);
|
||||
this.acc.add(steer);
|
||||
}
|
||||
}
|
||||
|
||||
update() {
|
||||
this.vel.add(this.acc);
|
||||
this.vel.limit(this.maxSpeed);
|
||||
this.pos.add(this.vel);
|
||||
this.acc.mult(0);
|
||||
}
|
||||
|
||||
display() {
|
||||
fill(255);
|
||||
noStroke();
|
||||
ellipse(this.pos.x, this.pos.y, 3);
|
||||
}
|
||||
}
|
||||
|
||||
// Usage: particles form text, scatter from mouse
|
||||
let textParticles = [];
|
||||
for (let pt of points) {
|
||||
textParticles.push(new TextParticle(pt));
|
||||
}
|
||||
|
||||
function draw() {
|
||||
background(0);
|
||||
for (let p of textParticles) {
|
||||
p.arrive();
|
||||
p.flee(createVector(mouseX, mouseY), 80);
|
||||
p.update();
|
||||
p.display();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Kinetic Typography
|
||||
|
||||
### Wave Text
|
||||
|
||||
```javascript
|
||||
function waveText(str, x, y, size, amplitude, frequency) {
|
||||
textSize(size);
|
||||
textAlign(LEFT, BASELINE);
|
||||
let xOff = 0;
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
let yOff = sin(frameCount * 0.05 + i * frequency) * amplitude;
|
||||
text(str[i], x + xOff, y + yOff);
|
||||
xOff += textWidth(str[i]);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Typewriter Effect
|
||||
|
||||
```javascript
|
||||
class Typewriter {
|
||||
constructor(str, x, y, speed = 50) {
|
||||
this.str = str;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.speed = speed; // ms per character
|
||||
this.startTime = millis();
|
||||
this.cursor = true;
|
||||
}
|
||||
|
||||
display() {
|
||||
let elapsed = millis() - this.startTime;
|
||||
let chars = min(floor(elapsed / this.speed), this.str.length);
|
||||
let visible = this.str.substring(0, chars);
|
||||
|
||||
textAlign(LEFT, TOP);
|
||||
text(visible, this.x, this.y);
|
||||
|
||||
// Blinking cursor
|
||||
if (chars < this.str.length && floor(millis() / 500) % 2 === 0) {
|
||||
let cursorX = this.x + textWidth(visible);
|
||||
line(cursorX, this.y, cursorX, this.y + textAscent() + textDescent());
|
||||
}
|
||||
}
|
||||
|
||||
isDone() { return millis() - this.startTime >= this.str.length * this.speed; }
|
||||
}
|
||||
```
|
||||
|
||||
### Character-by-Character Animation
|
||||
|
||||
```javascript
|
||||
function animatedText(str, x, y, size, delay = 50) {
|
||||
textSize(size);
|
||||
textAlign(LEFT, BASELINE);
|
||||
let xOff = 0;
|
||||
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
let charStart = i * delay;
|
||||
let t = constrain((millis() - charStart) / 500, 0, 1);
|
||||
let et = easeOutElastic(t);
|
||||
|
||||
push();
|
||||
translate(x + xOff, y);
|
||||
scale(et);
|
||||
let alpha = t * 255;
|
||||
fill(255, alpha);
|
||||
text(str[i], 0, 0);
|
||||
pop();
|
||||
|
||||
xOff += textWidth(str[i]);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Text as Mask
|
||||
|
||||
```javascript
|
||||
let textBuffer;
|
||||
|
||||
function setup() {
|
||||
createCanvas(800, 800);
|
||||
textBuffer = createGraphics(width, height);
|
||||
textBuffer.background(0);
|
||||
textBuffer.fill(255);
|
||||
textBuffer.textSize(200);
|
||||
textBuffer.textAlign(CENTER, CENTER);
|
||||
textBuffer.text('MASK', width/2, height/2);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// Draw content
|
||||
background(0);
|
||||
// ... render something colorful
|
||||
|
||||
// Apply text mask (show content only where text is white)
|
||||
loadPixels();
|
||||
textBuffer.loadPixels();
|
||||
for (let i = 0; i < pixels.length; i += 4) {
|
||||
let maskVal = textBuffer.pixels[i]; // white = show, black = hide
|
||||
pixels[i + 3] = maskVal; // set alpha from mask
|
||||
}
|
||||
updatePixels();
|
||||
}
|
||||
```
|
||||
|
||||
## Responsive Text Sizing
|
||||
|
||||
```javascript
|
||||
function responsiveTextSize(baseSize, baseWidth = 1920) {
|
||||
return baseSize * (width / baseWidth);
|
||||
}
|
||||
|
||||
// Usage
|
||||
textSize(responsiveTextSize(48));
|
||||
text('Scales with canvas', width/2, height/2);
|
||||
```
|
||||
895
skills/creative/p5js/references/visual-effects.md
Normal file
895
skills/creative/p5js/references/visual-effects.md
Normal file
@@ -0,0 +1,895 @@
|
||||
# Visual Effects
|
||||
|
||||
## Noise
|
||||
|
||||
### Perlin Noise Basics
|
||||
|
||||
```javascript
|
||||
noiseSeed(42);
|
||||
noiseDetail(4, 0.5); // octaves, falloff
|
||||
|
||||
// 1D noise — smooth undulation
|
||||
let y = noise(x * 0.01); // returns 0.0 to 1.0
|
||||
|
||||
// 2D noise — terrain/texture
|
||||
let v = noise(x * 0.005, y * 0.005);
|
||||
|
||||
// 3D noise — animated 2D field (z = time)
|
||||
let v = noise(x * 0.005, y * 0.005, frameCount * 0.005);
|
||||
```
|
||||
|
||||
The scale factor (0.005 etc.) is critical:
|
||||
- `0.001` — very smooth, large features
|
||||
- `0.005` — smooth, medium features
|
||||
- `0.01` — standard generative art scale
|
||||
- `0.05` — detailed, small features
|
||||
- `0.1` — near-random, grainy
|
||||
|
||||
### Fractal Brownian Motion (fBM)
|
||||
|
||||
Layered noise octaves for natural-looking texture. Each octave adds detail at smaller scale.
|
||||
|
||||
```javascript
|
||||
function fbm(x, y, octaves = 6, lacunarity = 2.0, gain = 0.5) {
|
||||
let value = 0;
|
||||
let amplitude = 1.0;
|
||||
let frequency = 1.0;
|
||||
let maxValue = 0;
|
||||
for (let i = 0; i < octaves; i++) {
|
||||
value += noise(x * frequency, y * frequency) * amplitude;
|
||||
maxValue += amplitude;
|
||||
amplitude *= gain;
|
||||
frequency *= lacunarity;
|
||||
}
|
||||
return value / maxValue;
|
||||
}
|
||||
```
|
||||
|
||||
### Domain Warping
|
||||
|
||||
Feed noise output back as input coordinates for flowing organic distortion.
|
||||
|
||||
```javascript
|
||||
function domainWarp(x, y, scale, strength, time) {
|
||||
// First warp pass
|
||||
let qx = fbm(x + 0.0, y + 0.0);
|
||||
let qy = fbm(x + 5.2, y + 1.3);
|
||||
|
||||
// Second warp pass (feed back)
|
||||
let rx = fbm(x + strength * qx + 1.7, y + strength * qy + 9.2, 4, 2, 0.5);
|
||||
let ry = fbm(x + strength * qx + 8.3, y + strength * qy + 2.8, 4, 2, 0.5);
|
||||
|
||||
return fbm(x + strength * rx + time, y + strength * ry + time);
|
||||
}
|
||||
```
|
||||
|
||||
### Curl Noise
|
||||
|
||||
Divergence-free noise field. Particles following curl noise never converge or diverge — they flow in smooth, swirling patterns.
|
||||
|
||||
```javascript
|
||||
function curlNoise(x, y, scale, time) {
|
||||
let eps = 0.001;
|
||||
// Partial derivatives via finite differences
|
||||
let dndx = (noise(x * scale + eps, y * scale, time) -
|
||||
noise(x * scale - eps, y * scale, time)) / (2 * eps);
|
||||
let dndy = (noise(x * scale, y * scale + eps, time) -
|
||||
noise(x * scale, y * scale - eps, time)) / (2 * eps);
|
||||
// Curl = perpendicular to gradient
|
||||
return createVector(dndy, -dndx);
|
||||
}
|
||||
```
|
||||
|
||||
## Flow Fields
|
||||
|
||||
A grid of vectors that steer particles. The foundational generative art technique.
|
||||
|
||||
```javascript
|
||||
class FlowField {
|
||||
constructor(resolution, noiseScale) {
|
||||
this.resolution = resolution;
|
||||
this.cols = ceil(width / resolution);
|
||||
this.rows = ceil(height / resolution);
|
||||
this.field = new Array(this.cols * this.rows);
|
||||
this.noiseScale = noiseScale;
|
||||
}
|
||||
|
||||
update(time) {
|
||||
for (let i = 0; i < this.cols; i++) {
|
||||
for (let j = 0; j < this.rows; j++) {
|
||||
let angle = noise(i * this.noiseScale, j * this.noiseScale, time) * TWO_PI * 2;
|
||||
this.field[i + j * this.cols] = p5.Vector.fromAngle(angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lookup(x, y) {
|
||||
let col = constrain(floor(x / this.resolution), 0, this.cols - 1);
|
||||
let row = constrain(floor(y / this.resolution), 0, this.rows - 1);
|
||||
return this.field[col + row * this.cols].copy();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Flow Field Particle
|
||||
|
||||
```javascript
|
||||
class FlowParticle {
|
||||
constructor(x, y) {
|
||||
this.pos = createVector(x, y);
|
||||
this.vel = createVector(0, 0);
|
||||
this.acc = createVector(0, 0);
|
||||
this.prev = this.pos.copy();
|
||||
this.maxSpeed = 2;
|
||||
this.life = 1.0;
|
||||
}
|
||||
|
||||
follow(field) {
|
||||
let force = field.lookup(this.pos.x, this.pos.y);
|
||||
force.mult(0.5); // force magnitude
|
||||
this.acc.add(force);
|
||||
}
|
||||
|
||||
update() {
|
||||
this.prev = this.pos.copy();
|
||||
this.vel.add(this.acc);
|
||||
this.vel.limit(this.maxSpeed);
|
||||
this.pos.add(this.vel);
|
||||
this.acc.mult(0);
|
||||
this.life -= 0.001;
|
||||
}
|
||||
|
||||
edges() {
|
||||
if (this.pos.x > width) this.pos.x = 0;
|
||||
if (this.pos.x < 0) this.pos.x = width;
|
||||
if (this.pos.y > height) this.pos.y = 0;
|
||||
if (this.pos.y < 0) this.pos.y = height;
|
||||
this.prev = this.pos.copy(); // prevent wrap line
|
||||
}
|
||||
|
||||
display(buffer) {
|
||||
buffer.stroke(255, this.life * 30);
|
||||
buffer.strokeWeight(0.5);
|
||||
buffer.line(this.prev.x, this.prev.y, this.pos.x, this.pos.y);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Particle Systems
|
||||
|
||||
### Basic Physics Particle
|
||||
|
||||
```javascript
|
||||
class Particle {
|
||||
constructor(x, y) {
|
||||
this.pos = createVector(x, y);
|
||||
this.vel = p5.Vector.random2D().mult(random(1, 3));
|
||||
this.acc = createVector(0, 0);
|
||||
this.life = 255;
|
||||
this.decay = random(1, 5);
|
||||
this.size = random(3, 8);
|
||||
}
|
||||
|
||||
applyForce(f) { this.acc.add(f); }
|
||||
|
||||
update() {
|
||||
this.vel.add(this.acc);
|
||||
this.pos.add(this.vel);
|
||||
this.acc.mult(0);
|
||||
this.life -= this.decay;
|
||||
}
|
||||
|
||||
display() {
|
||||
noStroke();
|
||||
fill(255, this.life);
|
||||
ellipse(this.pos.x, this.pos.y, this.size);
|
||||
}
|
||||
|
||||
isDead() { return this.life <= 0; }
|
||||
}
|
||||
```
|
||||
|
||||
### Attractor-Driven Particles
|
||||
|
||||
```javascript
|
||||
class Attractor {
|
||||
constructor(x, y, strength) {
|
||||
this.pos = createVector(x, y);
|
||||
this.strength = strength;
|
||||
}
|
||||
|
||||
attract(particle) {
|
||||
let force = p5.Vector.sub(this.pos, particle.pos);
|
||||
let d = constrain(force.mag(), 5, 200);
|
||||
force.normalize();
|
||||
force.mult(this.strength / (d * d));
|
||||
particle.applyForce(force);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Boid Flocking
|
||||
|
||||
```javascript
|
||||
class Boid {
|
||||
constructor(x, y) {
|
||||
this.pos = createVector(x, y);
|
||||
this.vel = p5.Vector.random2D().mult(random(2, 4));
|
||||
this.acc = createVector(0, 0);
|
||||
this.maxForce = 0.2;
|
||||
this.maxSpeed = 4;
|
||||
this.perceptionRadius = 50;
|
||||
}
|
||||
|
||||
flock(boids) {
|
||||
let alignment = createVector(0, 0);
|
||||
let cohesion = createVector(0, 0);
|
||||
let separation = createVector(0, 0);
|
||||
let total = 0;
|
||||
|
||||
for (let other of boids) {
|
||||
let d = this.pos.dist(other.pos);
|
||||
if (other !== this && d < this.perceptionRadius) {
|
||||
alignment.add(other.vel);
|
||||
cohesion.add(other.pos);
|
||||
let diff = p5.Vector.sub(this.pos, other.pos);
|
||||
diff.div(d * d);
|
||||
separation.add(diff);
|
||||
total++;
|
||||
}
|
||||
}
|
||||
if (total > 0) {
|
||||
alignment.div(total).setMag(this.maxSpeed).sub(this.vel).limit(this.maxForce);
|
||||
cohesion.div(total).sub(this.pos).setMag(this.maxSpeed).sub(this.vel).limit(this.maxForce);
|
||||
separation.div(total).setMag(this.maxSpeed).sub(this.vel).limit(this.maxForce);
|
||||
}
|
||||
|
||||
this.acc.add(alignment.mult(1.0));
|
||||
this.acc.add(cohesion.mult(1.0));
|
||||
this.acc.add(separation.mult(1.5));
|
||||
}
|
||||
|
||||
update() {
|
||||
this.vel.add(this.acc);
|
||||
this.vel.limit(this.maxSpeed);
|
||||
this.pos.add(this.vel);
|
||||
this.acc.mult(0);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Pixel Manipulation
|
||||
|
||||
### Reading and Writing Pixels
|
||||
|
||||
```javascript
|
||||
loadPixels();
|
||||
for (let y = 0; y < height; y++) {
|
||||
for (let x = 0; x < width; x++) {
|
||||
let idx = 4 * (y * width + x);
|
||||
let r = pixels[idx];
|
||||
let g = pixels[idx + 1];
|
||||
let b = pixels[idx + 2];
|
||||
let a = pixels[idx + 3];
|
||||
|
||||
// Modify
|
||||
pixels[idx] = 255 - r; // invert red
|
||||
pixels[idx + 1] = 255 - g; // invert green
|
||||
pixels[idx + 2] = 255 - b; // invert blue
|
||||
}
|
||||
}
|
||||
updatePixels();
|
||||
```
|
||||
|
||||
### Pixel-Level Noise Texture
|
||||
|
||||
```javascript
|
||||
loadPixels();
|
||||
for (let i = 0; i < pixels.length; i += 4) {
|
||||
let x = (i / 4) % width;
|
||||
let y = floor((i / 4) / width);
|
||||
let n = noise(x * 0.01, y * 0.01, frameCount * 0.02);
|
||||
let c = n * 255;
|
||||
pixels[i] = c;
|
||||
pixels[i + 1] = c;
|
||||
pixels[i + 2] = c;
|
||||
pixels[i + 3] = 255;
|
||||
}
|
||||
updatePixels();
|
||||
```
|
||||
|
||||
### Built-in Filters
|
||||
|
||||
```javascript
|
||||
filter(BLUR, 3); // Gaussian blur (radius)
|
||||
filter(THRESHOLD, 0.5); // Black/white threshold
|
||||
filter(INVERT); // Color inversion
|
||||
filter(POSTERIZE, 4); // Reduce color levels
|
||||
filter(GRAY); // Desaturate
|
||||
filter(ERODE); // Thin bright areas
|
||||
filter(DILATE); // Expand bright areas
|
||||
filter(OPAQUE); // Remove transparency
|
||||
```
|
||||
|
||||
## Texture Generation
|
||||
|
||||
### Stippling / Pointillism
|
||||
|
||||
```javascript
|
||||
function stipple(buffer, density, minSize, maxSize) {
|
||||
buffer.loadPixels();
|
||||
for (let i = 0; i < density; i++) {
|
||||
let x = floor(random(width));
|
||||
let y = floor(random(height));
|
||||
let idx = 4 * (y * width + x);
|
||||
let brightness = (buffer.pixels[idx] + buffer.pixels[idx+1] + buffer.pixels[idx+2]) / 3;
|
||||
let size = map(brightness, 0, 255, maxSize, minSize);
|
||||
if (random() < map(brightness, 0, 255, 0.8, 0.1)) {
|
||||
noStroke();
|
||||
fill(buffer.pixels[idx], buffer.pixels[idx+1], buffer.pixels[idx+2]);
|
||||
ellipse(x, y, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Halftone
|
||||
|
||||
```javascript
|
||||
function halftone(sourceBuffer, dotSpacing, maxDotSize) {
|
||||
sourceBuffer.loadPixels();
|
||||
background(255);
|
||||
fill(0);
|
||||
noStroke();
|
||||
for (let y = 0; y < height; y += dotSpacing) {
|
||||
for (let x = 0; x < width; x += dotSpacing) {
|
||||
let idx = 4 * (y * width + x);
|
||||
let brightness = (sourceBuffer.pixels[idx] + sourceBuffer.pixels[idx+1] + sourceBuffer.pixels[idx+2]) / 3;
|
||||
let dotSize = map(brightness, 0, 255, maxDotSize, 0);
|
||||
ellipse(x + dotSpacing/2, y + dotSpacing/2, dotSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Cross-Hatching
|
||||
|
||||
```javascript
|
||||
function crossHatch(x, y, w, h, value, spacing) {
|
||||
// value: 0 (dark) to 1 (light)
|
||||
let numLayers = floor(map(value, 0, 1, 4, 0));
|
||||
let angles = [PI/4, -PI/4, 0, PI/2];
|
||||
|
||||
for (let layer = 0; layer < numLayers; layer++) {
|
||||
push();
|
||||
translate(x + w/2, y + h/2);
|
||||
rotate(angles[layer]);
|
||||
let s = spacing + layer * 2;
|
||||
for (let i = -max(w, h); i < max(w, h); i += s) {
|
||||
line(i, -max(w, h), i, max(w, h));
|
||||
}
|
||||
pop();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Feedback Loops
|
||||
|
||||
### Frame Feedback (Echo/Trail)
|
||||
|
||||
```javascript
|
||||
let feedback;
|
||||
|
||||
function setup() {
|
||||
createCanvas(800, 800);
|
||||
feedback = createGraphics(width, height);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// Copy current feedback, slightly zoomed and rotated
|
||||
let temp = feedback.get();
|
||||
|
||||
feedback.push();
|
||||
feedback.translate(width/2, height/2);
|
||||
feedback.scale(1.005); // slow zoom
|
||||
feedback.rotate(0.002); // slow rotation
|
||||
feedback.translate(-width/2, -height/2);
|
||||
feedback.tint(255, 245); // slight fade
|
||||
feedback.image(temp, 0, 0);
|
||||
feedback.pop();
|
||||
|
||||
// Draw new content to feedback
|
||||
feedback.noStroke();
|
||||
feedback.fill(255);
|
||||
feedback.ellipse(mouseX, mouseY, 20);
|
||||
|
||||
// Show
|
||||
image(feedback, 0, 0);
|
||||
}
|
||||
```
|
||||
|
||||
### Bloom / Glow (Post-Processing)
|
||||
|
||||
Downsample the scene to a small buffer, blur it, overlay additively. Creates soft glow around bright areas. This is the standard generative art bloom technique.
|
||||
|
||||
```javascript
|
||||
let scene, bloomBuf;
|
||||
|
||||
function setup() {
|
||||
createCanvas(1080, 1080);
|
||||
scene = createGraphics(width, height);
|
||||
bloomBuf = createGraphics(width, height);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// 1. Render scene to offscreen buffer
|
||||
scene.background(0);
|
||||
scene.fill(255, 200, 100);
|
||||
scene.noStroke();
|
||||
// ... draw bright elements to scene ...
|
||||
|
||||
// 2. Build bloom: downsample → blur → upscale
|
||||
bloomBuf.clear();
|
||||
bloomBuf.image(scene, 0, 0, width / 4, height / 4); // 4x downsample
|
||||
bloomBuf.filter(BLUR, 6); // blur the small version
|
||||
|
||||
// 3. Composite: scene + additive bloom
|
||||
background(0);
|
||||
image(scene, 0, 0); // base layer
|
||||
blendMode(ADD); // additive = glow
|
||||
tint(255, 80); // control bloom intensity (0-255)
|
||||
image(bloomBuf, 0, 0, width, height); // upscale back to full size
|
||||
noTint();
|
||||
blendMode(BLEND); // ALWAYS reset blend mode
|
||||
}
|
||||
```
|
||||
|
||||
**Tuning:**
|
||||
- Downsample ratio (1/4 is standard, 1/8 for softer, 1/2 for tighter)
|
||||
- Blur radius (4-8 typical, higher = wider glow)
|
||||
- Tint alpha (40-120, controls glow intensity)
|
||||
- Update bloom every N frames to save perf: `if (frameCount % 2 === 0) { ... }`
|
||||
|
||||
**Common mistake:** Forgetting `blendMode(BLEND)` after the ADD pass — everything drawn after will be additive.
|
||||
|
||||
### Trail Buffer Brightness
|
||||
|
||||
Trail accumulation via `createGraphics()` + semi-transparent fade rect is the standard technique for particle trails, but **trails are always dimmer than you expect**. The fade rect's alpha compounds multiplicatively every frame.
|
||||
|
||||
```javascript
|
||||
// The fade rect alpha controls trail length AND brightness:
|
||||
trailBuf.fill(0, 0, 0, alpha);
|
||||
trailBuf.rect(0, 0, width, height);
|
||||
|
||||
// alpha=5 → very long trails, very dim (content fades to 50% in ~35 frames)
|
||||
// alpha=10 → long trails, dim
|
||||
// alpha=20 → medium trails, visible
|
||||
// alpha=40 → short trails, bright
|
||||
// alpha=80 → very short trails, crisp
|
||||
```
|
||||
|
||||
**The trap:** You set alpha=5 for long trails, but particle strokes at alpha=30 are invisible because they fade before accumulating enough density. Either:
|
||||
- **Boost stroke alpha** to 80-150 (not the intuitive 20-40)
|
||||
- **Reduce fade alpha** but accept shorter trails
|
||||
- **Use additive blending** for the strokes: bright particles accumulate, dim ones stay dark
|
||||
|
||||
```javascript
|
||||
// WRONG: low fade + low stroke = invisible
|
||||
trailBuf.fill(0, 0, 0, 5); // long trails
|
||||
trailBuf.rect(0, 0, W, H);
|
||||
trailBuf.stroke(255, 30); // too dim to ever accumulate
|
||||
trailBuf.line(px, py, x, y);
|
||||
|
||||
// RIGHT: low fade + high stroke = visible long trails
|
||||
trailBuf.fill(0, 0, 0, 5);
|
||||
trailBuf.rect(0, 0, W, H);
|
||||
trailBuf.stroke(255, 100); // bright enough to persist through fade
|
||||
trailBuf.line(px, py, x, y);
|
||||
```
|
||||
|
||||
### Reaction-Diffusion (Gray-Scott)
|
||||
|
||||
```javascript
|
||||
class ReactionDiffusion {
|
||||
constructor(w, h) {
|
||||
this.w = w;
|
||||
this.h = h;
|
||||
this.a = new Float32Array(w * h).fill(1);
|
||||
this.b = new Float32Array(w * h).fill(0);
|
||||
this.nextA = new Float32Array(w * h);
|
||||
this.nextB = new Float32Array(w * h);
|
||||
this.dA = 1.0;
|
||||
this.dB = 0.5;
|
||||
this.feed = 0.055;
|
||||
this.kill = 0.062;
|
||||
}
|
||||
|
||||
seed(cx, cy, r) {
|
||||
for (let y = cy - r; y < cy + r; y++) {
|
||||
for (let x = cx - r; x < cx + r; x++) {
|
||||
if (dist(x, y, cx, cy) < r) {
|
||||
let idx = y * this.w + x;
|
||||
this.b[idx] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
step() {
|
||||
for (let y = 1; y < this.h - 1; y++) {
|
||||
for (let x = 1; x < this.w - 1; x++) {
|
||||
let idx = y * this.w + x;
|
||||
let a = this.a[idx], b = this.b[idx];
|
||||
let lapA = this.laplacian(this.a, x, y);
|
||||
let lapB = this.laplacian(this.b, x, y);
|
||||
let abb = a * b * b;
|
||||
this.nextA[idx] = constrain(a + this.dA * lapA - abb + this.feed * (1 - a), 0, 1);
|
||||
this.nextB[idx] = constrain(b + this.dB * lapB + abb - (this.kill + this.feed) * b, 0, 1);
|
||||
}
|
||||
}
|
||||
[this.a, this.nextA] = [this.nextA, this.a];
|
||||
[this.b, this.nextB] = [this.nextB, this.b];
|
||||
}
|
||||
|
||||
laplacian(arr, x, y) {
|
||||
let w = this.w;
|
||||
return arr[(y-1)*w+x] + arr[(y+1)*w+x] + arr[y*w+(x-1)] + arr[y*w+(x+1)]
|
||||
- 4 * arr[y*w+x];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Pixel Sorting
|
||||
|
||||
```javascript
|
||||
function pixelSort(buffer, threshold, direction = 'horizontal') {
|
||||
buffer.loadPixels();
|
||||
let px = buffer.pixels;
|
||||
|
||||
if (direction === 'horizontal') {
|
||||
for (let y = 0; y < height; y++) {
|
||||
let spans = findSpans(px, y, width, threshold, true);
|
||||
for (let span of spans) {
|
||||
sortSpan(px, span.start, span.end, y, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
buffer.updatePixels();
|
||||
}
|
||||
|
||||
function findSpans(px, row, w, threshold, horizontal) {
|
||||
let spans = [];
|
||||
let start = -1;
|
||||
for (let i = 0; i < w; i++) {
|
||||
let idx = horizontal ? 4 * (row * w + i) : 4 * (i * w + row);
|
||||
let brightness = (px[idx] + px[idx+1] + px[idx+2]) / 3;
|
||||
if (brightness > threshold && start === -1) {
|
||||
start = i;
|
||||
} else if (brightness <= threshold && start !== -1) {
|
||||
spans.push({ start, end: i });
|
||||
start = -1;
|
||||
}
|
||||
}
|
||||
if (start !== -1) spans.push({ start, end: w });
|
||||
return spans;
|
||||
}
|
||||
```
|
||||
|
||||
## Advanced Generative Techniques
|
||||
|
||||
### L-Systems (Lindenmayer Systems)
|
||||
|
||||
Grammar-based recursive growth for trees, plants, fractals.
|
||||
|
||||
```javascript
|
||||
class LSystem {
|
||||
constructor(axiom, rules) {
|
||||
this.axiom = axiom;
|
||||
this.rules = rules; // { 'F': 'F[+F]F[-F]F' }
|
||||
this.sentence = axiom;
|
||||
}
|
||||
|
||||
generate(iterations) {
|
||||
for (let i = 0; i < iterations; i++) {
|
||||
let next = '';
|
||||
for (let ch of this.sentence) {
|
||||
next += this.rules[ch] || ch;
|
||||
}
|
||||
this.sentence = next;
|
||||
}
|
||||
}
|
||||
|
||||
draw(len, angle) {
|
||||
for (let ch of this.sentence) {
|
||||
switch (ch) {
|
||||
case 'F': line(0, 0, 0, -len); translate(0, -len); break;
|
||||
case '+': rotate(angle); break;
|
||||
case '-': rotate(-angle); break;
|
||||
case '[': push(); break;
|
||||
case ']': pop(); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Usage: fractal plant
|
||||
let lsys = new LSystem('X', {
|
||||
'X': 'F+[[X]-X]-F[-FX]+X',
|
||||
'F': 'FF'
|
||||
});
|
||||
lsys.generate(5);
|
||||
translate(width/2, height);
|
||||
lsys.draw(4, radians(25));
|
||||
```
|
||||
|
||||
### Circle Packing
|
||||
|
||||
Fill a space with non-overlapping circles of varying size.
|
||||
|
||||
```javascript
|
||||
class PackedCircle {
|
||||
constructor(x, y, r) {
|
||||
this.x = x; this.y = y; this.r = r;
|
||||
this.growing = true;
|
||||
}
|
||||
|
||||
grow() { if (this.growing) this.r += 0.5; }
|
||||
|
||||
overlaps(other) {
|
||||
let d = dist(this.x, this.y, other.x, other.y);
|
||||
return d < this.r + other.r + 2; // +2 gap
|
||||
}
|
||||
|
||||
atEdge() {
|
||||
return this.x - this.r < 0 || this.x + this.r > width ||
|
||||
this.y - this.r < 0 || this.y + this.r > height;
|
||||
}
|
||||
}
|
||||
|
||||
let circles = [];
|
||||
|
||||
function packStep() {
|
||||
// Try to place new circle
|
||||
for (let attempts = 0; attempts < 100; attempts++) {
|
||||
let x = random(width), y = random(height);
|
||||
let valid = true;
|
||||
for (let c of circles) {
|
||||
if (dist(x, y, c.x, c.y) < c.r + 2) { valid = false; break; }
|
||||
}
|
||||
if (valid) { circles.push(new PackedCircle(x, y, 1)); break; }
|
||||
}
|
||||
|
||||
// Grow existing circles
|
||||
for (let c of circles) {
|
||||
if (!c.growing) continue;
|
||||
c.grow();
|
||||
if (c.atEdge()) { c.growing = false; continue; }
|
||||
for (let other of circles) {
|
||||
if (c !== other && c.overlaps(other)) { c.growing = false; break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Voronoi Diagram (Fortune's Algorithm Approximation)
|
||||
|
||||
```javascript
|
||||
// Simple brute-force Voronoi (for small point counts)
|
||||
function drawVoronoi(points, colors) {
|
||||
loadPixels();
|
||||
for (let y = 0; y < height; y++) {
|
||||
for (let x = 0; x < width; x++) {
|
||||
let minDist = Infinity;
|
||||
let closest = 0;
|
||||
for (let i = 0; i < points.length; i++) {
|
||||
let d = (x - points[i].x) ** 2 + (y - points[i].y) ** 2; // magSq
|
||||
if (d < minDist) { minDist = d; closest = i; }
|
||||
}
|
||||
let idx = 4 * (y * width + x);
|
||||
let c = colors[closest % colors.length];
|
||||
pixels[idx] = red(c);
|
||||
pixels[idx+1] = green(c);
|
||||
pixels[idx+2] = blue(c);
|
||||
pixels[idx+3] = 255;
|
||||
}
|
||||
}
|
||||
updatePixels();
|
||||
}
|
||||
```
|
||||
|
||||
### Fractal Trees
|
||||
|
||||
```javascript
|
||||
function fractalTree(x, y, len, angle, depth, branchAngle) {
|
||||
if (depth <= 0 || len < 2) return;
|
||||
|
||||
let x2 = x + Math.cos(angle) * len;
|
||||
let y2 = y + Math.sin(angle) * len;
|
||||
|
||||
strokeWeight(map(depth, 0, 10, 0.5, 4));
|
||||
line(x, y, x2, y2);
|
||||
|
||||
let shrink = 0.67 + noise(x * 0.01, y * 0.01) * 0.15;
|
||||
fractalTree(x2, y2, len * shrink, angle - branchAngle, depth - 1, branchAngle);
|
||||
fractalTree(x2, y2, len * shrink, angle + branchAngle, depth - 1, branchAngle);
|
||||
}
|
||||
|
||||
// Usage
|
||||
fractalTree(width/2, height, 120, -HALF_PI, 10, PI/6);
|
||||
```
|
||||
|
||||
### Strange Attractors
|
||||
|
||||
```javascript
|
||||
// Clifford Attractor
|
||||
function cliffordAttractor(a, b, c, d, iterations) {
|
||||
let x = 0, y = 0;
|
||||
beginShape(POINTS);
|
||||
for (let i = 0; i < iterations; i++) {
|
||||
let nx = Math.sin(a * y) + c * Math.cos(a * x);
|
||||
let ny = Math.sin(b * x) + d * Math.cos(b * y);
|
||||
x = nx; y = ny;
|
||||
let px = map(x, -3, 3, 0, width);
|
||||
let py = map(y, -3, 3, 0, height);
|
||||
vertex(px, py);
|
||||
}
|
||||
endShape();
|
||||
}
|
||||
|
||||
// De Jong Attractor
|
||||
function deJongAttractor(a, b, c, d, iterations) {
|
||||
let x = 0, y = 0;
|
||||
beginShape(POINTS);
|
||||
for (let i = 0; i < iterations; i++) {
|
||||
let nx = Math.sin(a * y) - Math.cos(b * x);
|
||||
let ny = Math.sin(c * x) - Math.cos(d * y);
|
||||
x = nx; y = ny;
|
||||
let px = map(x, -2.5, 2.5, 0, width);
|
||||
let py = map(y, -2.5, 2.5, 0, height);
|
||||
vertex(px, py);
|
||||
}
|
||||
endShape();
|
||||
}
|
||||
```
|
||||
|
||||
### Poisson Disk Sampling
|
||||
|
||||
Even distribution that looks natural — better than pure random for placing elements.
|
||||
|
||||
```javascript
|
||||
function poissonDiskSampling(r, k = 30) {
|
||||
let cellSize = r / Math.sqrt(2);
|
||||
let cols = Math.ceil(width / cellSize);
|
||||
let rows = Math.ceil(height / cellSize);
|
||||
let grid = new Array(cols * rows).fill(-1);
|
||||
let points = [];
|
||||
let active = [];
|
||||
|
||||
function gridIndex(x, y) {
|
||||
return Math.floor(x / cellSize) + Math.floor(y / cellSize) * cols;
|
||||
}
|
||||
|
||||
// Seed
|
||||
let p0 = createVector(random(width), random(height));
|
||||
points.push(p0);
|
||||
active.push(p0);
|
||||
grid[gridIndex(p0.x, p0.y)] = 0;
|
||||
|
||||
while (active.length > 0) {
|
||||
let idx = Math.floor(Math.random() * active.length);
|
||||
let pos = active[idx];
|
||||
let found = false;
|
||||
|
||||
for (let n = 0; n < k; n++) {
|
||||
let angle = Math.random() * TWO_PI;
|
||||
let mag = r + Math.random() * r;
|
||||
let sample = createVector(pos.x + Math.cos(angle) * mag, pos.y + Math.sin(angle) * mag);
|
||||
|
||||
if (sample.x < 0 || sample.x >= width || sample.y < 0 || sample.y >= height) continue;
|
||||
|
||||
let col = Math.floor(sample.x / cellSize);
|
||||
let row = Math.floor(sample.y / cellSize);
|
||||
let ok = true;
|
||||
|
||||
for (let dy = -2; dy <= 2; dy++) {
|
||||
for (let dx = -2; dx <= 2; dx++) {
|
||||
let nc = col + dx, nr = row + dy;
|
||||
if (nc >= 0 && nc < cols && nr >= 0 && nr < rows) {
|
||||
let gi = nc + nr * cols;
|
||||
if (grid[gi] !== -1 && points[grid[gi]].dist(sample) < r) { ok = false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ok) {
|
||||
points.push(sample);
|
||||
active.push(sample);
|
||||
grid[gridIndex(sample.x, sample.y)] = points.length - 1;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) active.splice(idx, 1);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
```
|
||||
|
||||
## Addon Libraries
|
||||
|
||||
### p5.brush — Natural Media
|
||||
|
||||
Hand-drawn, organic aesthetics. Watercolor, charcoal, pen, marker. Requires **p5.js 2.x + WEBGL**.
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/p5.brush@latest/dist/p5.brush.js"></script>
|
||||
```
|
||||
|
||||
```javascript
|
||||
function setup() {
|
||||
createCanvas(1200, 1200, WEBGL);
|
||||
brush.scaleBrushes(3); // essential for proper sizing
|
||||
translate(-width/2, -height/2); // WEBGL origin is center
|
||||
brush.pick('2B'); // pencil brush
|
||||
brush.stroke(50, 50, 50);
|
||||
brush.strokeWeight(2);
|
||||
brush.line(100, 100, 500, 500);
|
||||
brush.pick('watercolor');
|
||||
brush.fill('#4a90d9', 150);
|
||||
brush.circle(400, 400, 200);
|
||||
}
|
||||
```
|
||||
|
||||
Built-in brushes: `2B`, `HB`, `2H`, `cpencil`, `pen`, `rotring`, `spray`, `marker`, `charcoal`, `hatch_brush`.
|
||||
Built-in vector fields: `hand`, `curved`, `zigzag`, `waves`, `seabed`, `spiral`, `columns`.
|
||||
|
||||
### p5.grain — Film Grain & Texture
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/p5.grain@0.7.0/p5.grain.min.js"></script>
|
||||
```
|
||||
|
||||
```javascript
|
||||
function draw() {
|
||||
// ... render scene ...
|
||||
applyMonochromaticGrain(42); // uniform grain
|
||||
// or: applyChromaticGrain(42); // per-channel randomization
|
||||
}
|
||||
```
|
||||
|
||||
### CCapture.js — Deterministic Video Capture
|
||||
|
||||
Records canvas at fixed framerate regardless of actual render speed. Essential for complex generative art.
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/ccapture.js-npmfixed/build/CCapture.all.min.js"></script>
|
||||
```
|
||||
|
||||
```javascript
|
||||
let capturer;
|
||||
|
||||
function setup() {
|
||||
createCanvas(1920, 1080);
|
||||
capturer = new CCapture({
|
||||
format: 'webm',
|
||||
framerate: 60,
|
||||
quality: 99,
|
||||
// timeLimit: 10, // auto-stop after N seconds
|
||||
// motionBlurFrames: 4 // supersampled motion blur
|
||||
});
|
||||
}
|
||||
|
||||
function startRecording() {
|
||||
capturer.start();
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// ... render frame ...
|
||||
if (capturer) capturer.capture(document.querySelector('canvas'));
|
||||
}
|
||||
|
||||
function stopRecording() {
|
||||
capturer.stop();
|
||||
capturer.save(); // triggers download
|
||||
}
|
||||
```
|
||||
423
skills/creative/p5js/references/webgl-and-3d.md
Normal file
423
skills/creative/p5js/references/webgl-and-3d.md
Normal file
@@ -0,0 +1,423 @@
|
||||
# WebGL and 3D
|
||||
|
||||
## WebGL Mode Setup
|
||||
|
||||
```javascript
|
||||
function setup() {
|
||||
createCanvas(1920, 1080, WEBGL);
|
||||
// Origin is CENTER, not top-left
|
||||
// Y-axis points UP (opposite of 2D mode)
|
||||
// Z-axis points toward viewer
|
||||
}
|
||||
```
|
||||
|
||||
### Coordinate Conversion (WEBGL to P2D-like)
|
||||
|
||||
```javascript
|
||||
function draw() {
|
||||
translate(-width/2, -height/2); // shift origin to top-left
|
||||
// Now coordinates work like P2D
|
||||
}
|
||||
```
|
||||
|
||||
## 3D Primitives
|
||||
|
||||
```javascript
|
||||
box(w, h, d); // rectangular prism
|
||||
sphere(radius, detailX, detailY);
|
||||
cylinder(radius, height, detailX, detailY);
|
||||
cone(radius, height, detailX, detailY);
|
||||
torus(radius, tubeRadius, detailX, detailY);
|
||||
plane(width, height); // flat rectangle
|
||||
ellipsoid(rx, ry, rz); // stretched sphere
|
||||
```
|
||||
|
||||
### 3D Transforms
|
||||
|
||||
```javascript
|
||||
push();
|
||||
translate(x, y, z);
|
||||
rotateX(angleX);
|
||||
rotateY(angleY);
|
||||
rotateZ(angleZ);
|
||||
scale(s);
|
||||
box(100);
|
||||
pop();
|
||||
```
|
||||
|
||||
## Camera
|
||||
|
||||
### Default Camera
|
||||
|
||||
```javascript
|
||||
camera(
|
||||
eyeX, eyeY, eyeZ, // camera position
|
||||
centerX, centerY, centerZ, // look-at target
|
||||
upX, upY, upZ // up direction
|
||||
);
|
||||
|
||||
// Default: camera(0, 0, (height/2)/tan(PI/6), 0, 0, 0, 0, 1, 0)
|
||||
```
|
||||
|
||||
### Orbit Control
|
||||
|
||||
```javascript
|
||||
function draw() {
|
||||
orbitControl(); // mouse drag to rotate, scroll to zoom
|
||||
box(200);
|
||||
}
|
||||
```
|
||||
|
||||
### createCamera
|
||||
|
||||
```javascript
|
||||
let cam;
|
||||
|
||||
function setup() {
|
||||
createCanvas(800, 800, WEBGL);
|
||||
cam = createCamera();
|
||||
cam.setPosition(300, -200, 500);
|
||||
cam.lookAt(0, 0, 0);
|
||||
}
|
||||
|
||||
// Camera methods
|
||||
cam.setPosition(x, y, z);
|
||||
cam.lookAt(x, y, z);
|
||||
cam.move(dx, dy, dz); // relative to camera orientation
|
||||
cam.pan(angle); // horizontal rotation
|
||||
cam.tilt(angle); // vertical rotation
|
||||
cam.roll(angle); // z-axis rotation
|
||||
cam.slerp(otherCam, t); // smooth interpolation between cameras
|
||||
```
|
||||
|
||||
### Perspective and Orthographic
|
||||
|
||||
```javascript
|
||||
// Perspective (default)
|
||||
perspective(fov, aspect, near, far);
|
||||
// fov: field of view in radians (PI/3 default)
|
||||
// aspect: width/height
|
||||
// near/far: clipping planes
|
||||
|
||||
// Orthographic (no depth foreshortening)
|
||||
ortho(-width/2, width/2, -height/2, height/2, 0, 2000);
|
||||
```
|
||||
|
||||
## Lighting
|
||||
|
||||
```javascript
|
||||
// Ambient (uniform, no direction)
|
||||
ambientLight(50, 50, 50); // dim fill light
|
||||
|
||||
// Directional (parallel rays, like sun)
|
||||
directionalLight(255, 255, 255, 0, -1, 0); // color + direction
|
||||
|
||||
// Point (radiates from position)
|
||||
pointLight(255, 200, 150, 200, -300, 400); // color + position
|
||||
|
||||
// Spot (cone from position toward target)
|
||||
spotLight(255, 255, 255, // color
|
||||
0, -300, 300, // position
|
||||
0, 1, -1, // direction
|
||||
PI / 4, 5); // angle, concentration
|
||||
|
||||
// Image-based lighting
|
||||
imageLight(myHDRI);
|
||||
|
||||
// No lights (flat shading)
|
||||
noLights();
|
||||
|
||||
// Quick default lighting
|
||||
lights();
|
||||
```
|
||||
|
||||
### Three-Point Lighting Setup
|
||||
|
||||
```javascript
|
||||
function setupLighting() {
|
||||
ambientLight(30, 30, 40); // dim blue fill
|
||||
|
||||
// Key light (main, warm)
|
||||
directionalLight(255, 240, 220, -1, -1, -1);
|
||||
|
||||
// Fill light (softer, cooler, opposite side)
|
||||
directionalLight(80, 100, 140, 1, -0.5, -1);
|
||||
|
||||
// Rim light (behind subject, for edge definition)
|
||||
pointLight(200, 200, 255, 0, -200, -400);
|
||||
}
|
||||
```
|
||||
|
||||
## Materials
|
||||
|
||||
```javascript
|
||||
// Normal material (debug — colors from surface normals)
|
||||
normalMaterial();
|
||||
|
||||
// Ambient (responds only to ambientLight)
|
||||
ambientMaterial(200, 100, 100);
|
||||
|
||||
// Emissive (self-lit, no shadows)
|
||||
emissiveMaterial(255, 0, 100);
|
||||
|
||||
// Specular (shiny reflections)
|
||||
specularMaterial(255);
|
||||
shininess(50); // 1-200 (higher = tighter highlight)
|
||||
metalness(100); // 0-200 (metallic reflection)
|
||||
|
||||
// Fill works too (no lighting response)
|
||||
fill(255, 0, 0);
|
||||
```
|
||||
|
||||
### Texture
|
||||
|
||||
```javascript
|
||||
let img;
|
||||
function preload() { img = loadImage('texture.jpg'); }
|
||||
|
||||
function draw() {
|
||||
texture(img);
|
||||
textureMode(NORMAL); // UV coords 0-1
|
||||
// textureMode(IMAGE); // UV coords in pixels
|
||||
textureWrap(REPEAT); // or CLAMP, MIRROR
|
||||
box(200);
|
||||
}
|
||||
```
|
||||
|
||||
## Custom Geometry
|
||||
|
||||
### buildGeometry
|
||||
|
||||
```javascript
|
||||
let myShape;
|
||||
|
||||
function setup() {
|
||||
createCanvas(800, 800, WEBGL);
|
||||
myShape = buildGeometry(() => {
|
||||
for (let i = 0; i < 50; i++) {
|
||||
push();
|
||||
translate(random(-200, 200), random(-200, 200), random(-200, 200));
|
||||
sphere(10);
|
||||
pop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function draw() {
|
||||
model(myShape); // renders once-built geometry efficiently
|
||||
}
|
||||
```
|
||||
|
||||
### beginGeometry / endGeometry
|
||||
|
||||
```javascript
|
||||
beginGeometry();
|
||||
// draw shapes here
|
||||
box(50);
|
||||
translate(100, 0, 0);
|
||||
sphere(30);
|
||||
let geo = endGeometry();
|
||||
|
||||
model(geo); // reuse
|
||||
```
|
||||
|
||||
### Manual Geometry (p5.Geometry)
|
||||
|
||||
```javascript
|
||||
let geo = new p5.Geometry(detailX, detailY, function() {
|
||||
for (let i = 0; i <= detailX; i++) {
|
||||
for (let j = 0; j <= detailY; j++) {
|
||||
let u = i / detailX;
|
||||
let v = j / detailY;
|
||||
let x = cos(u * TWO_PI) * (100 + 30 * cos(v * TWO_PI));
|
||||
let y = sin(u * TWO_PI) * (100 + 30 * cos(v * TWO_PI));
|
||||
let z = 30 * sin(v * TWO_PI);
|
||||
this.vertices.push(createVector(x, y, z));
|
||||
this.uvs.push(u, v);
|
||||
}
|
||||
}
|
||||
this.computeFaces();
|
||||
this.computeNormals();
|
||||
});
|
||||
```
|
||||
|
||||
## GLSL Shaders
|
||||
|
||||
### createShader (Vertex + Fragment)
|
||||
|
||||
```javascript
|
||||
let myShader;
|
||||
|
||||
function setup() {
|
||||
createCanvas(800, 800, WEBGL);
|
||||
|
||||
let vert = `
|
||||
precision mediump float;
|
||||
attribute vec3 aPosition;
|
||||
attribute vec2 aTexCoord;
|
||||
varying vec2 vTexCoord;
|
||||
uniform mat4 uModelViewMatrix;
|
||||
uniform mat4 uProjectionMatrix;
|
||||
void main() {
|
||||
vTexCoord = aTexCoord;
|
||||
vec4 pos = uProjectionMatrix * uModelViewMatrix * vec4(aPosition, 1.0);
|
||||
gl_Position = pos;
|
||||
}
|
||||
`;
|
||||
|
||||
let frag = `
|
||||
precision mediump float;
|
||||
varying vec2 vTexCoord;
|
||||
uniform float uTime;
|
||||
uniform vec2 uResolution;
|
||||
|
||||
void main() {
|
||||
vec2 uv = vTexCoord;
|
||||
vec3 col = 0.5 + 0.5 * cos(uTime + uv.xyx + vec3(0, 2, 4));
|
||||
gl_FragColor = vec4(col, 1.0);
|
||||
}
|
||||
`;
|
||||
|
||||
myShader = createShader(vert, frag);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
shader(myShader);
|
||||
myShader.setUniform('uTime', millis() / 1000.0);
|
||||
myShader.setUniform('uResolution', [width, height]);
|
||||
rect(0, 0, width, height);
|
||||
resetShader();
|
||||
}
|
||||
```
|
||||
|
||||
### createFilterShader (Post-Processing)
|
||||
|
||||
Simpler — only needs a fragment shader. Automatically gets the canvas as a texture.
|
||||
|
||||
```javascript
|
||||
let blurShader;
|
||||
|
||||
function setup() {
|
||||
createCanvas(800, 800, WEBGL);
|
||||
|
||||
blurShader = createFilterShader(`
|
||||
precision mediump float;
|
||||
varying vec2 vTexCoord;
|
||||
uniform sampler2D tex0;
|
||||
uniform vec2 texelSize;
|
||||
|
||||
void main() {
|
||||
vec4 sum = vec4(0.0);
|
||||
for (int x = -2; x <= 2; x++) {
|
||||
for (int y = -2; y <= 2; y++) {
|
||||
sum += texture2D(tex0, vTexCoord + vec2(float(x), float(y)) * texelSize);
|
||||
}
|
||||
}
|
||||
gl_FragColor = sum / 25.0;
|
||||
}
|
||||
`);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// Draw scene normally
|
||||
background(0);
|
||||
fill(255, 0, 0);
|
||||
sphere(100);
|
||||
|
||||
// Apply post-processing filter
|
||||
filter(blurShader);
|
||||
}
|
||||
```
|
||||
|
||||
### Common Shader Uniforms
|
||||
|
||||
```javascript
|
||||
myShader.setUniform('uTime', millis() / 1000.0);
|
||||
myShader.setUniform('uResolution', [width, height]);
|
||||
myShader.setUniform('uMouse', [mouseX / width, mouseY / height]);
|
||||
myShader.setUniform('uTexture', myGraphics); // pass p5.Graphics as texture
|
||||
myShader.setUniform('uValue', 0.5); // float
|
||||
myShader.setUniform('uColor', [1.0, 0.0, 0.5, 1.0]); // vec4
|
||||
```
|
||||
|
||||
### Shader Recipes
|
||||
|
||||
**Chromatic Aberration:**
|
||||
```glsl
|
||||
vec4 r = texture2D(tex0, vTexCoord + vec2(0.005, 0.0));
|
||||
vec4 g = texture2D(tex0, vTexCoord);
|
||||
vec4 b = texture2D(tex0, vTexCoord - vec2(0.005, 0.0));
|
||||
gl_FragColor = vec4(r.r, g.g, b.b, 1.0);
|
||||
```
|
||||
|
||||
**Vignette:**
|
||||
```glsl
|
||||
float d = distance(vTexCoord, vec2(0.5));
|
||||
float v = smoothstep(0.7, 0.4, d);
|
||||
gl_FragColor = texture2D(tex0, vTexCoord) * v;
|
||||
```
|
||||
|
||||
**Scanlines:**
|
||||
```glsl
|
||||
float scanline = sin(vTexCoord.y * uResolution.y * 3.14159) * 0.04;
|
||||
vec4 col = texture2D(tex0, vTexCoord);
|
||||
gl_FragColor = col - scanline;
|
||||
```
|
||||
|
||||
## Framebuffers
|
||||
|
||||
```javascript
|
||||
let fbo;
|
||||
|
||||
function setup() {
|
||||
createCanvas(800, 800, WEBGL);
|
||||
fbo = createFramebuffer();
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// Render to framebuffer
|
||||
fbo.begin();
|
||||
clear();
|
||||
rotateY(frameCount * 0.01);
|
||||
box(200);
|
||||
fbo.end();
|
||||
|
||||
// Use framebuffer as texture
|
||||
texture(fbo.color);
|
||||
plane(width, height);
|
||||
}
|
||||
```
|
||||
|
||||
### Multi-Pass Rendering
|
||||
|
||||
```javascript
|
||||
let sceneBuffer, blurBuffer;
|
||||
|
||||
function setup() {
|
||||
createCanvas(800, 800, WEBGL);
|
||||
sceneBuffer = createFramebuffer();
|
||||
blurBuffer = createFramebuffer();
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// Pass 1: render scene
|
||||
sceneBuffer.begin();
|
||||
clear();
|
||||
lights();
|
||||
rotateY(frameCount * 0.01);
|
||||
box(200);
|
||||
sceneBuffer.end();
|
||||
|
||||
// Pass 2: blur
|
||||
blurBuffer.begin();
|
||||
shader(blurShader);
|
||||
blurShader.setUniform('uTexture', sceneBuffer.color);
|
||||
rect(0, 0, width, height);
|
||||
resetShader();
|
||||
blurBuffer.end();
|
||||
|
||||
// Final: composite
|
||||
texture(blurBuffer.color);
|
||||
plane(width, height);
|
||||
}
|
||||
```
|
||||
179
skills/creative/p5js/scripts/export-frames.js
Executable file
179
skills/creative/p5js/scripts/export-frames.js
Executable file
@@ -0,0 +1,179 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* p5.js Skill — Headless Frame Export
|
||||
*
|
||||
* Captures frames from a p5.js sketch using Puppeteer (headless Chrome).
|
||||
* Uses noLoop() + redraw() for DETERMINISTIC frame-by-frame control.
|
||||
*
|
||||
* IMPORTANT: Your sketch must call noLoop() in setup() and set
|
||||
* window._p5Ready = true when initialized. This script calls redraw()
|
||||
* for each frame capture, ensuring exact 1:1 correspondence between
|
||||
* frameCount and captured frames.
|
||||
*
|
||||
* If the sketch does NOT set window._p5Ready, the script falls back to
|
||||
* a timed capture mode (less precise, may drop/duplicate frames).
|
||||
*
|
||||
* Usage:
|
||||
* node export-frames.js sketch.html [options]
|
||||
*
|
||||
* Options:
|
||||
* --output <dir> Output directory (default: ./frames)
|
||||
* --width <px> Canvas width (default: 1920)
|
||||
* --height <px> Canvas height (default: 1080)
|
||||
* --frames <n> Number of frames to capture (default: 1)
|
||||
* --fps <n> Target FPS for timed fallback mode (default: 30)
|
||||
* --wait <ms> Wait before first capture (default: 2000)
|
||||
* --selector <sel> Canvas CSS selector (default: canvas)
|
||||
*
|
||||
* Examples:
|
||||
* node export-frames.js sketch.html --frames 1 # single PNG
|
||||
* node export-frames.js sketch.html --frames 300 --fps 30 # 10s at 30fps
|
||||
* node export-frames.js sketch.html --width 3840 --height 2160 # 4K still
|
||||
*
|
||||
* Sketch template for deterministic capture:
|
||||
* function setup() {
|
||||
* createCanvas(1920, 1080);
|
||||
* pixelDensity(1);
|
||||
* noLoop(); // REQUIRED for deterministic capture
|
||||
* window._p5Ready = true; // REQUIRED to signal readiness
|
||||
* }
|
||||
* function draw() { ... }
|
||||
*/
|
||||
|
||||
const puppeteer = require('puppeteer');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
// Parse CLI arguments
|
||||
function parseArgs() {
|
||||
const args = process.argv.slice(2);
|
||||
const opts = {
|
||||
input: null,
|
||||
output: './frames',
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
frames: 1,
|
||||
fps: 30,
|
||||
wait: 2000,
|
||||
selector: 'canvas',
|
||||
};
|
||||
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
if (args[i].startsWith('--')) {
|
||||
const key = args[i].slice(2);
|
||||
const val = args[i + 1];
|
||||
if (key in opts && val !== undefined) {
|
||||
opts[key] = isNaN(Number(val)) ? val : Number(val);
|
||||
i++;
|
||||
}
|
||||
} else if (!opts.input) {
|
||||
opts.input = args[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (!opts.input) {
|
||||
console.error('Usage: node export-frames.js <sketch.html> [options]');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
return opts;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const opts = parseArgs();
|
||||
const inputPath = path.resolve(opts.input);
|
||||
|
||||
if (!fs.existsSync(inputPath)) {
|
||||
console.error(`File not found: ${inputPath}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Create output directory
|
||||
fs.mkdirSync(opts.output, { recursive: true });
|
||||
|
||||
console.log(`Capturing ${opts.frames} frame(s) from ${opts.input}`);
|
||||
console.log(`Resolution: ${opts.width}x${opts.height}`);
|
||||
console.log(`Output: ${opts.output}/`);
|
||||
|
||||
const browser = await puppeteer.launch({
|
||||
headless: 'new',
|
||||
args: [
|
||||
'--no-sandbox',
|
||||
'--disable-setuid-sandbox',
|
||||
'--disable-gpu',
|
||||
'--disable-dev-shm-usage',
|
||||
'--disable-web-security',
|
||||
'--allow-file-access-from-files',
|
||||
],
|
||||
});
|
||||
|
||||
const page = await browser.newPage();
|
||||
|
||||
await page.setViewport({
|
||||
width: opts.width,
|
||||
height: opts.height,
|
||||
deviceScaleFactor: 1,
|
||||
});
|
||||
|
||||
// Navigate to sketch
|
||||
const fileUrl = `file://${inputPath}`;
|
||||
await page.goto(fileUrl, { waitUntil: 'networkidle0', timeout: 30000 });
|
||||
|
||||
// Wait for canvas to appear
|
||||
await page.waitForSelector(opts.selector, { timeout: 10000 });
|
||||
|
||||
// Detect capture mode: deterministic (noLoop+redraw) vs timed (fallback)
|
||||
let deterministic = false;
|
||||
try {
|
||||
await page.waitForFunction('window._p5Ready === true', { timeout: 5000 });
|
||||
deterministic = true;
|
||||
console.log(`Mode: deterministic (noLoop + redraw)`);
|
||||
} catch {
|
||||
console.log(`Mode: timed fallback (sketch does not set window._p5Ready)`);
|
||||
console.log(` For frame-perfect capture, add noLoop() and window._p5Ready=true to setup()`);
|
||||
await new Promise(r => setTimeout(r, opts.wait));
|
||||
}
|
||||
|
||||
const startTime = Date.now();
|
||||
|
||||
for (let i = 0; i < opts.frames; i++) {
|
||||
if (deterministic) {
|
||||
// Advance exactly one frame
|
||||
await page.evaluate(() => { redraw(); });
|
||||
// Brief settle time for render to complete
|
||||
await new Promise(r => setTimeout(r, 20));
|
||||
}
|
||||
|
||||
const frameName = `frame-${String(i).padStart(4, '0')}.png`;
|
||||
const framePath = path.join(opts.output, frameName);
|
||||
|
||||
// Capture the canvas element
|
||||
const canvas = await page.$(opts.selector);
|
||||
if (!canvas) {
|
||||
console.error('Canvas element not found');
|
||||
break;
|
||||
}
|
||||
|
||||
await canvas.screenshot({ path: framePath, type: 'png' });
|
||||
|
||||
// Progress
|
||||
if (i % 30 === 0 || i === opts.frames - 1) {
|
||||
const pct = ((i + 1) / opts.frames * 100).toFixed(1);
|
||||
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
||||
process.stdout.write(`\r Frame ${i + 1}/${opts.frames} (${pct}%) — ${elapsed}s`);
|
||||
}
|
||||
|
||||
// In timed mode, wait between frames
|
||||
if (!deterministic && i < opts.frames - 1) {
|
||||
await new Promise(r => setTimeout(r, 1000 / opts.fps));
|
||||
}
|
||||
}
|
||||
|
||||
console.log('\n Done.');
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
main().catch(err => {
|
||||
console.error('Error:', err.message);
|
||||
process.exit(1);
|
||||
});
|
||||
108
skills/creative/p5js/scripts/render.sh
Executable file
108
skills/creative/p5js/scripts/render.sh
Executable file
@@ -0,0 +1,108 @@
|
||||
#!/bin/bash
|
||||
# p5.js Skill — Headless Render Pipeline
|
||||
# Renders a p5.js sketch to MP4 video via Puppeteer + ffmpeg
|
||||
#
|
||||
# Usage:
|
||||
# bash scripts/render.sh sketch.html output.mp4 [options]
|
||||
#
|
||||
# Options:
|
||||
# --width Canvas width (default: 1920)
|
||||
# --height Canvas height (default: 1080)
|
||||
# --fps Frames per second (default: 30)
|
||||
# --duration Duration in seconds (default: 10)
|
||||
# --quality CRF value 0-51 (default: 18, lower = better)
|
||||
# --frames-only Only export frames, skip MP4 encoding
|
||||
#
|
||||
# Examples:
|
||||
# bash scripts/render.sh sketch.html output.mp4
|
||||
# bash scripts/render.sh sketch.html output.mp4 --duration 30 --fps 60
|
||||
# bash scripts/render.sh sketch.html output.mp4 --width 3840 --height 2160
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Defaults
|
||||
WIDTH=1920
|
||||
HEIGHT=1080
|
||||
FPS=30
|
||||
DURATION=10
|
||||
CRF=18
|
||||
FRAMES_ONLY=false
|
||||
|
||||
# Parse arguments
|
||||
INPUT="${1:?Usage: render.sh <input.html> <output.mp4> [options]}"
|
||||
OUTPUT="${2:?Usage: render.sh <input.html> <output.mp4> [options]}"
|
||||
shift 2
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--width) WIDTH="$2"; shift 2 ;;
|
||||
--height) HEIGHT="$2"; shift 2 ;;
|
||||
--fps) FPS="$2"; shift 2 ;;
|
||||
--duration) DURATION="$2"; shift 2 ;;
|
||||
--quality) CRF="$2"; shift 2 ;;
|
||||
--frames-only) FRAMES_ONLY=true; shift ;;
|
||||
*) echo "Unknown option: $1"; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
TOTAL_FRAMES=$((FPS * DURATION))
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
FRAME_DIR=$(mktemp -d)
|
||||
|
||||
echo "=== p5.js Render Pipeline ==="
|
||||
echo "Input: $INPUT"
|
||||
echo "Output: $OUTPUT"
|
||||
echo "Resolution: ${WIDTH}x${HEIGHT}"
|
||||
echo "FPS: $FPS"
|
||||
echo "Duration: ${DURATION}s (${TOTAL_FRAMES} frames)"
|
||||
echo "Quality: CRF $CRF"
|
||||
echo "Frame dir: $FRAME_DIR"
|
||||
echo ""
|
||||
|
||||
# Check dependencies
|
||||
command -v node >/dev/null 2>&1 || { echo "Error: Node.js required"; exit 1; }
|
||||
if [ "$FRAMES_ONLY" = false ]; then
|
||||
command -v ffmpeg >/dev/null 2>&1 || { echo "Error: ffmpeg required for MP4"; exit 1; }
|
||||
fi
|
||||
|
||||
# Step 1: Capture frames via Puppeteer
|
||||
echo "Step 1/2: Capturing ${TOTAL_FRAMES} frames..."
|
||||
node "$SCRIPT_DIR/export-frames.js" \
|
||||
"$INPUT" \
|
||||
--output "$FRAME_DIR" \
|
||||
--width "$WIDTH" \
|
||||
--height "$HEIGHT" \
|
||||
--frames "$TOTAL_FRAMES" \
|
||||
--fps "$FPS"
|
||||
|
||||
echo "Frames captured to $FRAME_DIR"
|
||||
|
||||
if [ "$FRAMES_ONLY" = true ]; then
|
||||
echo "Frames saved to: $FRAME_DIR"
|
||||
echo "To encode manually:"
|
||||
echo " ffmpeg -framerate $FPS -i $FRAME_DIR/frame-%04d.png -c:v libx264 -crf $CRF -pix_fmt yuv420p $OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Step 2: Encode to MP4
|
||||
echo "Step 2/2: Encoding MP4..."
|
||||
ffmpeg -y \
|
||||
-framerate "$FPS" \
|
||||
-i "$FRAME_DIR/frame-%04d.png" \
|
||||
-c:v libx264 \
|
||||
-preset slow \
|
||||
-crf "$CRF" \
|
||||
-pix_fmt yuv420p \
|
||||
-movflags +faststart \
|
||||
"$OUTPUT" \
|
||||
2>"$FRAME_DIR/ffmpeg.log"
|
||||
|
||||
# Cleanup
|
||||
rm -rf "$FRAME_DIR"
|
||||
|
||||
# Report
|
||||
FILE_SIZE=$(ls -lh "$OUTPUT" | awk '{print $5}')
|
||||
echo ""
|
||||
echo "=== Done ==="
|
||||
echo "Output: $OUTPUT ($FILE_SIZE)"
|
||||
echo "Duration: ${DURATION}s at ${FPS}fps, ${WIDTH}x${HEIGHT}"
|
||||
28
skills/creative/p5js/scripts/serve.sh
Executable file
28
skills/creative/p5js/scripts/serve.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# p5.js Skill — Local Development Server
|
||||
# Serves the current directory over HTTP for loading local assets (fonts, images)
|
||||
#
|
||||
# Usage:
|
||||
# bash scripts/serve.sh [port] [directory]
|
||||
#
|
||||
# Examples:
|
||||
# bash scripts/serve.sh # serve CWD on port 8080
|
||||
# bash scripts/serve.sh 3000 # serve CWD on port 3000
|
||||
# bash scripts/serve.sh 8080 ./my-project # serve specific directory
|
||||
|
||||
PORT="${1:-8080}"
|
||||
DIR="${2:-.}"
|
||||
|
||||
echo "=== p5.js Dev Server ==="
|
||||
echo "Serving: $(cd "$DIR" && pwd)"
|
||||
echo "URL: http://localhost:$PORT"
|
||||
echo "Press Ctrl+C to stop"
|
||||
echo ""
|
||||
|
||||
cd "$DIR" && python3 -m http.server "$PORT" 2>/dev/null || {
|
||||
echo "Python3 not found. Trying Node.js..."
|
||||
npx serve -l "$PORT" "$DIR" 2>/dev/null || {
|
||||
echo "Error: Need python3 or npx (Node.js) for local server"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
87
skills/creative/p5js/scripts/setup.sh
Executable file
87
skills/creative/p5js/scripts/setup.sh
Executable file
@@ -0,0 +1,87 @@
|
||||
#!/bin/bash
|
||||
# p5.js Skill — Dependency Verification
|
||||
# Run: bash skills/creative/p5js/scripts/setup.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
ok() { echo -e "${GREEN}[OK]${NC} $1"; }
|
||||
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
||||
fail() { echo -e "${RED}[FAIL]${NC} $1"; }
|
||||
|
||||
echo "=== p5.js Skill — Setup Check ==="
|
||||
echo ""
|
||||
|
||||
# Required: Node.js (for Puppeteer headless export)
|
||||
if command -v node &>/dev/null; then
|
||||
NODE_VER=$(node -v)
|
||||
ok "Node.js $NODE_VER"
|
||||
else
|
||||
warn "Node.js not found — optional, needed for headless export"
|
||||
echo " Install: https://nodejs.org/ or 'brew install node'"
|
||||
fi
|
||||
|
||||
# Required: npm (for Puppeteer install)
|
||||
if command -v npm &>/dev/null; then
|
||||
NPM_VER=$(npm -v)
|
||||
ok "npm $NPM_VER"
|
||||
else
|
||||
warn "npm not found — optional, needed for headless export"
|
||||
fi
|
||||
|
||||
# Optional: Puppeteer
|
||||
if node -e "require('puppeteer')" 2>/dev/null; then
|
||||
ok "Puppeteer installed"
|
||||
else
|
||||
warn "Puppeteer not installed — needed for headless export"
|
||||
echo " Install: npm install puppeteer"
|
||||
fi
|
||||
|
||||
# Optional: ffmpeg (for MP4 encoding from frame sequences)
|
||||
if command -v ffmpeg &>/dev/null; then
|
||||
FFMPEG_VER=$(ffmpeg -version 2>&1 | head -1 | awk '{print $3}')
|
||||
ok "ffmpeg $FFMPEG_VER"
|
||||
else
|
||||
warn "ffmpeg not found — needed for MP4 export"
|
||||
echo " Install: brew install ffmpeg (macOS) or apt install ffmpeg (Linux)"
|
||||
fi
|
||||
|
||||
# Optional: Python3 (for local server)
|
||||
if command -v python3 &>/dev/null; then
|
||||
PY_VER=$(python3 --version 2>&1 | awk '{print $2}')
|
||||
ok "Python $PY_VER (for local server: python3 -m http.server)"
|
||||
else
|
||||
warn "Python3 not found — needed for local file serving"
|
||||
fi
|
||||
|
||||
# Browser check (macOS)
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
if open -Ra "Google Chrome" 2>/dev/null; then
|
||||
ok "Google Chrome found"
|
||||
elif open -Ra "Safari" 2>/dev/null; then
|
||||
ok "Safari found"
|
||||
else
|
||||
warn "No browser detected"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== Core Requirements ==="
|
||||
echo " A modern browser (Chrome/Firefox/Safari/Edge)"
|
||||
echo " p5.js loaded via CDN — no local install needed"
|
||||
echo ""
|
||||
echo "=== Optional (for export) ==="
|
||||
echo " Node.js + Puppeteer — headless frame capture"
|
||||
echo " ffmpeg — frame sequence to MP4"
|
||||
echo " Python3 — local development server"
|
||||
echo ""
|
||||
echo "=== Quick Start ==="
|
||||
echo " 1. Create an HTML file with inline p5.js sketch"
|
||||
echo " 2. Open in browser: open sketch.html"
|
||||
echo " 3. Press 's' to save PNG, 'g' to save GIF"
|
||||
echo ""
|
||||
echo "Setup check complete."
|
||||
395
skills/creative/p5js/templates/viewer.html
Normal file
395
skills/creative/p5js/templates/viewer.html
Normal file
@@ -0,0 +1,395 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
p5.js Interactive Viewer Template
|
||||
=================================
|
||||
USE THIS AS THE STARTING POINT for interactive generative art sketches.
|
||||
|
||||
FIXED (keep as-is):
|
||||
✓ Layout structure (sidebar + canvas)
|
||||
✓ Seed navigation (prev/next/random/jump)
|
||||
✓ Action buttons (regenerate, reset, download PNG)
|
||||
✓ Responsive canvas sizing
|
||||
✓ Parameter update + regeneration wiring
|
||||
|
||||
VARIABLE (replace for each project):
|
||||
✗ The p5.js algorithm (setup/draw/classes)
|
||||
✗ The PARAMS object (define what your art needs)
|
||||
✗ The parameter controls in the sidebar (sliders, pickers)
|
||||
✗ The color palette
|
||||
✗ The title and description
|
||||
|
||||
For headless export: add noLoop() and window._p5Ready=true in setup().
|
||||
-->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Generative Art Viewer</title>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.11.3/p5.min.js"></script>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body {
|
||||
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
|
||||
background: #0a0a0f;
|
||||
color: #c8c8d0;
|
||||
display: flex;
|
||||
min-height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* --- Sidebar --- */
|
||||
.sidebar {
|
||||
width: 280px;
|
||||
flex-shrink: 0;
|
||||
background: #12121a;
|
||||
border-right: 1px solid #1e1e2a;
|
||||
padding: 20px;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
.sidebar h1 {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #e8e8f0;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.sidebar .subtitle {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.section-title {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
color: #555;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
/* --- Seed Controls --- */
|
||||
.seed-display {
|
||||
font-family: 'SF Mono', 'Fira Code', monospace;
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: #e8e8f0;
|
||||
text-align: center;
|
||||
padding: 8px;
|
||||
background: #1a1a25;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.seed-nav {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.seed-nav button {
|
||||
flex: 1;
|
||||
padding: 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.seed-jump {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
}
|
||||
.seed-jump input {
|
||||
flex: 1;
|
||||
padding: 6px 8px;
|
||||
background: #1a1a25;
|
||||
border: 1px solid #2a2a35;
|
||||
border-radius: 4px;
|
||||
color: #c8c8d0;
|
||||
font-size: 12px;
|
||||
font-family: monospace;
|
||||
}
|
||||
.seed-jump button { padding: 6px 12px; font-size: 12px; }
|
||||
|
||||
/* --- Parameter Controls --- */
|
||||
.control-group {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.control-group label {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 12px;
|
||||
color: #888;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.control-group .value {
|
||||
color: #aaa;
|
||||
font-family: monospace;
|
||||
font-size: 11px;
|
||||
}
|
||||
.control-group input[type="range"] {
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
-webkit-appearance: none;
|
||||
background: #2a2a35;
|
||||
border-radius: 2px;
|
||||
outline: none;
|
||||
}
|
||||
.control-group input[type="range"]::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
width: 14px; height: 14px;
|
||||
border-radius: 50%;
|
||||
background: #6a9bcc;
|
||||
cursor: pointer;
|
||||
}
|
||||
.control-group input[type="color"] {
|
||||
width: 100%;
|
||||
height: 28px;
|
||||
border: 1px solid #2a2a35;
|
||||
border-radius: 4px;
|
||||
background: #1a1a25;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* --- Buttons --- */
|
||||
button {
|
||||
padding: 8px 12px;
|
||||
background: #1e1e2a;
|
||||
border: 1px solid #2a2a35;
|
||||
border-radius: 4px;
|
||||
color: #c8c8d0;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
button:hover { background: #2a2a3a; }
|
||||
button.primary { background: #2a4a6a; border-color: #3a5a7a; }
|
||||
button.primary:hover { background: #3a5a7a; }
|
||||
|
||||
.actions { display: flex; flex-direction: column; gap: 6px; }
|
||||
.actions button { width: 100%; }
|
||||
|
||||
/* --- Canvas Area --- */
|
||||
.canvas-area {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
background: #08080c;
|
||||
}
|
||||
canvas { display: block; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- === SIDEBAR === -->
|
||||
<div class="sidebar">
|
||||
<!-- FIXED: Title (customize text, keep structure) -->
|
||||
<div>
|
||||
<h1 id="art-title">Generative Sketch</h1>
|
||||
<div class="subtitle" id="art-subtitle">p5.js generative art</div>
|
||||
</div>
|
||||
|
||||
<!-- FIXED: Seed Navigation -->
|
||||
<div>
|
||||
<div class="section-title">Seed</div>
|
||||
<div class="seed-display" id="seed-display">42</div>
|
||||
<div class="seed-nav">
|
||||
<button onclick="changeSeed(-1)">◀ Prev</button>
|
||||
<button onclick="changeSeed(1)">Next ▶</button>
|
||||
<button onclick="randomizeSeed()">Random</button>
|
||||
</div>
|
||||
<div class="seed-jump">
|
||||
<input type="number" id="seed-input" placeholder="Seed #" min="0">
|
||||
<button onclick="jumpToSeed()">Go</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- VARIABLE: Parameters (customize for each project) -->
|
||||
<div id="params-section">
|
||||
<div class="section-title">Parameters</div>
|
||||
|
||||
<!-- === REPLACE THESE WITH YOUR PARAMETERS === -->
|
||||
<div class="control-group">
|
||||
<label>Count <span class="value" id="count-val">500</span></label>
|
||||
<input type="range" id="count" min="50" max="2000" step="50" value="500"
|
||||
oninput="updateParam('count', +this.value)">
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label>Scale <span class="value" id="scale-val">0.005</span></label>
|
||||
<input type="range" id="scale" min="0.001" max="0.02" step="0.001" value="0.005"
|
||||
oninput="updateParam('scale', +this.value)">
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label>Speed <span class="value" id="speed-val">2.0</span></label>
|
||||
<input type="range" id="speed" min="0.5" max="5" step="0.1" value="2.0"
|
||||
oninput="updateParam('speed', +this.value)">
|
||||
</div>
|
||||
<!-- === END PARAMETER CONTROLS === -->
|
||||
</div>
|
||||
|
||||
<!-- VARIABLE: Colors (optional — include if art needs adjustable palette) -->
|
||||
<!--
|
||||
<div>
|
||||
<div class="section-title">Colors</div>
|
||||
<div class="control-group">
|
||||
<label>Background</label>
|
||||
<input type="color" id="bg-color" value="#0a0a14"
|
||||
oninput="updateParam('bgColor', this.value)">
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label>Primary</label>
|
||||
<input type="color" id="primary-color" value="#6a9bcc"
|
||||
oninput="updateParam('primaryColor', this.value)">
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<!-- FIXED: Actions -->
|
||||
<div class="actions">
|
||||
<div class="section-title">Actions</div>
|
||||
<button class="primary" onclick="regenerate()">Regenerate</button>
|
||||
<button onclick="resetDefaults()">Reset Defaults</button>
|
||||
<button onclick="downloadPNG()">Download PNG</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- === CANVAS === -->
|
||||
<div class="canvas-area" id="canvas-container"></div>
|
||||
|
||||
<script>
|
||||
// ====================================================================
|
||||
// CONFIGURATION — REPLACE FOR EACH PROJECT
|
||||
// ====================================================================
|
||||
const DEFAULTS = {
|
||||
seed: 42,
|
||||
count: 500,
|
||||
scale: 0.005,
|
||||
speed: 2.0,
|
||||
// Add your parameters here
|
||||
};
|
||||
|
||||
let PARAMS = { ...DEFAULTS };
|
||||
|
||||
// ====================================================================
|
||||
// SEED NAVIGATION — FIXED (do not modify)
|
||||
// ====================================================================
|
||||
function changeSeed(delta) {
|
||||
PARAMS.seed = Math.max(0, PARAMS.seed + delta);
|
||||
document.getElementById('seed-display').textContent = PARAMS.seed;
|
||||
regenerate();
|
||||
}
|
||||
|
||||
function randomizeSeed() {
|
||||
PARAMS.seed = Math.floor(Math.random() * 99999);
|
||||
document.getElementById('seed-display').textContent = PARAMS.seed;
|
||||
regenerate();
|
||||
}
|
||||
|
||||
function jumpToSeed() {
|
||||
let v = parseInt(document.getElementById('seed-input').value);
|
||||
if (!isNaN(v) && v >= 0) {
|
||||
PARAMS.seed = v;
|
||||
document.getElementById('seed-display').textContent = PARAMS.seed;
|
||||
document.getElementById('seed-input').value = '';
|
||||
regenerate();
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// PARAMETER UPDATES — CUSTOMIZE updateParam body as needed
|
||||
// ====================================================================
|
||||
function updateParam(name, value) {
|
||||
PARAMS[name] = value;
|
||||
let el = document.getElementById(name + '-val');
|
||||
if (el) el.textContent = typeof value === 'number' && value < 1 ? value.toFixed(3) : value;
|
||||
regenerate();
|
||||
}
|
||||
|
||||
function resetDefaults() {
|
||||
PARAMS = { ...DEFAULTS };
|
||||
// Reset all sliders to default values
|
||||
for (let [key, val] of Object.entries(DEFAULTS)) {
|
||||
let el = document.getElementById(key);
|
||||
if (el) el.value = val;
|
||||
let valEl = document.getElementById(key + '-val');
|
||||
if (valEl) valEl.textContent = typeof val === 'number' && val < 1 ? val.toFixed(3) : val;
|
||||
}
|
||||
document.getElementById('seed-display').textContent = PARAMS.seed;
|
||||
regenerate();
|
||||
}
|
||||
|
||||
function regenerate() {
|
||||
randomSeed(PARAMS.seed);
|
||||
noiseSeed(PARAMS.seed);
|
||||
// Clear and redraw
|
||||
clear();
|
||||
initializeArt();
|
||||
redraw();
|
||||
}
|
||||
|
||||
function downloadPNG() {
|
||||
saveCanvas('generative-art-seed-' + PARAMS.seed, 'png');
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// P5.JS SKETCH — REPLACE ENTIRELY FOR EACH PROJECT
|
||||
// ====================================================================
|
||||
|
||||
// Your state variables
|
||||
let particles = [];
|
||||
|
||||
function initializeArt() {
|
||||
// Initialize your generative system using PARAMS
|
||||
// This is called on every regenerate()
|
||||
particles = [];
|
||||
for (let i = 0; i < PARAMS.count; i++) {
|
||||
particles.push({
|
||||
x: random(width),
|
||||
y: random(height),
|
||||
vx: 0, vy: 0
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function setup() {
|
||||
// Size canvas to fit container
|
||||
let container = document.getElementById('canvas-container');
|
||||
let size = Math.min(container.clientWidth - 40, container.clientHeight - 40, 1080);
|
||||
let cnv = createCanvas(size, size);
|
||||
cnv.parent('canvas-container');
|
||||
pixelDensity(1);
|
||||
colorMode(HSB, 360, 100, 100, 100);
|
||||
|
||||
randomSeed(PARAMS.seed);
|
||||
noiseSeed(PARAMS.seed);
|
||||
initializeArt();
|
||||
|
||||
// For interactive/animated sketches: remove noLoop()
|
||||
// For static generation: keep noLoop()
|
||||
noLoop();
|
||||
}
|
||||
|
||||
function draw() {
|
||||
background(0, 0, 5);
|
||||
|
||||
// === YOUR ALGORITHM HERE ===
|
||||
// Use PARAMS.count, PARAMS.scale, PARAMS.speed, etc.
|
||||
noStroke();
|
||||
for (let p of particles) {
|
||||
let n = noise(p.x * PARAMS.scale, p.y * PARAMS.scale);
|
||||
let hue = (n * 200 + PARAMS.seed * 0.1) % 360;
|
||||
fill(hue, 70, 80, 60);
|
||||
circle(p.x, p.y, n * 10 + 2);
|
||||
}
|
||||
// === END ALGORITHM ===
|
||||
}
|
||||
|
||||
function windowResized() {
|
||||
let container = document.getElementById('canvas-container');
|
||||
let size = Math.min(container.clientWidth - 40, container.clientHeight - 40, 1080);
|
||||
resizeCanvas(size, size);
|
||||
regenerate();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
207
skills/creative/popular-web-designs/SKILL.md
Normal file
207
skills/creative/popular-web-designs/SKILL.md
Normal file
@@ -0,0 +1,207 @@
|
||||
---
|
||||
name: popular-web-designs
|
||||
description: >
|
||||
54 production-quality design systems extracted from real websites. Load a template
|
||||
to generate HTML/CSS that matches the visual identity of sites like Stripe, Linear,
|
||||
Vercel, Notion, Airbnb, and more. Each template includes colors, typography, components,
|
||||
layout rules, and ready-to-use CSS values.
|
||||
version: 1.0.0
|
||||
author: Hermes Agent + Teknium (design systems sourced from VoltAgent/awesome-design-md)
|
||||
license: MIT
|
||||
tags: [design, css, html, ui, web-development, design-systems, templates]
|
||||
triggers:
|
||||
- build a page that looks like
|
||||
- make it look like stripe
|
||||
- design like linear
|
||||
- vercel style
|
||||
- create a UI
|
||||
- web design
|
||||
- landing page
|
||||
- dashboard design
|
||||
- website styled like
|
||||
---
|
||||
|
||||
# Popular Web Designs
|
||||
|
||||
54 real-world design systems ready for use when generating HTML/CSS. Each template captures a
|
||||
site's complete visual language: color palette, typography hierarchy, component styles, spacing
|
||||
system, shadows, responsive behavior, and practical agent prompts with exact CSS values.
|
||||
|
||||
## How to Use
|
||||
|
||||
1. Pick a design from the catalog below
|
||||
2. Load it: `skill_view(name="popular-web-designs", file_path="templates/<site>.md")`
|
||||
3. Use the design tokens and component specs when generating HTML
|
||||
4. Pair with the `generative-widgets` skill to serve the result via cloudflared tunnel
|
||||
|
||||
Each template includes a **Hermes Implementation Notes** block at the top with:
|
||||
- CDN font substitute and Google Fonts `<link>` tag (ready to paste)
|
||||
- CSS font-family stacks for primary and monospace
|
||||
- Reminders to use `write_file` for HTML creation and `browser_vision` for verification
|
||||
|
||||
## HTML Generation Pattern
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Page Title</title>
|
||||
<!-- Paste the Google Fonts <link> from the template's Hermes notes -->
|
||||
<link href="https://fonts.googleapis.com/css2?family=..." rel="stylesheet">
|
||||
<style>
|
||||
/* Apply the template's color palette as CSS custom properties */
|
||||
:root {
|
||||
--color-bg: #ffffff;
|
||||
--color-text: #171717;
|
||||
--color-accent: #533afd;
|
||||
/* ... more from template Section 2 */
|
||||
}
|
||||
/* Apply typography from template Section 3 */
|
||||
body {
|
||||
font-family: 'Inter', system-ui, sans-serif;
|
||||
color: var(--color-text);
|
||||
background: var(--color-bg);
|
||||
}
|
||||
/* Apply component styles from template Section 4 */
|
||||
/* Apply layout from template Section 5 */
|
||||
/* Apply shadows from template Section 6 */
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Build using component specs from the template -->
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
Write the file with `write_file`, serve with the `generative-widgets` workflow (cloudflared tunnel),
|
||||
and verify the result with `browser_vision` to confirm visual accuracy.
|
||||
|
||||
## Font Substitution Reference
|
||||
|
||||
Most sites use proprietary fonts unavailable via CDN. Each template maps to a Google Fonts
|
||||
substitute that preserves the design's character. Common mappings:
|
||||
|
||||
| Proprietary Font | CDN Substitute | Character |
|
||||
|---|---|---|
|
||||
| Geist / Geist Sans | Geist (on Google Fonts) | Geometric, compressed tracking |
|
||||
| Geist Mono | Geist Mono (on Google Fonts) | Clean monospace, ligatures |
|
||||
| sohne-var (Stripe) | Source Sans 3 | Light weight elegance |
|
||||
| Berkeley Mono | JetBrains Mono | Technical monospace |
|
||||
| Airbnb Cereal VF | DM Sans | Rounded, friendly geometric |
|
||||
| Circular (Spotify) | DM Sans | Geometric, warm |
|
||||
| figmaSans | Inter | Clean humanist |
|
||||
| Pin Sans (Pinterest) | DM Sans | Friendly, rounded |
|
||||
| NVIDIA-EMEA | Inter (or Arial system) | Industrial, clean |
|
||||
| CoinbaseDisplay/Sans | DM Sans | Geometric, trustworthy |
|
||||
| UberMove | DM Sans | Bold, tight |
|
||||
| HashiCorp Sans | Inter | Enterprise, neutral |
|
||||
| waldenburgNormal (Sanity) | Space Grotesk | Geometric, slightly condensed |
|
||||
| IBM Plex Sans/Mono | IBM Plex Sans/Mono | Available on Google Fonts |
|
||||
| Rubik (Sentry) | Rubik | Available on Google Fonts |
|
||||
|
||||
When a template's CDN font matches the original (Inter, IBM Plex, Rubik, Geist), no
|
||||
substitution loss occurs. When a substitute is used (DM Sans for Circular, Source Sans 3
|
||||
for sohne-var), follow the template's weight, size, and letter-spacing values closely —
|
||||
those carry more visual identity than the specific font face.
|
||||
|
||||
## Design Catalog
|
||||
|
||||
### AI & Machine Learning
|
||||
|
||||
| Template | Site | Style |
|
||||
|---|---|---|
|
||||
| `claude.md` | Anthropic Claude | Warm terracotta accent, clean editorial layout |
|
||||
| `cohere.md` | Cohere | Vibrant gradients, data-rich dashboard aesthetic |
|
||||
| `elevenlabs.md` | ElevenLabs | Dark cinematic UI, audio-waveform aesthetics |
|
||||
| `minimax.md` | Minimax | Bold dark interface with neon accents |
|
||||
| `mistral.ai.md` | Mistral AI | French-engineered minimalism, purple-toned |
|
||||
| `ollama.md` | Ollama | Terminal-first, monochrome simplicity |
|
||||
| `opencode.ai.md` | OpenCode AI | Developer-centric dark theme, full monospace |
|
||||
| `replicate.md` | Replicate | Clean white canvas, code-forward |
|
||||
| `runwayml.md` | RunwayML | Cinematic dark UI, media-rich layout |
|
||||
| `together.ai.md` | Together AI | Technical, blueprint-style design |
|
||||
| `voltagent.md` | VoltAgent | Void-black canvas, emerald accent, terminal-native |
|
||||
| `x.ai.md` | xAI | Stark monochrome, futuristic minimalism, full monospace |
|
||||
|
||||
### Developer Tools & Platforms
|
||||
|
||||
| Template | Site | Style |
|
||||
|---|---|---|
|
||||
| `cursor.md` | Cursor | Sleek dark interface, gradient accents |
|
||||
| `expo.md` | Expo | Dark theme, tight letter-spacing, code-centric |
|
||||
| `linear.app.md` | Linear | Ultra-minimal dark-mode, precise, purple accent |
|
||||
| `lovable.md` | Lovable | Playful gradients, friendly dev aesthetic |
|
||||
| `mintlify.md` | Mintlify | Clean, green-accented, reading-optimized |
|
||||
| `posthog.md` | PostHog | Playful branding, developer-friendly dark UI |
|
||||
| `raycast.md` | Raycast | Sleek dark chrome, vibrant gradient accents |
|
||||
| `resend.md` | Resend | Minimal dark theme, monospace accents |
|
||||
| `sentry.md` | Sentry | Dark dashboard, data-dense, pink-purple accent |
|
||||
| `supabase.md` | Supabase | Dark emerald theme, code-first developer tool |
|
||||
| `superhuman.md` | Superhuman | Premium dark UI, keyboard-first, purple glow |
|
||||
| `vercel.md` | Vercel | Black and white precision, Geist font system |
|
||||
| `warp.md` | Warp | Dark IDE-like interface, block-based command UI |
|
||||
| `zapier.md` | Zapier | Warm orange, friendly illustration-driven |
|
||||
|
||||
### Infrastructure & Cloud
|
||||
|
||||
| Template | Site | Style |
|
||||
|---|---|---|
|
||||
| `clickhouse.md` | ClickHouse | Yellow-accented, technical documentation style |
|
||||
| `composio.md` | Composio | Modern dark with colorful integration icons |
|
||||
| `hashicorp.md` | HashiCorp | Enterprise-clean, black and white |
|
||||
| `mongodb.md` | MongoDB | Green leaf branding, developer documentation focus |
|
||||
| `sanity.md` | Sanity | Red accent, content-first editorial layout |
|
||||
| `stripe.md` | Stripe | Signature purple gradients, weight-300 elegance |
|
||||
|
||||
### Design & Productivity
|
||||
|
||||
| Template | Site | Style |
|
||||
|---|---|---|
|
||||
| `airtable.md` | Airtable | Colorful, friendly, structured data aesthetic |
|
||||
| `cal.md` | Cal.com | Clean neutral UI, developer-oriented simplicity |
|
||||
| `clay.md` | Clay | Organic shapes, soft gradients, art-directed layout |
|
||||
| `figma.md` | Figma | Vibrant multi-color, playful yet professional |
|
||||
| `framer.md` | Framer | Bold black and blue, motion-first, design-forward |
|
||||
| `intercom.md` | Intercom | Friendly blue palette, conversational UI patterns |
|
||||
| `miro.md` | Miro | Bright yellow accent, infinite canvas aesthetic |
|
||||
| `notion.md` | Notion | Warm minimalism, serif headings, soft surfaces |
|
||||
| `pinterest.md` | Pinterest | Red accent, masonry grid, image-first layout |
|
||||
| `webflow.md` | Webflow | Blue-accented, polished marketing site aesthetic |
|
||||
|
||||
### Fintech & Crypto
|
||||
|
||||
| Template | Site | Style |
|
||||
|---|---|---|
|
||||
| `coinbase.md` | Coinbase | Clean blue identity, trust-focused, institutional feel |
|
||||
| `kraken.md` | Kraken | Purple-accented dark UI, data-dense dashboards |
|
||||
| `revolut.md` | Revolut | Sleek dark interface, gradient cards, fintech precision |
|
||||
| `wise.md` | Wise | Bright green accent, friendly and clear |
|
||||
|
||||
### Enterprise & Consumer
|
||||
|
||||
| Template | Site | Style |
|
||||
|---|---|---|
|
||||
| `airbnb.md` | Airbnb | Warm coral accent, photography-driven, rounded UI |
|
||||
| `apple.md` | Apple | Premium white space, SF Pro, cinematic imagery |
|
||||
| `bmw.md` | BMW | Dark premium surfaces, precise engineering aesthetic |
|
||||
| `ibm.md` | IBM | Carbon design system, structured blue palette |
|
||||
| `nvidia.md` | NVIDIA | Green-black energy, technical power aesthetic |
|
||||
| `spacex.md` | SpaceX | Stark black and white, full-bleed imagery, futuristic |
|
||||
| `spotify.md` | Spotify | Vibrant green on dark, bold type, album-art-driven |
|
||||
| `uber.md` | Uber | Bold black and white, tight type, urban energy |
|
||||
|
||||
## Choosing a Design
|
||||
|
||||
Match the design to the content:
|
||||
|
||||
- **Developer tools / dashboards:** Linear, Vercel, Supabase, Raycast, Sentry
|
||||
- **Documentation / content sites:** Mintlify, Notion, Sanity, MongoDB
|
||||
- **Marketing / landing pages:** Stripe, Framer, Apple, SpaceX
|
||||
- **Dark mode UIs:** Linear, Cursor, ElevenLabs, Warp, Superhuman
|
||||
- **Light / clean UIs:** Vercel, Stripe, Notion, Cal.com, Replicate
|
||||
- **Playful / friendly:** PostHog, Figma, Lovable, Zapier, Miro
|
||||
- **Premium / luxury:** Apple, BMW, Stripe, Superhuman, Revolut
|
||||
- **Data-dense / dashboards:** Sentry, Kraken, Cohere, ClickHouse
|
||||
- **Monospace / terminal aesthetic:** Ollama, OpenCode, x.ai, VoltAgent
|
||||
259
skills/creative/popular-web-designs/templates/airbnb.md
Normal file
259
skills/creative/popular-web-designs/templates/airbnb.md
Normal file
@@ -0,0 +1,259 @@
|
||||
# Design System: Airbnb
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `DM Sans` | **Mono:** `system monospace stack`
|
||||
> - **Font stack (CSS):** `font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Airbnb's website is a warm, photography-forward marketplace that feels like flipping through a travel magazine where every page invites you to book. The design operates on a foundation of pure white (`#ffffff`) with the iconic Rausch Red (`#ff385c`) — named after Airbnb's first street address — serving as the singular brand accent. The result is a clean, airy canvas where listing photography, category icons, and the red CTA button are the only sources of color.
|
||||
|
||||
The typography uses Airbnb Cereal VF — a custom variable font that's warm and approachable, with rounded terminals that echo the brand's "belong anywhere" philosophy. The font operates in a tight weight range: 500 (medium) for most UI, 600 (semibold) for emphasis, and 700 (bold) for primary headings. Slight negative letter-spacing (-0.18px to -0.44px) on headings creates a cozy, intimate reading experience rather than the compressed efficiency of tech companies.
|
||||
|
||||
What distinguishes Airbnb is its palette-based token system (`--palette-*`) and multi-layered shadow approach. The primary card shadow uses a three-layer stack (`rgba(0,0,0,0.02) 0px 0px 0px 1px, rgba(0,0,0,0.04) 0px 2px 6px, rgba(0,0,0,0.1) 0px 4px 8px`) that creates a subtle, warm lift. Combined with generous border-radius (8px–32px), circular navigation controls (50%), and a category pill bar with horizontal scrolling, the interface feels tactile and inviting — designed for browsing, not commanding.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Pure white canvas with Rausch Red (`#ff385c`) as singular brand accent
|
||||
- Airbnb Cereal VF — custom variable font with warm, rounded terminals
|
||||
- Palette-based token system (`--palette-*`) for systematic color management
|
||||
- Three-layer card shadows: border ring + soft blur + stronger blur
|
||||
- Generous border-radius: 8px buttons, 14px badges, 20px cards, 32px large elements
|
||||
- Circular navigation controls (50% radius)
|
||||
- Photography-first listing cards — images are the hero content
|
||||
- Near-black text (`#222222`) — warm, not cold
|
||||
- Luxe Purple (`#460479`) and Plus Magenta (`#92174d`) for premium tiers
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary Brand
|
||||
- **Rausch Red** (`#ff385c`): `--palette-bg-primary-core`, primary CTA, brand accent, active states
|
||||
- **Deep Rausch** (`#e00b41`): `--palette-bg-tertiary-core`, pressed/dark variant of brand red
|
||||
- **Error Red** (`#c13515`): `--palette-text-primary-error`, error text on light
|
||||
- **Error Dark** (`#b32505`): `--palette-text-secondary-error-hover`, error hover
|
||||
|
||||
### Premium Tiers
|
||||
- **Luxe Purple** (`#460479`): `--palette-bg-primary-luxe`, Airbnb Luxe tier branding
|
||||
- **Plus Magenta** (`#92174d`): `--palette-bg-primary-plus`, Airbnb Plus tier branding
|
||||
|
||||
### Text Scale
|
||||
- **Near Black** (`#222222`): `--palette-text-primary`, primary text — warm, not cold
|
||||
- **Focused Gray** (`#3f3f3f`): `--palette-text-focused`, focused state text
|
||||
- **Secondary Gray** (`#6a6a6a`): Secondary text, descriptions
|
||||
- **Disabled** (`rgba(0,0,0,0.24)`): `--palette-text-material-disabled`, disabled state
|
||||
- **Link Disabled** (`#929292`): `--palette-text-link-disabled`, disabled links
|
||||
|
||||
### Interactive
|
||||
- **Legal Blue** (`#428bff`): `--palette-text-legal`, legal links, informational
|
||||
- **Border Gray** (`#c1c1c1`): Border color for cards and dividers
|
||||
- **Light Surface** (`#f2f2f2`): Circular navigation buttons, secondary surfaces
|
||||
|
||||
### Surface & Shadows
|
||||
- **Pure White** (`#ffffff`): Page background, card surfaces
|
||||
- **Card Shadow** (`rgba(0,0,0,0.02) 0px 0px 0px 1px, rgba(0,0,0,0.04) 0px 2px 6px, rgba(0,0,0,0.1) 0px 4px 8px`): Three-layer warm lift
|
||||
- **Hover Shadow** (`rgba(0,0,0,0.08) 0px 4px 12px`): Button hover elevation
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Primary**: `Airbnb Cereal VF`, fallbacks: `Circular, -apple-system, system-ui, Roboto, Helvetica Neue`
|
||||
- **OpenType Features**: `"salt"` (stylistic alternates) on specific caption elements
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Section Heading | Airbnb Cereal VF | 28px (1.75rem) | 700 | 1.43 | normal | Primary headings |
|
||||
| Card Heading | Airbnb Cereal VF | 22px (1.38rem) | 600 | 1.18 (tight) | -0.44px | Category/card titles |
|
||||
| Card Heading Medium | Airbnb Cereal VF | 22px (1.38rem) | 500 | 1.18 (tight) | -0.44px | Lighter variant |
|
||||
| Sub-heading | Airbnb Cereal VF | 21px (1.31rem) | 700 | 1.43 | normal | Bold sub-headings |
|
||||
| Feature Title | Airbnb Cereal VF | 20px (1.25rem) | 600 | 1.20 (tight) | -0.18px | Feature headings |
|
||||
| UI Medium | Airbnb Cereal VF | 16px (1.00rem) | 500 | 1.25 (tight) | normal | Nav, emphasized text |
|
||||
| UI Semibold | Airbnb Cereal VF | 16px (1.00rem) | 600 | 1.25 (tight) | normal | Strong emphasis |
|
||||
| Button | Airbnb Cereal VF | 16px (1.00rem) | 500 | 1.25 (tight) | normal | Button labels |
|
||||
| Body / Link | Airbnb Cereal VF | 14px (0.88rem) | 400 | 1.43 | normal | Standard body |
|
||||
| Body Medium | Airbnb Cereal VF | 14px (0.88rem) | 500 | 1.29 (tight) | normal | Medium body |
|
||||
| Caption Salt | Airbnb Cereal VF | 14px (0.88rem) | 600 | 1.43 | normal | `"salt"` feature |
|
||||
| Small | Airbnb Cereal VF | 13px (0.81rem) | 400 | 1.23 (tight) | normal | Descriptions |
|
||||
| Tag | Airbnb Cereal VF | 12px (0.75rem) | 400–700 | 1.33 | normal | Tags, prices |
|
||||
| Badge | Airbnb Cereal VF | 11px (0.69rem) | 600 | 1.18 (tight) | normal | `"salt"` feature |
|
||||
| Micro Uppercase | Airbnb Cereal VF | 8px (0.50rem) | 700 | 1.25 (tight) | 0.32px | `text-transform: uppercase` |
|
||||
|
||||
### Principles
|
||||
- **Warm weight range**: 500–700 dominate. No weight 300 or 400 for headings — Airbnb's type is always at least medium weight, creating a warm, confident voice.
|
||||
- **Negative tracking on headings**: -0.18px to -0.44px letter-spacing on display creates intimate, cozy headings rather than cold, compressed ones.
|
||||
- **"salt" OpenType feature**: Stylistic alternates on specific UI elements (badges, captions) create subtle glyph variations that add visual interest.
|
||||
- **Variable font precision**: Cereal VF enables continuous weight interpolation, though the design system uses discrete stops at 500, 600, and 700.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary Dark**
|
||||
- Background: `#222222` (near-black, not pure black)
|
||||
- Text: `#ffffff`
|
||||
- Padding: 0px 24px
|
||||
- Radius: 8px
|
||||
- Hover: transitions to error/brand accent via `var(--accent-bg-error)`
|
||||
- Focus: `0 0 0 2px var(--palette-grey1000)` ring + scale(0.92)
|
||||
|
||||
**Circular Nav**
|
||||
- Background: `#f2f2f2`
|
||||
- Text: `#222222`
|
||||
- Radius: 50% (circle)
|
||||
- Hover: shadow `rgba(0,0,0,0.08) 0px 4px 12px` + translateX(50%)
|
||||
- Active: 4px white border ring + focus shadow
|
||||
- Focus: scale(0.92) shrink animation
|
||||
|
||||
### Cards & Containers
|
||||
- Background: `#ffffff`
|
||||
- Radius: 14px (badges), 20px (cards/buttons), 32px (large)
|
||||
- Shadow: `rgba(0,0,0,0.02) 0px 0px 0px 1px, rgba(0,0,0,0.04) 0px 2px 6px, rgba(0,0,0,0.1) 0px 4px 8px` (three-layer)
|
||||
- Listing cards: full-width photography on top, details below
|
||||
- Carousel controls: circular 50% buttons
|
||||
|
||||
### Inputs
|
||||
- Search: `#222222` text
|
||||
- Focus: `var(--palette-bg-primary-error)` background tint + `0 0 0 2px` ring
|
||||
- Radius: depends on context (search bar uses pill-like rounding)
|
||||
|
||||
### Navigation
|
||||
- White sticky header with search bar centered
|
||||
- Airbnb logo (Rausch Red) left-aligned
|
||||
- Category filter pills: horizontal scroll below search
|
||||
- Circular nav controls for carousel navigation
|
||||
- "Become a Host" text link, avatar/menu right-aligned
|
||||
|
||||
### Image Treatment
|
||||
- Listing photography fills card top with generous height
|
||||
- Image carousel with dot indicators
|
||||
- Heart/wishlist icon overlay on images
|
||||
- 8px–14px radius on contained images
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 2px, 3px, 4px, 6px, 8px, 10px, 11px, 12px, 15px, 16px, 22px, 24px, 32px
|
||||
|
||||
### Grid & Container
|
||||
- Full-width header with centered search
|
||||
- Category pill bar: horizontal scrollable row
|
||||
- Listing grid: responsive multi-column (3–5 columns on desktop)
|
||||
- Full-width footer with link columns
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Travel-magazine spacing**: Generous vertical padding between sections creates a leisurely browsing pace — you're meant to scroll slowly, like browsing a magazine.
|
||||
- **Photography density**: Listing cards are packed relatively tightly, but each image is large enough to feel immersive.
|
||||
- **Search bar prominence**: The search bar gets maximum vertical space in the header — finding your destination is the primary action.
|
||||
|
||||
### Border Radius Scale
|
||||
- Subtle (4px): Small links
|
||||
- Standard (8px): Buttons, tabs, search elements
|
||||
- Badge (14px): Status badges, labels
|
||||
- Card (20px): Feature cards, large buttons
|
||||
- Large (32px): Large containers, hero elements
|
||||
- Circle (50%): Nav controls, avatars, icons
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow | Page background, text blocks |
|
||||
| Card (Level 1) | `rgba(0,0,0,0.02) 0px 0px 0px 1px, rgba(0,0,0,0.04) 0px 2px 6px, rgba(0,0,0,0.1) 0px 4px 8px` | Listing cards, search bar |
|
||||
| Hover (Level 2) | `rgba(0,0,0,0.08) 0px 4px 12px` | Button hover, interactive lift |
|
||||
| Active Focus (Level 3) | `rgb(255,255,255) 0px 0px 0px 4px` + focus ring | Active/focused elements |
|
||||
|
||||
**Shadow Philosophy**: Airbnb's three-layer shadow system creates a warm, natural lift. Layer 1 (`0px 0px 0px 1px` at 0.02 opacity) is an ultra-subtle border. Layer 2 (`0px 2px 6px` at 0.04) provides soft ambient shadow. Layer 3 (`0px 4px 8px` at 0.1) adds the primary lift. This graduated approach creates shadows that feel like natural light rather than CSS effects.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use `#222222` (warm near-black) for text — never pure `#000000`
|
||||
- Apply Rausch Red (`#ff385c`) only for primary CTAs and brand moments — it's the singular accent
|
||||
- Use Airbnb Cereal VF at weight 500–700 — the warm weight range is intentional
|
||||
- Apply the three-layer card shadow for all elevated surfaces
|
||||
- Use generous border-radius: 8px for buttons, 20px for cards, 50% for controls
|
||||
- Use photography as the primary visual content — listings are image-first
|
||||
- Apply negative letter-spacing (-0.18px to -0.44px) on headings for intimacy
|
||||
- Use circular (50%) buttons for carousel/navigation controls
|
||||
|
||||
### Don't
|
||||
- Don't use pure black (`#000000`) for text — always `#222222` (warm)
|
||||
- Don't apply Rausch Red to backgrounds or large surfaces — it's an accent only
|
||||
- Don't use thin font weights (300, 400) for headings — 500 minimum
|
||||
- Don't use heavy shadows (>0.1 opacity as primary layer) — keep them warm and graduated
|
||||
- Don't use sharp corners (0–4px) on cards — the generous rounding (20px+) is core
|
||||
- Don't introduce additional brand colors beyond the Rausch/Luxe/Plus system
|
||||
- Don't override the palette token system — use `--palette-*` variables consistently
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile Small | <375px | Single column, compact search |
|
||||
| Mobile | 375–550px | Standard mobile listing grid |
|
||||
| Tablet Small | 550–744px | 2-column listings |
|
||||
| Tablet | 744–950px | Search bar expansion |
|
||||
| Desktop Small | 950–1128px | 3-column listings |
|
||||
| Desktop | 1128–1440px | 4-column grid, full header |
|
||||
| Large Desktop | 1440–1920px | 5-column grid |
|
||||
| Ultra-wide | >1920px | Maximum grid width |
|
||||
|
||||
*Note: Airbnb has 61 detected breakpoints — one of the most granular responsive systems observed, reflecting their obsession with layout at every possible screen size.*
|
||||
|
||||
### Touch Targets
|
||||
- Circular nav buttons: adequate 50% radius sizing
|
||||
- Listing cards: full-card tap target on mobile
|
||||
- Search bar: prominently sized for thumb interaction
|
||||
- Category pills: horizontally scrollable with generous padding
|
||||
|
||||
### Collapsing Strategy
|
||||
- Listing grid: 5 → 4 → 3 → 2 → 1 columns
|
||||
- Search: expanded bar → compact bar → overlay
|
||||
- Category pills: horizontal scroll at all sizes
|
||||
- Navigation: full header → mobile simplified
|
||||
- Map: side panel → overlay/toggle
|
||||
|
||||
### Image Behavior
|
||||
- Listing photos: carousel with swipe on mobile
|
||||
- Responsive image sizing with aspect ratio maintained
|
||||
- Heart overlay positioned consistently across sizes
|
||||
- Photo quality adjusts based on viewport
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Background: Pure White (`#ffffff`)
|
||||
- Text: Near Black (`#222222`)
|
||||
- Brand accent: Rausch Red (`#ff385c`)
|
||||
- Secondary text: `#6a6a6a`
|
||||
- Disabled: `rgba(0,0,0,0.24)`
|
||||
- Card border: `rgba(0,0,0,0.02) 0px 0px 0px 1px`
|
||||
- Card shadow: full three-layer stack
|
||||
- Button surface: `#f2f2f2`
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a listing card: white background, 20px radius. Three-layer shadow: rgba(0,0,0,0.02) 0px 0px 0px 1px, rgba(0,0,0,0.04) 0px 2px 6px, rgba(0,0,0,0.1) 0px 4px 8px. Photo area on top (16:10 ratio), details below: 16px Airbnb Cereal VF weight 600 title, 14px weight 400 description in #6a6a6a."
|
||||
- "Design search bar: white background, full card shadow, 32px radius on container. Search text at 14px Cereal VF weight 400. Red search button (#ff385c, 50% radius, white icon)."
|
||||
- "Build category pill bar: horizontal scrollable row. Each pill: 14px Cereal VF weight 600, #222222 text, bottom border on active. Circular prev/next arrows (#f2f2f2 bg, 50% radius)."
|
||||
- "Create a CTA button: #222222 background, white text, 8px radius, 16px Cereal VF weight 500, 0px 24px padding. Hover: brand red accent."
|
||||
- "Design a heart/wishlist button: transparent background, 50% radius, white heart icon with dark shadow outline."
|
||||
|
||||
### Iteration Guide
|
||||
1. Start with white — the photography provides all the color
|
||||
2. Rausch Red (#ff385c) is the singular accent — use sparingly for CTAs only
|
||||
3. Near-black (#222222) for text — the warmth matters
|
||||
4. Three-layer shadows create natural, warm lift — always use all three layers
|
||||
5. Generous radius: 8px buttons, 20px cards, 50% controls
|
||||
6. Cereal VF at 500–700 weight — no thin weights for any heading
|
||||
7. Photography is hero — every listing card is image-first
|
||||
102
skills/creative/popular-web-designs/templates/airtable.md
Normal file
102
skills/creative/popular-web-designs/templates/airtable.md
Normal file
@@ -0,0 +1,102 @@
|
||||
# Design System: Airtable
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `system monospace stack`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Airtable's website is a clean, enterprise-friendly platform that communicates "sophisticated simplicity" through a white canvas with deep navy text (`#181d26`) and Airtable Blue (`#1b61c9`) as the primary interactive accent. The Haas font family (display + text variants) creates a Swiss-precision typography system with positive letter-spacing throughout.
|
||||
|
||||
**Key Characteristics:**
|
||||
- White canvas with deep navy text (`#181d26`)
|
||||
- Airtable Blue (`#1b61c9`) as primary CTA and link color
|
||||
- Haas + Haas Groot Disp dual font system
|
||||
- Positive letter-spacing on body text (0.08px–0.28px)
|
||||
- 12px radius buttons, 16px–32px for cards
|
||||
- Multi-layer blue-tinted shadow: `rgba(45,127,249,0.28) 0px 1px 3px`
|
||||
- Semantic theme tokens: `--theme_*` CSS variable naming
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Deep Navy** (`#181d26`): Primary text
|
||||
- **Airtable Blue** (`#1b61c9`): CTA buttons, links
|
||||
- **White** (`#ffffff`): Primary surface
|
||||
- **Spotlight** (`rgba(249,252,255,0.97)`): `--theme_button-text-spotlight`
|
||||
|
||||
### Semantic
|
||||
- **Success Green** (`#006400`): `--theme_success-text`
|
||||
- **Weak Text** (`rgba(4,14,32,0.69)`): `--theme_text-weak`
|
||||
- **Secondary Active** (`rgba(7,12,20,0.82)`): `--theme_button-text-secondary-active`
|
||||
|
||||
### Neutral
|
||||
- **Dark Gray** (`#333333`): Secondary text
|
||||
- **Mid Blue** (`#254fad`): Link/accent blue variant
|
||||
- **Border** (`#e0e2e6`): Card borders
|
||||
- **Light Surface** (`#f8fafc`): Subtle surface
|
||||
|
||||
### Shadows
|
||||
- **Blue-tinted** (`rgba(0,0,0,0.32) 0px 0px 1px, rgba(0,0,0,0.08) 0px 0px 2px, rgba(45,127,249,0.28) 0px 1px 3px, rgba(0,0,0,0.06) 0px 0px 0px 0.5px inset`)
|
||||
- **Soft** (`rgba(15,48,106,0.05) 0px 0px 20px`)
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Families
|
||||
- **Primary**: `Haas`, fallbacks: `-apple-system, system-ui, Segoe UI, Roboto`
|
||||
- **Display**: `Haas Groot Disp`, fallback: `Haas`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing |
|
||||
|------|------|------|--------|-------------|----------------|
|
||||
| Display Hero | Haas | 48px | 400 | 1.15 | normal |
|
||||
| Display Bold | Haas Groot Disp | 48px | 900 | 1.50 | normal |
|
||||
| Section Heading | Haas | 40px | 400 | 1.25 | normal |
|
||||
| Sub-heading | Haas | 32px | 400–500 | 1.15–1.25 | normal |
|
||||
| Card Title | Haas | 24px | 400 | 1.20–1.30 | 0.12px |
|
||||
| Feature | Haas | 20px | 400 | 1.25–1.50 | 0.1px |
|
||||
| Body | Haas | 18px | 400 | 1.35 | 0.18px |
|
||||
| Body Medium | Haas | 16px | 500 | 1.30 | 0.08–0.16px |
|
||||
| Button | Haas | 16px | 500 | 1.25–1.30 | 0.08px |
|
||||
| Caption | Haas | 14px | 400–500 | 1.25–1.35 | 0.07–0.28px |
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
- **Primary Blue**: `#1b61c9`, white text, 16px 24px padding, 12px radius
|
||||
- **White**: white bg, `#181d26` text, 12px radius, 1px border white
|
||||
- **Cookie Consent**: `#1b61c9` bg, 2px radius (sharp)
|
||||
|
||||
### Cards: `1px solid #e0e2e6`, 16px–24px radius
|
||||
### Inputs: Standard Haas styling
|
||||
|
||||
## 5. Layout
|
||||
- Spacing: 1–48px (8px base)
|
||||
- Radius: 2px (small), 12px (buttons), 16px (cards), 24px (sections), 32px (large), 50% (circles)
|
||||
|
||||
## 6. Depth
|
||||
- Blue-tinted multi-layer shadow system
|
||||
- Soft ambient: `rgba(15,48,106,0.05) 0px 0px 20px`
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
### Do: Use Airtable Blue for CTAs, Haas with positive tracking, 12px radius buttons
|
||||
### Don't: Skip positive letter-spacing, use heavy shadows
|
||||
|
||||
## 8. Responsive Behavior
|
||||
Breakpoints: 425–1664px (23 breakpoints)
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
- Text: Deep Navy (`#181d26`)
|
||||
- CTA: Airtable Blue (`#1b61c9`)
|
||||
- Background: White (`#ffffff`)
|
||||
- Border: `#e0e2e6`
|
||||
326
skills/creative/popular-web-designs/templates/apple.md
Normal file
326
skills/creative/popular-web-designs/templates/apple.md
Normal file
@@ -0,0 +1,326 @@
|
||||
# Design System: Apple
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `system-ui` | **Mono:** `SF Mono (system)`
|
||||
> - **Font stack (CSS):** `font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'SF Mono (system)', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <!-- No CDN needed — uses system fonts -->
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Apple's website is a masterclass in controlled drama — vast expanses of pure black and near-white serve as cinematic backdrops for products that are photographed as if they were sculptures in a gallery. The design philosophy is reductive to its core: every pixel exists in service of the product, and the interface itself retreats until it becomes invisible. This is not minimalism as aesthetic preference; it is minimalism as reverence for the object.
|
||||
|
||||
The typography anchors everything. San Francisco (SF Pro Display for large sizes, SF Pro Text for body) is Apple's proprietary typeface, engineered with optical sizing that automatically adjusts letterforms depending on point size. At display sizes (56px), weight 600 with a tight line-height of 1.07 and subtle negative letter-spacing (-0.28px) creates headlines that feel machined rather than typeset — precise, confident, and unapologetically direct. At body sizes (17px), the tracking loosens slightly (-0.374px) and line-height opens to 1.47, creating a reading rhythm that is comfortable without ever feeling slack.
|
||||
|
||||
The color story is starkly binary. Product sections alternate between pure black (`#000000`) backgrounds with white text and light gray (`#f5f5f7`) backgrounds with near-black text (`#1d1d1f`). This creates a cinematic pacing — dark sections feel immersive and premium, light sections feel open and informational. The only chromatic accent is Apple Blue (`#0071e3`), reserved exclusively for interactive elements: links, buttons, and focus states. This singular accent color in a sea of neutrals gives every clickable element unmistakable visibility.
|
||||
|
||||
**Key Characteristics:**
|
||||
- SF Pro Display/Text with optical sizing — letterforms adapt automatically to size context
|
||||
- Binary light/dark section rhythm: black (`#000000`) alternating with light gray (`#f5f5f7`)
|
||||
- Single accent color: Apple Blue (`#0071e3`) reserved exclusively for interactive elements
|
||||
- Product-as-hero photography on solid color fields — no gradients, no textures, no distractions
|
||||
- Extremely tight headline line-heights (1.07-1.14) creating compressed, billboard-like impact
|
||||
- Full-width section layout with centered content — the viewport IS the canvas
|
||||
- Pill-shaped CTAs (980px radius) creating soft, approachable action buttons
|
||||
- Generous whitespace between sections allowing each product moment to breathe
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Pure Black** (`#000000`): Hero section backgrounds, immersive product showcases. The darkest canvas for the brightest products.
|
||||
- **Light Gray** (`#f5f5f7`): Alternate section backgrounds, informational areas. Not white — the slight blue-gray tint prevents sterility.
|
||||
- **Near Black** (`#1d1d1f`): Primary text on light backgrounds, dark button fills. Slightly warmer than pure black for comfortable reading.
|
||||
|
||||
### Interactive
|
||||
- **Apple Blue** (`#0071e3`): `--sk-focus-color`, primary CTA backgrounds, focus rings. The ONLY chromatic color in the interface.
|
||||
- **Link Blue** (`#0066cc`): `--sk-body-link-color`, inline text links. Slightly darker than Apple Blue for text-level readability.
|
||||
- **Bright Blue** (`#2997ff`): Links on dark backgrounds. Higher luminance for contrast on black sections.
|
||||
|
||||
### Text
|
||||
- **White** (`#ffffff`): Text on dark backgrounds, button text on blue/dark CTAs.
|
||||
- **Near Black** (`#1d1d1f`): Primary body text on light backgrounds.
|
||||
- **Black 80%** (`rgba(0, 0, 0, 0.8)`): Secondary text, nav items on light backgrounds. Slightly softened.
|
||||
- **Black 48%** (`rgba(0, 0, 0, 0.48)`): Tertiary text, disabled states, carousel controls.
|
||||
|
||||
### Surface & Dark Variants
|
||||
- **Dark Surface 1** (`#272729`): Card backgrounds in dark sections.
|
||||
- **Dark Surface 2** (`#262628`): Subtle surface variation in dark contexts.
|
||||
- **Dark Surface 3** (`#28282a`): Elevated cards on dark backgrounds.
|
||||
- **Dark Surface 4** (`#2a2a2d`): Highest dark surface elevation.
|
||||
- **Dark Surface 5** (`#242426`): Deepest dark surface tone.
|
||||
|
||||
### Button States
|
||||
- **Button Active** (`#ededf2`): Active/pressed state for light buttons.
|
||||
- **Button Default Light** (`#fafafc`): Search/filter button backgrounds.
|
||||
- **Overlay** (`rgba(210, 210, 215, 0.64)`): Media control scrims, overlays.
|
||||
- **White 32%** (`rgba(255, 255, 255, 0.32)`): Hover state on dark modal close buttons.
|
||||
|
||||
### Shadows
|
||||
- **Card Shadow** (`rgba(0, 0, 0, 0.22) 3px 5px 30px 0px`): Soft, diffused elevation for product cards. Offset and wide blur create a natural, photographic shadow.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Display**: `SF Pro Display`, with fallbacks: `SF Pro Icons, Helvetica Neue, Helvetica, Arial, sans-serif`
|
||||
- **Body**: `SF Pro Text`, with fallbacks: `SF Pro Icons, Helvetica Neue, Helvetica, Arial, sans-serif`
|
||||
- SF Pro Display is used at 20px and above; SF Pro Text is optimized for 19px and below.
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | SF Pro Display | 56px (3.50rem) | 600 | 1.07 (tight) | -0.28px | Product launch headlines, maximum impact |
|
||||
| Section Heading | SF Pro Display | 40px (2.50rem) | 600 | 1.10 (tight) | normal | Feature section titles |
|
||||
| Tile Heading | SF Pro Display | 28px (1.75rem) | 400 | 1.14 (tight) | 0.196px | Product tile headlines |
|
||||
| Card Title | SF Pro Display | 21px (1.31rem) | 700 | 1.19 (tight) | 0.231px | Bold card headings |
|
||||
| Sub-heading | SF Pro Display | 21px (1.31rem) | 400 | 1.19 (tight) | 0.231px | Regular card headings |
|
||||
| Nav Heading | SF Pro Text | 34px (2.13rem) | 600 | 1.47 | -0.374px | Large navigation headings |
|
||||
| Sub-nav | SF Pro Text | 24px (1.50rem) | 300 | 1.50 | normal | Light sub-navigation text |
|
||||
| Body | SF Pro Text | 17px (1.06rem) | 400 | 1.47 | -0.374px | Standard reading text |
|
||||
| Body Emphasis | SF Pro Text | 17px (1.06rem) | 600 | 1.24 (tight) | -0.374px | Emphasized body text, labels |
|
||||
| Button Large | SF Pro Text | 18px (1.13rem) | 300 | 1.00 (tight) | normal | Large button text, light weight |
|
||||
| Button | SF Pro Text | 17px (1.06rem) | 400 | 2.41 (relaxed) | normal | Standard button text |
|
||||
| Link | SF Pro Text | 14px (0.88rem) | 400 | 1.43 | -0.224px | Body links, "Learn more" |
|
||||
| Caption | SF Pro Text | 14px (0.88rem) | 400 | 1.29 (tight) | -0.224px | Secondary text, descriptions |
|
||||
| Caption Bold | SF Pro Text | 14px (0.88rem) | 600 | 1.29 (tight) | -0.224px | Emphasized captions |
|
||||
| Micro | SF Pro Text | 12px (0.75rem) | 400 | 1.33 | -0.12px | Fine print, footnotes |
|
||||
| Micro Bold | SF Pro Text | 12px (0.75rem) | 600 | 1.33 | -0.12px | Bold fine print |
|
||||
| Nano | SF Pro Text | 10px (0.63rem) | 400 | 1.47 | -0.08px | Legal text, smallest size |
|
||||
|
||||
### Principles
|
||||
- **Optical sizing as philosophy**: SF Pro automatically switches between Display and Text optical sizes. Display versions have wider letter spacing and thinner strokes optimized for large sizes; Text versions are tighter and sturdier for small sizes. This means the font literally changes its DNA based on context.
|
||||
- **Weight restraint**: The scale spans 300 (light) to 700 (bold) but most text lives at 400 (regular) and 600 (semibold). Weight 300 appears only on large decorative text. Weight 700 is rare, used only for bold card titles.
|
||||
- **Negative tracking at all sizes**: Unlike most systems that only track headlines, Apple applies subtle negative letter-spacing even at body sizes (-0.374px at 17px, -0.224px at 14px, -0.12px at 12px). This creates universally tight, efficient text.
|
||||
- **Extreme line-height range**: Headlines compress to 1.07 while body text opens to 1.47, and some button contexts stretch to 2.41. This dramatic range creates clear visual hierarchy through rhythm alone.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary Blue (CTA)**
|
||||
- Background: `#0071e3` (Apple Blue)
|
||||
- Text: `#ffffff`
|
||||
- Padding: 8px 15px
|
||||
- Radius: 8px
|
||||
- Border: 1px solid transparent
|
||||
- Font: SF Pro Text, 17px, weight 400
|
||||
- Hover: background brightens slightly
|
||||
- Active: `#ededf2` background shift
|
||||
- Focus: `2px solid var(--sk-focus-color, #0071E3)` outline
|
||||
- Use: Primary call-to-action ("Buy", "Shop iPhone")
|
||||
|
||||
**Primary Dark**
|
||||
- Background: `#1d1d1f`
|
||||
- Text: `#ffffff`
|
||||
- Padding: 8px 15px
|
||||
- Radius: 8px
|
||||
- Font: SF Pro Text, 17px, weight 400
|
||||
- Use: Secondary CTA, dark variant
|
||||
|
||||
**Pill Link (Learn More / Shop)**
|
||||
- Background: transparent
|
||||
- Text: `#0066cc` (light bg) or `#2997ff` (dark bg)
|
||||
- Radius: 980px (full pill)
|
||||
- Border: 1px solid `#0066cc`
|
||||
- Font: SF Pro Text, 14px-17px
|
||||
- Hover: underline decoration
|
||||
- Use: "Learn more" and "Shop" links — the signature Apple inline CTA
|
||||
|
||||
**Filter / Search Button**
|
||||
- Background: `#fafafc`
|
||||
- Text: `rgba(0, 0, 0, 0.8)`
|
||||
- Padding: 0px 14px
|
||||
- Radius: 11px
|
||||
- Border: 3px solid `rgba(0, 0, 0, 0.04)`
|
||||
- Focus: `2px solid var(--sk-focus-color, #0071E3)` outline
|
||||
- Use: Search bars, filter controls
|
||||
|
||||
**Media Control**
|
||||
- Background: `rgba(210, 210, 215, 0.64)`
|
||||
- Text: `rgba(0, 0, 0, 0.48)`
|
||||
- Radius: 50% (circular)
|
||||
- Active: scale(0.9), background shifts
|
||||
- Focus: `2px solid var(--sk-focus-color, #0071e3)` outline, white bg, black text
|
||||
- Use: Play/pause, carousel arrows
|
||||
|
||||
### Cards & Containers
|
||||
- Background: `#f5f5f7` (light) or `#272729`-`#2a2a2d` (dark)
|
||||
- Border: none (borders are rare in Apple's system)
|
||||
- Radius: 5px-8px
|
||||
- Shadow: `rgba(0, 0, 0, 0.22) 3px 5px 30px 0px` for elevated product cards
|
||||
- Content: centered, generous padding
|
||||
- Hover: no standard hover state — cards are static, links within them are interactive
|
||||
|
||||
### Navigation
|
||||
- Background: `rgba(0, 0, 0, 0.8)` (translucent dark) with `backdrop-filter: saturate(180%) blur(20px)`
|
||||
- Height: 48px (compact)
|
||||
- Text: `#ffffff` at 12px, weight 400
|
||||
- Active: underline on hover
|
||||
- Logo: Apple logomark (SVG) centered or left-aligned, 17x48px viewport
|
||||
- Mobile: collapses to hamburger with full-screen overlay menu
|
||||
- The nav floats above content, maintaining its dark translucent glass regardless of section background
|
||||
|
||||
### Image Treatment
|
||||
- Products on solid-color fields (black or white) — no backgrounds, no context, just the object
|
||||
- Full-bleed section images that span the entire viewport width
|
||||
- Product photography at extremely high resolution with subtle shadows
|
||||
- Lifestyle images confined to rounded-corner containers (12px+ radius)
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Product Hero Module**
|
||||
- Full-viewport-width section with solid background (black or `#f5f5f7`)
|
||||
- Product name as the primary headline (SF Pro Display, 56px, weight 600)
|
||||
- One-line descriptor below in lighter weight
|
||||
- Two pill CTAs side by side: "Learn more" (outline) and "Buy" / "Shop" (filled)
|
||||
|
||||
**Product Grid Tile**
|
||||
- Square or near-square card on contrasting background
|
||||
- Product image dominating 60-70% of the tile
|
||||
- Product name + one-line description below
|
||||
- "Learn more" and "Shop" link pair at bottom
|
||||
|
||||
**Feature Comparison Strip**
|
||||
- Horizontal scroll of product variants
|
||||
- Each variant as a vertical card with image, name, and key specs
|
||||
- Minimal chrome — the products speak for themselves
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 2px, 4px, 5px, 6px, 7px, 8px, 9px, 10px, 11px, 14px, 15px, 17px, 20px, 24px
|
||||
- Notable characteristic: the scale is dense at small sizes (2-11px) with granular 1px increments, then jumps in larger steps. This allows precise micro-adjustments for typography and icon alignment.
|
||||
|
||||
### Grid & Container
|
||||
- Max content width: approximately 980px (the recurring "980px radius" in pill buttons echoes this width)
|
||||
- Hero: full-viewport-width sections with centered content block
|
||||
- Product grids: 2-3 column layouts within centered container
|
||||
- Single-column for hero moments — one product, one message, full attention
|
||||
- No visible grid lines or gutters — spacing creates implied structure
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Cinematic breathing room**: Each product section occupies a full viewport height (or close to it). The whitespace between products is not empty — it is the pause between scenes in a film.
|
||||
- **Vertical rhythm through color blocks**: Rather than using spacing alone to separate sections, Apple uses alternating background colors (black, `#f5f5f7`, white). Each color change signals a new "scene."
|
||||
- **Compression within, expansion between**: Text blocks are tightly set (negative letter-spacing, tight line-heights) while the space surrounding them is vast. This creates a tension between density and openness.
|
||||
|
||||
### Border Radius Scale
|
||||
- Micro (5px): Small containers, link tags
|
||||
- Standard (8px): Buttons, product cards, image containers
|
||||
- Comfortable (11px): Search inputs, filter buttons
|
||||
- Large (12px): Feature panels, lifestyle image containers
|
||||
- Full Pill (980px): CTA links ("Learn more", "Shop"), navigation pills
|
||||
- Circle (50%): Media controls (play/pause, arrows)
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow, solid background | Standard content sections, text blocks |
|
||||
| Navigation Glass | `backdrop-filter: saturate(180%) blur(20px)` on `rgba(0,0,0,0.8)` | Sticky navigation bar — the glass effect |
|
||||
| Subtle Lift (Level 1) | `rgba(0, 0, 0, 0.22) 3px 5px 30px 0px` | Product cards, floating elements |
|
||||
| Media Control | `rgba(210, 210, 215, 0.64)` background with scale transforms | Play/pause buttons, carousel controls |
|
||||
| Focus (Accessibility) | `2px solid #0071e3` outline | Keyboard focus on all interactive elements |
|
||||
|
||||
**Shadow Philosophy**: Apple uses shadow extremely sparingly. The primary shadow (`3px 5px 30px` with 0.22 opacity) is soft, wide, and offset — mimicking a diffused studio light casting a natural shadow beneath a physical object. This reinforces the "product as physical sculpture" metaphor. Most elements have NO shadow at all; elevation comes from background color contrast (dark card on darker background, or light card on slightly different gray).
|
||||
|
||||
### Decorative Depth
|
||||
- Navigation glass: the translucent, blurred navigation bar is the most recognizable depth element, creating a sense of floating UI above scrolling content
|
||||
- Section color transitions: depth is implied by the alternation between black and light gray sections rather than by shadows
|
||||
- Product photography shadows: the products themselves cast shadows in their photography, so the UI doesn't need to add synthetic ones
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use SF Pro Display at 20px+ and SF Pro Text below 20px — respect the optical sizing boundary
|
||||
- Apply negative letter-spacing at all text sizes (not just headlines) — Apple tracks tight universally
|
||||
- Use Apple Blue (`#0071e3`) ONLY for interactive elements — it must be the singular accent
|
||||
- Alternate between black and light gray (`#f5f5f7`) section backgrounds for cinematic rhythm
|
||||
- Use 980px pill radius for CTA links — the signature Apple link shape
|
||||
- Keep product imagery on solid-color fields with no competing visual elements
|
||||
- Use the translucent dark glass (`rgba(0,0,0,0.8)` + blur) for sticky navigation
|
||||
- Compress headline line-heights to 1.07-1.14 — Apple headlines are famously tight
|
||||
|
||||
### Don't
|
||||
- Don't introduce additional accent colors — the entire chromatic budget is spent on blue
|
||||
- Don't use heavy shadows or multiple shadow layers — Apple's shadow system is one soft diffused shadow or nothing
|
||||
- Don't use borders on cards or containers — Apple almost never uses visible borders (except on specific buttons)
|
||||
- Don't apply wide letter-spacing to SF Pro — it is designed to run tight at every size
|
||||
- Don't use weight 800 or 900 — the maximum is 700 (bold), and even that is rare
|
||||
- Don't add textures, patterns, or gradients to backgrounds — solid colors only
|
||||
- Don't make the navigation opaque — the glass blur effect is essential to the Apple UI identity
|
||||
- Don't center-align body text — Apple body copy is left-aligned; only headlines center
|
||||
- Don't use rounded corners larger than 12px on rectangular elements (980px is for pills only)
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Small Mobile | <360px | Minimum supported, single column |
|
||||
| Mobile | 360-480px | Standard mobile layout |
|
||||
| Mobile Large | 480-640px | Wider single column, larger images |
|
||||
| Tablet Small | 640-834px | 2-column product grids begin |
|
||||
| Tablet | 834-1024px | Full tablet layout, expanded nav |
|
||||
| Desktop Small | 1024-1070px | Standard desktop layout begins |
|
||||
| Desktop | 1070-1440px | Full layout, max content width |
|
||||
| Large Desktop | >1440px | Centered with generous margins |
|
||||
|
||||
### Touch Targets
|
||||
- Primary CTAs: 8px 15px padding creating ~44px touch height
|
||||
- Navigation links: 48px height with adequate spacing
|
||||
- Media controls: 50% radius circular buttons, minimum 44x44px
|
||||
- "Learn more" pills: generous padding for comfortable tapping
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero headlines: 56px Display → 40px → 28px on mobile, maintaining tight line-height proportionally
|
||||
- Product grids: 3-column → 2-column → single column stacked
|
||||
- Navigation: full horizontal nav → compact mobile menu (hamburger)
|
||||
- Product hero modules: full-bleed maintained at all sizes, text scales down
|
||||
- Section backgrounds: maintain full-width color blocks at all breakpoints — the cinematic rhythm never breaks
|
||||
- Image sizing: products scale proportionally, never crop — the product silhouette is sacred
|
||||
|
||||
### Image Behavior
|
||||
- Product photography maintains aspect ratio at all breakpoints
|
||||
- Hero product images scale down but stay centered
|
||||
- Full-bleed section backgrounds persist at every size
|
||||
- Lifestyle images may crop on mobile but maintain their rounded corners
|
||||
- Lazy loading for below-fold product images
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary CTA: Apple Blue (`#0071e3`)
|
||||
- Page background (light): `#f5f5f7`
|
||||
- Page background (dark): `#000000`
|
||||
- Heading text (light): `#1d1d1f`
|
||||
- Heading text (dark): `#ffffff`
|
||||
- Body text: `rgba(0, 0, 0, 0.8)` on light, `#ffffff` on dark
|
||||
- Link (light bg): `#0066cc`
|
||||
- Link (dark bg): `#2997ff`
|
||||
- Focus ring: `#0071e3`
|
||||
- Card shadow: `rgba(0, 0, 0, 0.22) 3px 5px 30px 0px`
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on black background. Headline at 56px SF Pro Display weight 600, line-height 1.07, letter-spacing -0.28px, color white. One-line subtitle at 21px SF Pro Display weight 400, line-height 1.19, color white. Two pill CTAs: 'Learn more' (transparent bg, white text, 1px solid white border, 980px radius) and 'Buy' (Apple Blue #0071e3 bg, white text, 8px radius, 8px 15px padding)."
|
||||
- "Design a product card: #f5f5f7 background, 8px border-radius, no border, no shadow. Product image top 60% of card on solid background. Title at 28px SF Pro Display weight 400, letter-spacing 0.196px, line-height 1.14. Description at 14px SF Pro Text weight 400, color rgba(0,0,0,0.8). 'Learn more' and 'Shop' links in #0066cc at 14px."
|
||||
- "Build the Apple navigation: sticky, 48px height, background rgba(0,0,0,0.8) with backdrop-filter: saturate(180%) blur(20px). Links at 12px SF Pro Text weight 400, white text. Apple logo left, links centered, search and bag icons right."
|
||||
- "Create an alternating section layout: first section black bg with white text and centered product image, second section #f5f5f7 bg with #1d1d1f text. Each section near full-viewport height with 56px headline and two pill CTAs below."
|
||||
- "Design a 'Learn more' link: text #0066cc on light bg or #2997ff on dark bg, 14px SF Pro Text, underline on hover. After the text, include a right-arrow chevron character (>). Wrap in a container with 980px border-radius for pill shape when used as a standalone CTA."
|
||||
|
||||
### Iteration Guide
|
||||
1. Every interactive element gets Apple Blue (`#0071e3`) — no other accent colors
|
||||
2. Section backgrounds alternate: black for immersive moments, `#f5f5f7` for informational moments
|
||||
3. Typography optical sizing: SF Pro Display at 20px+, SF Pro Text below — never mix
|
||||
4. Negative letter-spacing at all sizes: -0.28px at 56px, -0.374px at 17px, -0.224px at 14px, -0.12px at 12px
|
||||
5. The navigation glass effect (translucent dark + blur) is non-negotiable — it defines the Apple web experience
|
||||
6. Products always appear on solid color fields — never on gradients, textures, or lifestyle backgrounds in hero modules
|
||||
7. Shadow is rare and always soft: `3px 5px 30px 0.22 opacity` or nothing at all
|
||||
8. Pill CTAs use 980px radius — this creates the signature Apple rounded-rectangle-that-looks-like-a-capsule shape
|
||||
193
skills/creative/popular-web-designs/templates/bmw.md
Normal file
193
skills/creative/popular-web-designs/templates/bmw.md
Normal file
@@ -0,0 +1,193 @@
|
||||
# Design System: BMW
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `DM Sans` | **Mono:** `system monospace stack`
|
||||
> - **Font stack (CSS):** `font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
BMW's website is automotive engineering made visual — a design system that communicates precision, performance, and German industrial confidence. The page alternates between deep dark hero sections (featuring full-bleed automotive photography) and clean white content areas, creating a cinematic rhythm reminiscent of a luxury car showroom where vehicles are lit against darkness. The BMW CI2020 design language (their corporate identity refresh) defines every element.
|
||||
|
||||
The typography is built on BMWTypeNextLatin — a proprietary typeface in two variants: BMWTypeNextLatin Light (weight 300) for massive uppercase display headings, and BMWTypeNextLatin Regular for body and UI text. The 60px uppercase headline at weight 300 is the defining typographic gesture — light-weight type that whispers authority rather than shouting it. The fallback stack includes Helvetica and Japanese fonts (Hiragino, Meiryo), reflecting BMW's global presence.
|
||||
|
||||
What makes BMW distinctive is its CSS variable-driven theming system. Context-aware variables (`--site-context-highlight-color: #1c69d4`, `--site-context-focus-color: #0653b6`, `--site-context-metainfo-color: #757575`) suggest a design system built for multi-brand, multi-context deployment where colors can be swapped globally. The blue highlight color (`#1c69d4`) is BMW's signature blue — used sparingly for interactive elements and focus states, never decoratively. Zero border-radius was detected — BMW's design is angular, sharp-cornered, and uncompromisingly geometric.
|
||||
|
||||
**Key Characteristics:**
|
||||
- BMWTypeNextLatin Light (weight 300) uppercase for display — whispered authority
|
||||
- BMW Blue (`#1c69d4`) as singular accent — used only for interactive elements
|
||||
- Zero border-radius detected — angular, sharp-cornered, industrial geometry
|
||||
- Dark hero photography + white content sections — showroom lighting rhythm
|
||||
- CSS variable-driven theming: `--site-context-*` tokens for brand flexibility
|
||||
- Weight 900 for navigation emphasis — extreme contrast with 300 display
|
||||
- Tight line-heights (1.15–1.30) throughout — compressed, efficient, German engineering
|
||||
- Full-bleed automotive photography as primary visual content
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary Brand
|
||||
- **Pure White** (`#ffffff`): `--site-context-theme-color`, primary surface, card backgrounds
|
||||
- **BMW Blue** (`#1c69d4`): `--site-context-highlight-color`, primary interactive accent
|
||||
- **BMW Focus Blue** (`#0653b6`): `--site-context-focus-color`, keyboard focus and active states
|
||||
|
||||
### Neutral Scale
|
||||
- **Near Black** (`#262626`): Primary text on light surfaces, dark link text
|
||||
- **Meta Gray** (`#757575`): `--site-context-metainfo-color`, secondary text, metadata
|
||||
- **Silver** (`#bbbbbb`): Tertiary text, muted links, footer elements
|
||||
|
||||
### Interactive States
|
||||
- All links hover to white (`#ffffff`) — suggesting primarily dark-surface navigation
|
||||
- Text links use underline: none on hover — clean interaction
|
||||
|
||||
### Shadows
|
||||
- Minimal shadow system — depth through photography and dark/light section contrast
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Families
|
||||
- **Display Light**: `BMWTypeNextLatin Light`, fallbacks: `Helvetica, Arial, Hiragino Kaku Gothic ProN, Hiragino Sans, Meiryo`
|
||||
- **Body / UI**: `BMWTypeNextLatin`, same fallback stack
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Notes |
|
||||
|------|------|------|--------|-------------|-------|
|
||||
| Display Hero | BMWTypeNextLatin Light | 60px (3.75rem) | 300 | 1.30 (tight) | `text-transform: uppercase` |
|
||||
| Section Heading | BMWTypeNextLatin | 32px (2.00rem) | 400 | 1.30 (tight) | Major section titles |
|
||||
| Nav Emphasis | BMWTypeNextLatin | 18px (1.13rem) | 900 | 1.30 (tight) | Navigation bold items |
|
||||
| Body | BMWTypeNextLatin | 16px (1.00rem) | 400 | 1.15 (tight) | Standard body text |
|
||||
| Button Bold | BMWTypeNextLatin | 16px (1.00rem) | 700 | 1.20–2.88 | CTA buttons |
|
||||
| Button | BMWTypeNextLatin | 16px (1.00rem) | 400 | 1.15 (tight) | Standard buttons |
|
||||
|
||||
### Principles
|
||||
- **Light display, heavy navigation**: Weight 300 for hero headlines creates whispered elegance; weight 900 for navigation creates stark authority. This extreme weight contrast (300 vs 900) is the signature typographic tension.
|
||||
- **Universal uppercase display**: The 60px hero is always uppercase — creating a monumental, architectural quality.
|
||||
- **Tight everything**: Line-heights from 1.15 to 1.30 across the entire system. Nothing breathes — every line is compressed, efficient, German-engineered.
|
||||
- **Single font family**: BMWTypeNextLatin handles everything from 60px display to 16px body — unity through one typeface at different weights.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
- Text: 16px BMWTypeNextLatin, weight 700 for primary, 400 for secondary
|
||||
- Line-height: 1.15–2.88 (large variation suggests padding-driven sizing)
|
||||
- Border: white bottom-border on dark surfaces (`1px solid #ffffff`)
|
||||
- No border-radius — sharp rectangular buttons
|
||||
|
||||
### Cards & Containers
|
||||
- No border-radius — all containers are sharp-cornered rectangles
|
||||
- White backgrounds on light sections
|
||||
- Dark backgrounds for hero/feature sections
|
||||
- No visible borders on most elements
|
||||
|
||||
### Navigation
|
||||
- BMWTypeNextLatin 18px weight 900 for primary nav links
|
||||
- White text on dark header
|
||||
- BMW logo 54x54px
|
||||
- Hover: remains white, text-decoration none
|
||||
- "Home" text link in header
|
||||
|
||||
### Image Treatment
|
||||
- Full-bleed automotive photography
|
||||
- Dark cinematic lighting
|
||||
- Edge-to-edge hero images
|
||||
- Car photography as primary visual content
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 1px, 5px, 8px, 10px, 12px, 15px, 16px, 20px, 24px, 30px, 32px, 40px, 45px, 56px, 60px
|
||||
|
||||
### Grid & Container
|
||||
- Full-width hero photography
|
||||
- Centered content sections
|
||||
- Footer: multi-column link grid
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Showroom pacing**: Dark hero sections with generous padding create the feeling of walking through a showroom where each vehicle is spotlit in its own space.
|
||||
- **Compressed content**: Body text areas use tight line-heights and compact spacing — information-dense, no waste.
|
||||
|
||||
### Border Radius Scale
|
||||
- **None detected.** BMW uses sharp corners exclusively — every element is a precise rectangle. This is the most angular design system analyzed.
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Photography (Level 0) | Full-bleed dark imagery | Hero backgrounds |
|
||||
| Flat (Level 1) | White surface, no shadow | Content sections |
|
||||
| Focus (Accessibility) | BMW Focus Blue (`#0653b6`) | Focus states |
|
||||
|
||||
**Shadow Philosophy**: BMW uses virtually no shadows. Depth is created entirely through the contrast between dark photographic sections and white content sections — the automotive lighting does the elevation work.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use BMWTypeNextLatin Light (300) uppercase for all display headings
|
||||
- Keep ALL corners sharp (0px radius) — angular geometry is non-negotiable
|
||||
- Use BMW Blue (`#1c69d4`) only for interactive elements — never decoratively
|
||||
- Apply weight 900 for navigation emphasis — the extreme weight contrast is intentional
|
||||
- Use full-bleed automotive photography for hero sections
|
||||
- Keep line-heights tight (1.15–1.30) throughout
|
||||
- Use `--site-context-*` CSS variables for theming
|
||||
|
||||
### Don't
|
||||
- Don't round corners — zero radius is the BMW identity
|
||||
- Don't use BMW Blue for backgrounds or large surfaces — it's an accent only
|
||||
- Don't use medium font weights (500–600) — the system uses 300, 400, 700, 900 extremes
|
||||
- Don't add decorative elements — the photography and typography carry everything
|
||||
- Don't use relaxed line-heights — BMW text is always compressed
|
||||
- Don't lighten the dark hero sections — the contrast with white IS the design
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile Small | <375px | Minimum supported |
|
||||
| Mobile | 375–480px | Single column |
|
||||
| Mobile Large | 480–640px | Slight adjustments |
|
||||
| Tablet Small | 640–768px | 2-column begins |
|
||||
| Tablet | 768–920px | Standard tablet |
|
||||
| Desktop Small | 920–1024px | Desktop layout begins |
|
||||
| Desktop | 1024–1280px | Standard desktop |
|
||||
| Large Desktop | 1280–1440px | Expanded |
|
||||
| Ultra-wide | 1440–1600px | Maximum layout |
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero: 60px → scales down, maintains uppercase
|
||||
- Navigation: horizontal → hamburger
|
||||
- Photography: full-bleed maintained at all sizes
|
||||
- Content sections: stack vertically
|
||||
- Footer: multi-column → stacked
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Background: Pure White (`#ffffff`)
|
||||
- Text: Near Black (`#262626`)
|
||||
- Secondary text: Meta Gray (`#757575`)
|
||||
- Accent: BMW Blue (`#1c69d4`)
|
||||
- Focus: BMW Focus Blue (`#0653b6`)
|
||||
- Muted: Silver (`#bbbbbb`)
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero: full-width dark automotive photography background. Heading at 60px BMWTypeNextLatin Light weight 300, uppercase, line-height 1.30, white text. No border-radius anywhere."
|
||||
- "Design navigation: dark background. BMWTypeNextLatin 18px weight 900 for links, white text. BMW logo 54x54. Sharp rectangular layout."
|
||||
- "Build a button: 16px BMWTypeNextLatin weight 700, line-height 1.20. Sharp corners (0px radius). White bottom border on dark surface."
|
||||
- "Create content section: white background. Heading at 32px weight 400, line-height 1.30, #262626. Body at 16px weight 400, line-height 1.15."
|
||||
|
||||
### Iteration Guide
|
||||
1. Zero border-radius — every corner is sharp, no exceptions
|
||||
2. Weight extremes: 300 (display), 400 (body), 700 (buttons), 900 (nav)
|
||||
3. BMW Blue for interactive only — never as background or decoration
|
||||
4. Photography carries emotion — the UI is pure precision
|
||||
5. Tight line-heights everywhere — 1.15 to 1.30 is the range
|
||||
272
skills/creative/popular-web-designs/templates/cal.md
Normal file
272
skills/creative/popular-web-designs/templates/cal.md
Normal file
@@ -0,0 +1,272 @@
|
||||
# Design System: Cal.com
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `Roboto Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Roboto+Mono:wght@400;500;700&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Cal.com's website is a masterclass in monochromatic restraint — a grayscale world where boldness comes not from color but from the sheer confidence of black text on white space. Inspired by Uber's minimal aesthetic, the palette is deliberately stripped of hue: near-black headings (`#242424`), mid-gray secondary text (`#898989`), and pure white surfaces. Color is treated as a foreign substance — when it appears (a rare blue link, a green trust badge), it feels like a controlled accent in an otherwise black-and-white photograph.
|
||||
|
||||
Cal Sans, the brand's custom geometric display typeface designed by Mark Davis, is the visual centerpiece. Letters are intentionally spaced extremely close at large sizes, creating dense, architectural headlines that feel like they're carved into the page. At 64px and 48px, Cal Sans headings sit at weight 600 with a tight 1.10 line-height — confident, compressed, and immediately recognizable. For body text, the system switches to Inter, providing "rock-solid" readability that complements Cal Sans's display personality. The typography pairing creates a clear division: Cal Sans speaks, Inter explains.
|
||||
|
||||
The elevation system is notably sophisticated for a minimal site — 11 shadow definitions create a nuanced depth hierarchy using multi-layered shadows that combine ring borders (`0px 0px 0px 1px`), soft diffused shadows, and inset highlights. This shadow-first approach to depth (rather than border-first) gives surfaces a subtle three-dimensionality that feels modern and polished. Built on Framer with a border-radius scale from 2px to 9999px (pill), Cal.com balances geometric precision with soft, rounded interactive elements.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Purely grayscale brand palette — no brand colors, boldness through monochrome
|
||||
- Cal Sans custom geometric display font with extremely tight default letter-spacing
|
||||
- Multi-layered shadow system (11 definitions) with ring borders + diffused shadows + inset highlights
|
||||
- Cal Sans for headings, Inter for body — clean typographic division
|
||||
- Wide border-radius scale from 2px to 9999px (pill) — versatile rounding
|
||||
- White canvas with near-black (#242424) text — maximum contrast, zero decoration
|
||||
- Product screenshots as primary visual content — the scheduling UI sells itself
|
||||
- Built on Framer platform
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Charcoal** (`#242424`): Primary heading and button text — Cal.com's signature near-black, warmer than pure black
|
||||
- **Midnight** (`#111111`): Deepest text/overlay color — used at 50% opacity for subtle overlays
|
||||
- **White** (`#ffffff`): Primary background and surface — the dominant canvas
|
||||
|
||||
### Secondary & Accent
|
||||
- **Link Blue** (`#0099ff`): In-text links with underline decoration — the only blue in the system, reserved strictly for hyperlinks
|
||||
- **Focus Ring** (`#3b82f6` at 50% opacity): Keyboard focus indicator — accessibility-only, invisible in normal interaction
|
||||
- **Default Link** (`#0000ee`): Browser-default link color on some elements — unmodified, signaling openness
|
||||
|
||||
### Surface & Background
|
||||
- **Pure White** (`#ffffff`): Primary page background and card surfaces
|
||||
- **Light Gray** (approx `#f5f5f5`): Subtle section differentiation — barely visible tint
|
||||
- **Mid Gray** (`#898989`): Secondary text, descriptions, and muted labels
|
||||
|
||||
### Neutrals & Text
|
||||
- **Charcoal** (`#242424`): Headlines, buttons, primary UI text
|
||||
- **Midnight** (`#111111`): Deep black for high-contrast links and nav text
|
||||
- **Mid Gray** (`#898989`): Descriptions, secondary labels, muted content
|
||||
- **Pure Black** (`#000000`): Certain link text elements
|
||||
- **Border Gray** (approx `rgba(34, 42, 53, 0.08–0.10)`): Shadow-based borders using ring shadows instead of CSS borders
|
||||
|
||||
### Semantic & Accent
|
||||
- Cal.com is deliberately colorless for brand elements — "a grayscale brand to emphasise on boldness and professionalism"
|
||||
- Product UI screenshots show color (blues, greens in the scheduling interface), but the marketing site itself stays monochrome
|
||||
- The philosophy mirrors Uber's approach: let the content carry color, the frame stays neutral
|
||||
|
||||
### Gradient System
|
||||
- No gradients on the marketing site — the design is fully flat and monochrome
|
||||
- Depth is achieved entirely through shadows, not color transitions
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Display**: `Cal Sans` — custom geometric sans-serif by Mark Davis. Open-source, available on Google Fonts and GitHub. Extremely tight default letter-spacing designed for large headlines. Has 6 character variants (Cc, j, t, u, 0, 1)
|
||||
- **Body**: `Inter` — "rock-solid" standard body font. Fallback: `Inter Placeholder`
|
||||
- **UI Light**: `Cal Sans UI Variable Light` — light-weight variant (300) for softer UI text with -0.2px letter-spacing
|
||||
- **UI Medium**: `Cal Sans UI Medium` — medium-weight variant (500) for emphasized captions
|
||||
- **Mono**: `Roboto Mono` — for code blocks and technical content
|
||||
- **Tertiary**: `Matter Regular` / `Matter SemiBold` / `Matter Medium` — additional body fonts for specific contexts
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | Cal Sans | 64px | 600 | 1.10 | 0px | Maximum impact, tight default spacing |
|
||||
| Section Heading | Cal Sans | 48px | 600 | 1.10 | 0px | Large section titles |
|
||||
| Feature Heading | Cal Sans | 24px | 600 | 1.30 | 0px | Feature block headlines |
|
||||
| Sub-heading | Cal Sans | 20px | 600 | 1.20 | +0.2px | Positive spacing for readability at smaller size |
|
||||
| Sub-heading Alt | Cal Sans | 20px | 600 | 1.50 | 0px | Relaxed line-height variant |
|
||||
| Card Title | Cal Sans | 16px | 600 | 1.10 | 0px | Smallest Cal Sans usage |
|
||||
| Caption Label | Cal Sans | 12px | 600 | 1.50 | 0px | Small labels in Cal Sans |
|
||||
| Body Light | Cal Sans UI Light | 18px | 300 | 1.30 | -0.2px | Light-weight body intro text |
|
||||
| Body Light Standard | Cal Sans UI Light | 16px | 300 | 1.50 | -0.2px | Light-weight body text |
|
||||
| Caption Light | Cal Sans UI Light | 14px | 300 | 1.40–1.50 | -0.2 to -0.28px | Light captions and descriptions |
|
||||
| UI Label | Inter | 16px | 600 | 1.00 | 0px | UI buttons and nav labels |
|
||||
| Caption Inter | Inter | 14px | 500 | 1.14 | 0px | Small UI text |
|
||||
| Micro | Inter | 12px | 500 | 1.00 | 0px | Smallest Inter text |
|
||||
| Code | Roboto Mono | 14px | 600 | 1.00 | 0px | Code snippets, technical text |
|
||||
| Body Matter | Matter Regular | 14px | 400 | 1.14 | 0px | Alternate body text (product UI) |
|
||||
|
||||
### Principles
|
||||
- **Cal Sans at large, Inter at small**: Cal Sans is exclusively for headings and display — never for body text. The system enforces this division strictly
|
||||
- **Tight by default, space when small**: Cal Sans letters are "intentionally spaced to be extremely close" at large sizes. At 20px and below, positive letter-spacing (+0.2px) must be applied to prevent cramming
|
||||
- **Weight 300 body variant**: Cal Sans UI Variable Light at 300 weight creates an elegant, airy body text that contrasts with the dense 600-weight headlines
|
||||
- **Weight 600 dominance**: Nearly all Cal Sans usage is at weight 600 (semi-bold) — the font was designed to perform at this weight
|
||||
- **Negative tracking on light text**: Cal Sans UI Light uses -0.2px to -0.28px letter-spacing, subtly tightening the already-compact letterforms
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
- **Dark Primary**: `#242424` (or `#1e1f23`) background, white text, 6–8px radius. Hover: opacity reduction to 0.7. The signature CTA — maximally dark on white
|
||||
- **White/Ghost**: White background with shadow-ring border, dark text. Uses the multi-layered shadow system for subtle elevation
|
||||
- **Pill**: 9999px radius for rounded pill-shaped actions and badges
|
||||
- **Compact**: 4px padding, small text — utility actions within product UI
|
||||
- **Inset highlight**: Some buttons feature `rgba(255, 255, 255, 0.15) 0px 2px 0px inset` — a subtle inner-top highlight creating a 3D pressed effect
|
||||
|
||||
### Cards & Containers
|
||||
- **Shadow Card**: White background, multi-layered shadow — `rgba(19, 19, 22, 0.7) 0px 1px 5px -4px, rgba(34, 42, 53, 0.08) 0px 0px 0px 1px, rgba(34, 42, 53, 0.05) 0px 4px 8px 0px`. The ring shadow (0px 0px 0px 1px) acts as a shadow-border
|
||||
- **Product UI Cards**: Screenshots of the scheduling interface displayed in card containers with shadow elevation
|
||||
- **Radius**: 8px for standard cards, 12px for larger containers, 16px for prominent sections
|
||||
- **Hover**: Likely subtle shadow deepening or scale transform
|
||||
|
||||
### Inputs & Forms
|
||||
- **Select dropdown**: White background, `#000000` text, 1px solid `rgb(118, 118, 118)` border
|
||||
- **Focus**: Uses Framer's focus outline system (`--framer-focus-outline`)
|
||||
- **Text input**: 8px radius, standard border treatment
|
||||
- **Minimal form presence**: The marketing site prioritizes CTA buttons over complex forms
|
||||
|
||||
### Navigation
|
||||
- **Top nav**: White/transparent background, Cal Sans links at near-black
|
||||
- **Nav text**: `#111111` (Midnight) for primary links, `#000000` for emphasis
|
||||
- **CTA button**: Dark Primary in the nav — high contrast call-to-action
|
||||
- **Mobile**: Collapses to hamburger with simplified navigation
|
||||
- **Sticky**: Fixed on scroll
|
||||
|
||||
### Image Treatment
|
||||
- **Product screenshots**: Large scheduling UI screenshots — the product is the primary visual
|
||||
- **Trust logos**: Grayscale company logos in a horizontal trust bar
|
||||
- **Aspect ratios**: Wide landscape for product UI screenshots
|
||||
- **No decorative imagery**: No illustrations, photos, or abstract graphics — pure product + typography
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- **Base unit**: 8px
|
||||
- **Scale**: 1px, 2px, 3px, 4px, 6px, 8px, 12px, 16px, 20px, 24px, 28px, 80px, 96px
|
||||
- **Section padding**: 80px–96px vertical between major sections (generous)
|
||||
- **Card padding**: 12px–24px internal
|
||||
- **Component gaps**: 4px–8px between related elements
|
||||
- **Notable jump**: From 28px to 80px — a deliberate gap emphasizing the section-level spacing tier
|
||||
|
||||
### Grid & Container
|
||||
- **Max width**: ~1200px content container, centered
|
||||
- **Column patterns**: Full-width hero, centered text blocks, 2-3 column feature grids
|
||||
- **Feature showcase**: Product screenshots flanked by description text
|
||||
- **Breakpoints**: 98px, 640px, 768px, 810px, 1024px, 1199px — Framer-generated
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Lavish section spacing**: 80px–96px between sections creates a breathable, premium feel
|
||||
- **Product-first content**: Screenshots dominate the visual space — minimal surrounding decoration
|
||||
- **Centered headlines**: Cal Sans headings centered with generous margins above and below
|
||||
|
||||
### Border Radius Scale
|
||||
- **2px**: Subtle rounding on inline elements
|
||||
- **4px**: Small UI components
|
||||
- **6px–7px**: Buttons, small cards, images
|
||||
- **8px**: Standard interactive elements — buttons, inputs, images
|
||||
- **12px**: Medium containers — links, larger cards, images
|
||||
- **16px**: Large section containers
|
||||
- **29px**: Special rounded elements
|
||||
- **100px**: Large rounding — nearly circular on small elements
|
||||
- **1000px**: Very large rounding
|
||||
- **9999px**: Full pill shape — badges, links
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Level 0 (Flat) | No shadow | Page canvas, basic text containers |
|
||||
| Level 1 (Inset) | `rgba(0,0,0,0.16) 0px 1px 1.9px 0px inset` | Pressed/recessed elements, input wells |
|
||||
| Level 2 (Ring + Soft) | `rgba(19,19,22,0.7) 0px 1px 5px -4px, rgba(34,42,53,0.08) 0px 0px 0px 1px, rgba(34,42,53,0.05) 0px 4px 8px` | Cards, containers — the workhorse shadow |
|
||||
| Level 3 (Ring + Soft Alt) | `rgba(36,36,36,0.7) 0px 1px 5px -4px, rgba(36,36,36,0.05) 0px 4px 8px` | Alt card elevation without ring border |
|
||||
| Level 4 (Inset Highlight) | `rgba(255,255,255,0.15) 0px 2px 0px inset` or `rgb(255,255,255) 0px 2px 0px inset` | Button inner highlight — 3D pressed effect |
|
||||
| Level 5 (Soft Only) | `rgba(34,42,53,0.05) 0px 4px 8px` | Subtle ambient shadow |
|
||||
|
||||
### Shadow Philosophy
|
||||
Cal.com's shadow system is the most sophisticated element of the design — 11 shadow definitions using a multi-layered compositing technique:
|
||||
- **Ring borders**: `0px 0px 0px 1px` shadows act as borders, avoiding CSS `border` entirely. This creates hairline containment without affecting layout
|
||||
- **Diffused soft shadows**: `0px 4px 8px` at 5% opacity add gentle ambient depth
|
||||
- **Sharp contact shadows**: `0px 1px 5px -4px` at 70% opacity create tight bottom-edge shadows for grounding
|
||||
- **Inset highlights**: White inset shadows at the top of buttons create a subtle 3D bevel
|
||||
- Shadows are composed in comma-separated stacks — each surface gets 2-3 layered shadow definitions working together
|
||||
|
||||
### Decorative Depth
|
||||
- No gradients or glow effects
|
||||
- All depth comes from the sophisticated shadow compositing system
|
||||
- The overall effect is subtle but precise — surfaces feel like physical cards sitting on a table
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use Cal Sans exclusively for headings (24px+) and never for body text — it's a display font with tight default spacing
|
||||
- Apply positive letter-spacing (+0.2px) when using Cal Sans below 24px — the font cramps at small sizes without it
|
||||
- Maintain the grayscale palette — boldness comes from contrast, not color
|
||||
- Use the multi-layered shadow system for card elevation — ring shadow + diffused shadow + contact shadow
|
||||
- Keep backgrounds pure white — the monochrome philosophy requires a clean canvas
|
||||
- Use Inter for all body text at weight 300–600 — it's the reliable counterpart to Cal Sans's display personality
|
||||
- Let product screenshots be the visual content — no illustrations, no decorative graphics
|
||||
- Apply generous section spacing (80px–96px) — the breathing room is essential to the premium feel
|
||||
|
||||
### Don't
|
||||
- Use Cal Sans for body text or text below 16px — it wasn't designed for extended reading
|
||||
- Add brand colors — Cal.com is intentionally grayscale, color is reserved for links and UI states only
|
||||
- Use CSS borders when shadows can achieve the same containment — the ring-shadow technique is the system's approach
|
||||
- Apply negative letter-spacing to Cal Sans at small sizes — it needs positive spacing (+0.2px) below 24px
|
||||
- Create heavy, dark shadows — Cal.com's shadows are subtle (5% opacity diffused) with sharp contact edges
|
||||
- Use illustrations, abstract graphics, or decorative elements — the visual language is typography + product UI only
|
||||
- Mix Cal Sans weights — the font is designed for weight 600, other weights break the intended character
|
||||
- Reduce section spacing below 48px — the generous whitespace is core to the premium monochrome aesthetic
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <640px | Single column, hero text ~36px, stacked features, hamburger nav |
|
||||
| Tablet Small | 640px–768px | 2-column begins for some elements |
|
||||
| Tablet | 768px–810px | Layout adjustments, fuller grid |
|
||||
| Tablet Large | 810px–1024px | Multi-column feature grids |
|
||||
| Desktop | 1024px–1199px | Full layout, expanded navigation |
|
||||
| Large Desktop | >1199px | Max-width container, centered content |
|
||||
|
||||
### Touch Targets
|
||||
- Buttons: 8px radius with comfortable padding (10px+ vertical)
|
||||
- Nav links: Dark text with adequate spacing
|
||||
- Mobile CTAs: Full-width dark buttons for easy thumb access
|
||||
- Pill badges: 9999px radius creates large, tappable targets
|
||||
|
||||
### Collapsing Strategy
|
||||
- **Navigation**: Full horizontal nav → hamburger on mobile
|
||||
- **Hero**: 64px Cal Sans display → ~36px on mobile
|
||||
- **Feature grids**: Multi-column → 2-column → single stacked column
|
||||
- **Product screenshots**: Scale within containers, maintaining aspect ratios
|
||||
- **Section spacing**: Reduces from 80px–96px to ~48px on mobile
|
||||
|
||||
### Image Behavior
|
||||
- Product screenshots scale responsively
|
||||
- Trust logos reflow to multi-row grid on mobile
|
||||
- No art direction changes — same compositions at all sizes
|
||||
- Images use 7px–12px border-radius for consistent rounded corners
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary Text: Charcoal (`#242424`)
|
||||
- Deep Text: Midnight (`#111111`)
|
||||
- Secondary Text: Mid Gray (`#898989`)
|
||||
- Background: Pure White (`#ffffff`)
|
||||
- Link: Link Blue (`#0099ff`)
|
||||
- CTA Button: Charcoal (`#242424`) bg, white text
|
||||
- Shadow Border: `rgba(34, 42, 53, 0.08)` ring
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section with white background, 64px Cal Sans heading at weight 600, line-height 1.10, #242424 text, centered layout with a dark CTA button (#242424, 8px radius, white text)"
|
||||
- "Design a scheduling card with white background, multi-layered shadow (0px 1px 5px -4px rgba(19,19,22,0.7), 0px 0px 0px 1px rgba(34,42,53,0.08), 0px 4px 8px rgba(34,42,53,0.05)), 12px radius"
|
||||
- "Build a navigation bar with white background, Inter links at 14px weight 500 in #111111, a dark CTA button (#242424), sticky positioning"
|
||||
- "Create a trust bar with grayscale company logos, horizontally centered, 16px gap between logos, on white background"
|
||||
- "Design a feature section with 48px Cal Sans heading (weight 600, #242424), 16px Inter body text (weight 300, #898989, line-height 1.50), and a product screenshot with 12px radius and the card shadow"
|
||||
|
||||
### Iteration Guide
|
||||
When refining existing screens generated with this design system:
|
||||
1. Verify headings use Cal Sans at weight 600, body uses Inter — never mix them
|
||||
2. Check that the palette is purely grayscale — if you see brand colors, remove them
|
||||
3. Ensure card elevation uses the multi-layered shadow stack, not CSS borders
|
||||
4. Confirm section spacing is generous (80px+) — if sections feel cramped, add more space
|
||||
5. The overall tone should feel like a clean, professional scheduling tool — monochrome confidence without any decorative flourishes
|
||||
325
skills/creative/popular-web-designs/templates/claude.md
Normal file
325
skills/creative/popular-web-designs/templates/claude.md
Normal file
@@ -0,0 +1,325 @@
|
||||
# Design System: Claude (Anthropic)
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Claude's interface is a literary salon reimagined as a product page — warm, unhurried, and quietly intellectual. The entire experience is built on a parchment-toned canvas (`#f5f4ed`) that deliberately evokes the feeling of high-quality paper rather than a digital surface. Where most AI product pages lean into cold, futuristic aesthetics, Claude's design radiates human warmth, as if the AI itself has good taste in interior design.
|
||||
|
||||
The signature move is the custom Anthropic Serif typeface — a medium-weight serif with generous proportions that gives every headline the gravitas of a book title. Combined with organic, hand-drawn-feeling illustrations in terracotta (`#c96442`), black, and muted green, the visual language says "thoughtful companion" rather than "powerful tool." The serif headlines breathe at tight-but-comfortable line-heights (1.10–1.30), creating a cadence that feels more like reading an essay than scanning a product page.
|
||||
|
||||
What makes Claude's design truly distinctive is its warm neutral palette. Every gray has a yellow-brown undertone (`#5e5d59`, `#87867f`, `#4d4c48`) — there are no cool blue-grays anywhere. Borders are cream-tinted (`#f0eee6`, `#e8e6dc`), shadows use warm transparent blacks, and even the darkest surfaces (`#141413`, `#30302e`) carry a barely perceptible olive warmth. This chromatic consistency creates a space that feels lived-in and trustworthy.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Warm parchment canvas (`#f5f4ed`) evoking premium paper, not screens
|
||||
- Custom Anthropic type family: Serif for headlines, Sans for UI, Mono for code
|
||||
- Terracotta brand accent (`#c96442`) — warm, earthy, deliberately un-tech
|
||||
- Exclusively warm-toned neutrals — every gray has a yellow-brown undertone
|
||||
- Organic, editorial illustrations replacing typical tech iconography
|
||||
- Ring-based shadow system (`0px 0px 0px 1px`) creating border-like depth without visible borders
|
||||
- Magazine-like pacing with generous section spacing and serif-driven hierarchy
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Anthropic Near Black** (`#141413`): The primary text color and dark-theme surface — not pure black but a warm, almost olive-tinted dark that's gentler on the eyes. The warmest "black" in any major tech brand.
|
||||
- **Terracotta Brand** (`#c96442`): The core brand color — a burnt orange-brown used for primary CTA buttons, brand moments, and the signature accent. Deliberately earthy and un-tech.
|
||||
- **Coral Accent** (`#d97757`): A lighter, warmer variant of the brand color used for text accents, links on dark surfaces, and secondary emphasis.
|
||||
|
||||
### Secondary & Accent
|
||||
- **Error Crimson** (`#b53333`): A deep, warm red for error states — serious without being alarming.
|
||||
- **Focus Blue** (`#3898ec`): Standard blue for input focus rings — the only cool color in the entire system, used purely for accessibility.
|
||||
|
||||
### Surface & Background
|
||||
- **Parchment** (`#f5f4ed`): The primary page background — a warm cream with a yellow-green tint that feels like aged paper. The emotional foundation of the entire design.
|
||||
- **Ivory** (`#faf9f5`): The lightest surface — used for cards and elevated containers on the Parchment background. Barely distinguishable but creates subtle layering.
|
||||
- **Pure White** (`#ffffff`): Reserved for specific button surfaces and maximum-contrast elements.
|
||||
- **Warm Sand** (`#e8e6dc`): Button backgrounds and prominent interactive surfaces — a noticeably warm light gray.
|
||||
- **Dark Surface** (`#30302e`): Dark-theme containers, nav borders, and elevated dark elements — warm charcoal.
|
||||
- **Deep Dark** (`#141413`): Dark-theme page background and primary dark surface.
|
||||
|
||||
### Neutrals & Text
|
||||
- **Charcoal Warm** (`#4d4c48`): Button text on light warm surfaces — the go-to dark-on-light text.
|
||||
- **Olive Gray** (`#5e5d59`): Secondary body text — a distinctly warm medium-dark gray.
|
||||
- **Stone Gray** (`#87867f`): Tertiary text, footnotes, and de-emphasized metadata.
|
||||
- **Dark Warm** (`#3d3d3a`): Dark text links and emphasized secondary text.
|
||||
- **Warm Silver** (`#b0aea5`): Text on dark surfaces — a warm, parchment-tinted light gray.
|
||||
|
||||
### Semantic & Accent
|
||||
- **Border Cream** (`#f0eee6`): Standard light-theme border — barely visible warm cream, creating the gentlest possible containment.
|
||||
- **Border Warm** (`#e8e6dc`): Prominent borders, section dividers, and emphasized containment on light surfaces.
|
||||
- **Border Dark** (`#30302e`): Standard border on dark surfaces — maintains the warm tone.
|
||||
- **Ring Warm** (`#d1cfc5`): Shadow ring color for button hover/focus states.
|
||||
- **Ring Subtle** (`#dedc01`): Secondary ring variant for lighter interactive surfaces.
|
||||
- **Ring Deep** (`#c2c0b6`): Deeper ring for active/pressed states.
|
||||
|
||||
### Gradient System
|
||||
- Claude's design is **gradient-free** in the traditional sense. Depth and visual richness come from the interplay of warm surface tones, organic illustrations, and light/dark section alternation. The warm palette itself creates a "gradient" effect as the eye moves through cream → sand → stone → charcoal → black sections.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Headline**: `Anthropic Serif`, with fallback: `Georgia`
|
||||
- **Body / UI**: `Anthropic Sans`, with fallback: `Arial`
|
||||
- **Code**: `Anthropic Mono`, with fallback: `Arial`
|
||||
|
||||
*Note: These are custom typefaces. For external implementations, Georgia serves as the serif substitute and system-ui/Inter as the sans substitute.*
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display / Hero | Anthropic Serif | 64px (4rem) | 500 | 1.10 (tight) | normal | Maximum impact, book-title presence |
|
||||
| Section Heading | Anthropic Serif | 52px (3.25rem) | 500 | 1.20 (tight) | normal | Feature section anchors |
|
||||
| Sub-heading Large | Anthropic Serif | 36–36.8px (~2.3rem) | 500 | 1.30 | normal | Secondary section markers |
|
||||
| Sub-heading | Anthropic Serif | 32px (2rem) | 500 | 1.10 (tight) | normal | Card titles, feature names |
|
||||
| Sub-heading Small | Anthropic Serif | 25–25.6px (~1.6rem) | 500 | 1.20 | normal | Smaller section titles |
|
||||
| Feature Title | Anthropic Serif | 20.8px (1.3rem) | 500 | 1.20 | normal | Small feature headings |
|
||||
| Body Serif | Anthropic Serif | 17px (1.06rem) | 400 | 1.60 (relaxed) | normal | Serif body text (editorial passages) |
|
||||
| Body Large | Anthropic Sans | 20px (1.25rem) | 400 | 1.60 (relaxed) | normal | Intro paragraphs |
|
||||
| Body / Nav | Anthropic Sans | 17px (1.06rem) | 400–500 | 1.00–1.60 | normal | Navigation links, UI text |
|
||||
| Body Standard | Anthropic Sans | 16px (1rem) | 400–500 | 1.25–1.60 | normal | Standard body, button text |
|
||||
| Body Small | Anthropic Sans | 15px (0.94rem) | 400–500 | 1.00–1.60 | normal | Compact body text |
|
||||
| Caption | Anthropic Sans | 14px (0.88rem) | 400 | 1.43 | normal | Metadata, descriptions |
|
||||
| Label | Anthropic Sans | 12px (0.75rem) | 400–500 | 1.25–1.60 | 0.12px | Badges, small labels |
|
||||
| Overline | Anthropic Sans | 10px (0.63rem) | 400 | 1.60 | 0.5px | Uppercase overline labels |
|
||||
| Micro | Anthropic Sans | 9.6px (0.6rem) | 400 | 1.60 | 0.096px | Smallest text |
|
||||
| Code | Anthropic Mono | 15px (0.94rem) | 400 | 1.60 | -0.32px | Inline code, terminal |
|
||||
|
||||
### Principles
|
||||
- **Serif for authority, sans for utility**: Anthropic Serif carries all headline content with medium weight (500), giving every heading the gravitas of a published title. Anthropic Sans handles all functional UI text — buttons, labels, navigation — with quiet efficiency.
|
||||
- **Single weight for serifs**: All Anthropic Serif headings use weight 500 — no bold, no light. This creates a consistent "voice" across all headline sizes, as if the same author wrote every heading.
|
||||
- **Relaxed body line-height**: Most body text uses 1.60 line-height — significantly more generous than typical tech sites (1.4–1.5). This creates a reading experience closer to a book than a dashboard.
|
||||
- **Tight-but-not-compressed headings**: Line-heights of 1.10–1.30 for headings are tight but never claustrophobic. The serif letterforms need breathing room that sans-serif fonts don't.
|
||||
- **Micro letter-spacing on labels**: Small sans text (12px and below) uses deliberate letter-spacing (0.12px–0.5px) to maintain readability at tiny sizes.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Warm Sand (Secondary)**
|
||||
- Background: Warm Sand (`#e8e6dc`)
|
||||
- Text: Charcoal Warm (`#4d4c48`)
|
||||
- Padding: 0px 12px 0px 8px (asymmetric — icon-first layout)
|
||||
- Radius: comfortably rounded (8px)
|
||||
- Shadow: ring-based (`#e8e6dc 0px 0px 0px 0px, #d1cfc5 0px 0px 0px 1px`)
|
||||
- The workhorse button — warm, unassuming, clearly interactive
|
||||
|
||||
**White Surface**
|
||||
- Background: Pure White (`#ffffff`)
|
||||
- Text: Anthropic Near Black (`#141413`)
|
||||
- Padding: 8px 16px 8px 12px
|
||||
- Radius: generously rounded (12px)
|
||||
- Hover: shifts to secondary background color
|
||||
- Clean, elevated button for light surfaces
|
||||
|
||||
**Dark Charcoal**
|
||||
- Background: Dark Surface (`#30302e`)
|
||||
- Text: Ivory (`#faf9f5`)
|
||||
- Padding: 0px 12px 0px 8px
|
||||
- Radius: comfortably rounded (8px)
|
||||
- Shadow: ring-based (`#30302e 0px 0px 0px 0px, ring 0px 0px 0px 1px`)
|
||||
- The inverted variant for dark-on-light emphasis
|
||||
|
||||
**Brand Terracotta**
|
||||
- Background: Terracotta Brand (`#c96442`)
|
||||
- Text: Ivory (`#faf9f5`)
|
||||
- Radius: 8–12px
|
||||
- Shadow: ring-based (`#c96442 0px 0px 0px 0px, #c96442 0px 0px 0px 1px`)
|
||||
- The primary CTA — the only button with chromatic color
|
||||
|
||||
**Dark Primary**
|
||||
- Background: Anthropic Near Black (`#141413`)
|
||||
- Text: Warm Silver (`#b0aea5`)
|
||||
- Padding: 9.6px 16.8px
|
||||
- Radius: generously rounded (12px)
|
||||
- Border: thin solid Dark Surface (`1px solid #30302e`)
|
||||
- Used on dark theme surfaces
|
||||
|
||||
### Cards & Containers
|
||||
- Background: Ivory (`#faf9f5`) or Pure White (`#ffffff`) on light surfaces; Dark Surface (`#30302e`) on dark
|
||||
- Border: thin solid Border Cream (`1px solid #f0eee6`) on light; `1px solid #30302e` on dark
|
||||
- Radius: comfortably rounded (8px) for standard cards; generously rounded (16px) for featured; very rounded (32px) for hero containers and embedded media
|
||||
- Shadow: whisper-soft (`rgba(0,0,0,0.05) 0px 4px 24px`) for elevated content
|
||||
- Ring shadow: `0px 0px 0px 1px` patterns for interactive card states
|
||||
- Section borders: `1px 0px 0px` (top-only) for list item separators
|
||||
|
||||
### Inputs & Forms
|
||||
- Text: Anthropic Near Black (`#141413`)
|
||||
- Padding: 1.6px 12px (very compact vertical)
|
||||
- Border: standard warm borders
|
||||
- Focus: ring with Focus Blue (`#3898ec`) border-color — the only cool color moment
|
||||
- Radius: generously rounded (12px)
|
||||
|
||||
### Navigation
|
||||
- Sticky top nav with warm background
|
||||
- Logo: Claude wordmark in Anthropic Near Black
|
||||
- Links: mix of Near Black (`#141413`), Olive Gray (`#5e5d59`), and Dark Warm (`#3d3d3a`)
|
||||
- Nav border: `1px solid #30302e` (dark) or `1px solid #f0eee6` (light)
|
||||
- CTA: Terracotta Brand button or White Surface button
|
||||
- Hover: text shifts to foreground-primary, no decoration
|
||||
|
||||
### Image Treatment
|
||||
- Product screenshots showing the Claude chat interface
|
||||
- Generous border-radius on media (16–32px)
|
||||
- Embedded video players with rounded corners
|
||||
- Dark UI screenshots provide contrast against warm light canvas
|
||||
- Organic, hand-drawn illustrations for conceptual sections
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Model Comparison Cards**
|
||||
- Opus 4.5, Sonnet 4.5, Haiku 4.5 presented in a clean card grid
|
||||
- Each model gets a bordered card with name, description, and capability badges
|
||||
- Border Warm (`#e8e6dc`) separation between items
|
||||
|
||||
**Organic Illustrations**
|
||||
- Hand-drawn-feeling vector illustrations in terracotta, black, and muted green
|
||||
- Abstract, conceptual rather than literal product diagrams
|
||||
- The primary visual personality — no other AI company uses this style
|
||||
|
||||
**Dark/Light Section Alternation**
|
||||
- The page alternates between Parchment light and Near Black dark sections
|
||||
- Creates a reading rhythm like chapters in a book
|
||||
- Each section feels like a distinct environment
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 3px, 4px, 6px, 8px, 10px, 12px, 16px, 20px, 24px, 30px
|
||||
- Button padding: asymmetric (0px 12px 0px 8px) or balanced (8px 16px)
|
||||
- Card internal padding: approximately 24–32px
|
||||
- Section vertical spacing: generous (estimated 80–120px between major sections)
|
||||
|
||||
### Grid & Container
|
||||
- Max container width: approximately 1200px, centered
|
||||
- Hero: centered with editorial layout
|
||||
- Feature sections: single-column or 2–3 column card grids
|
||||
- Model comparison: clean 3-column grid
|
||||
- Full-width dark sections breaking the container for emphasis
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Editorial pacing**: Each section breathes like a magazine spread — generous top/bottom margins create natural reading pauses.
|
||||
- **Serif-driven rhythm**: The serif headings establish a literary cadence that demands more whitespace than sans-serif designs.
|
||||
- **Content island approach**: Sections alternate between light and dark environments, creating distinct "rooms" for each message.
|
||||
|
||||
### Border Radius Scale
|
||||
- Sharp (4px): Minimal inline elements
|
||||
- Subtly rounded (6–7.5px): Small buttons, secondary interactive elements
|
||||
- Comfortably rounded (8–8.5px): Standard buttons, cards, containers
|
||||
- Generously rounded (12px): Primary buttons, input fields, nav elements
|
||||
- Very rounded (16px): Featured containers, video players, tab lists
|
||||
- Highly rounded (24px): Tag-like elements, highlighted containers
|
||||
- Maximum rounded (32px): Hero containers, embedded media, large cards
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow, no border | Parchment background, inline text |
|
||||
| Contained (Level 1) | `1px solid #f0eee6` (light) or `1px solid #30302e` (dark) | Standard cards, sections |
|
||||
| Ring (Level 2) | `0px 0px 0px 1px` ring shadows using warm grays | Interactive cards, buttons, hover states |
|
||||
| Whisper (Level 3) | `rgba(0,0,0,0.05) 0px 4px 24px` | Elevated feature cards, product screenshots |
|
||||
| Inset (Level 4) | `inset 0px 0px 0px 1px` at 15% opacity | Active/pressed button states |
|
||||
|
||||
**Shadow Philosophy**: Claude communicates depth through **warm-toned ring shadows** rather than traditional drop shadows. The signature `0px 0px 0px 1px` pattern creates a border-like halo that's softer than an actual border — it's a shadow pretending to be a border, or a border that's technically a shadow. When drop shadows do appear, they're extremely soft (0.05 opacity, 24px blur) — barely visible lifts that suggest floating rather than casting.
|
||||
|
||||
### Decorative Depth
|
||||
- **Light/Dark alternation**: The most dramatic depth effect comes from alternating between Parchment (`#f5f4ed`) and Near Black (`#141413`) sections — entire sections shift elevation by changing the ambient light level.
|
||||
- **Warm ring halos**: Button and card interactions use ring shadows that match the warm palette — never cool-toned or generic gray.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use Parchment (`#f5f4ed`) as the primary light background — the warm cream tone IS the Claude personality
|
||||
- Use Anthropic Serif at weight 500 for all headlines — the single-weight consistency is intentional
|
||||
- Use Terracotta Brand (`#c96442`) only for primary CTAs and the highest-signal brand moments
|
||||
- Keep all neutrals warm-toned — every gray should have a yellow-brown undertone
|
||||
- Use ring shadows (`0px 0px 0px 1px`) for interactive element states instead of drop shadows
|
||||
- Maintain the editorial serif/sans hierarchy — serif for content headlines, sans for UI
|
||||
- Use generous body line-height (1.60) for a literary reading experience
|
||||
- Alternate between light and dark sections to create chapter-like page rhythm
|
||||
- Apply generous border-radius (12–32px) for a soft, approachable feel
|
||||
|
||||
### Don't
|
||||
- Don't use cool blue-grays anywhere — the palette is exclusively warm-toned
|
||||
- Don't use bold (700+) weight on Anthropic Serif — weight 500 is the ceiling for serifs
|
||||
- Don't introduce saturated colors beyond Terracotta — the palette is deliberately muted
|
||||
- Don't use sharp corners (< 6px radius) on buttons or cards — softness is core to the identity
|
||||
- Don't apply heavy drop shadows — depth comes from ring shadows and background color shifts
|
||||
- Don't use pure white (`#ffffff`) as a page background — Parchment (`#f5f4ed`) or Ivory (`#faf9f5`) are always warmer
|
||||
- Don't use geometric/tech-style illustrations — Claude's illustrations are organic and hand-drawn-feeling
|
||||
- Don't reduce body line-height below 1.40 — the generous spacing supports the editorial personality
|
||||
- Don't use monospace fonts for non-code content — Anthropic Mono is strictly for code
|
||||
- Don't mix in sans-serif for headlines — the serif/sans split is the typographic identity
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Small Mobile | <479px | Minimum layout, stacked everything, compact typography |
|
||||
| Mobile | 479–640px | Single column, hamburger nav, reduced heading sizes |
|
||||
| Large Mobile | 640–767px | Slightly wider content area |
|
||||
| Tablet | 768–991px | 2-column grids begin, condensed nav |
|
||||
| Desktop | 992px+ | Full multi-column layout, expanded nav, maximum hero typography (64px) |
|
||||
|
||||
### Touch Targets
|
||||
- Buttons use generous padding (8–16px vertical minimum)
|
||||
- Navigation links adequately spaced for thumb navigation
|
||||
- Card surfaces serve as large touch targets
|
||||
- Minimum recommended: 44x44px
|
||||
|
||||
### Collapsing Strategy
|
||||
- **Navigation**: Full horizontal nav collapses to hamburger on mobile
|
||||
- **Feature sections**: Multi-column → stacked single column
|
||||
- **Hero text**: 64px → 36px → ~25px progressive scaling
|
||||
- **Model cards**: 3-column → stacked vertical
|
||||
- **Section padding**: Reduces proportionally but maintains editorial rhythm
|
||||
- **Illustrations**: Scale proportionally, maintain aspect ratios
|
||||
|
||||
### Image Behavior
|
||||
- Product screenshots scale proportionally within rounded containers
|
||||
- Illustrations maintain quality at all sizes
|
||||
- Video embeds maintain 16:9 aspect ratio with rounded corners
|
||||
- No art direction changes between breakpoints
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Brand CTA: "Terracotta Brand (#c96442)"
|
||||
- Page Background: "Parchment (#f5f4ed)"
|
||||
- Card Surface: "Ivory (#faf9f5)"
|
||||
- Primary Text: "Anthropic Near Black (#141413)"
|
||||
- Secondary Text: "Olive Gray (#5e5d59)"
|
||||
- Tertiary Text: "Stone Gray (#87867f)"
|
||||
- Borders (light): "Border Cream (#f0eee6)"
|
||||
- Dark Surface: "Dark Surface (#30302e)"
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on Parchment (#f5f4ed) with a headline at 64px Anthropic Serif weight 500, line-height 1.10. Use Anthropic Near Black (#141413) text. Add a subtitle in Olive Gray (#5e5d59) at 20px Anthropic Sans with 1.60 line-height. Place a Terracotta Brand (#c96442) CTA button with Ivory text, 12px radius."
|
||||
- "Design a feature card on Ivory (#faf9f5) with a 1px solid Border Cream (#f0eee6) border and comfortably rounded corners (8px). Title in Anthropic Serif at 25px weight 500, description in Olive Gray (#5e5d59) at 16px Anthropic Sans. Add a whisper shadow (rgba(0,0,0,0.05) 0px 4px 24px)."
|
||||
- "Build a dark section on Anthropic Near Black (#141413) with Ivory (#faf9f5) headline text in Anthropic Serif at 52px weight 500. Use Warm Silver (#b0aea5) for body text. Borders in Dark Surface (#30302e)."
|
||||
- "Create a button in Warm Sand (#e8e6dc) with Charcoal Warm (#4d4c48) text, 8px radius, and a ring shadow (0px 0px 0px 1px #d1cfc5). Padding: 0px 12px 0px 8px."
|
||||
- "Design a model comparison grid with three cards on Ivory surfaces. Each card gets a Border Warm (#e8e6dc) top border, model name in Anthropic Serif at 25px, and description in Olive Gray at 15px Anthropic Sans."
|
||||
|
||||
### Iteration Guide
|
||||
1. Focus on ONE component at a time
|
||||
2. Reference specific color names — "use Olive Gray (#5e5d59)" not "make it gray"
|
||||
3. Always specify warm-toned variants — no cool grays
|
||||
4. Describe serif vs sans usage explicitly — "Anthropic Serif for the heading, Anthropic Sans for the label"
|
||||
5. For shadows, use "ring shadow (0px 0px 0px 1px)" or "whisper shadow" — never generic "drop shadow"
|
||||
6. Specify the warm background — "on Parchment (#f5f4ed)" or "on Near Black (#141413)"
|
||||
7. Keep illustrations organic and conceptual — describe "hand-drawn-feeling" style
|
||||
317
skills/creative/popular-web-designs/templates/clay.md
Normal file
317
skills/creative/popular-web-designs/templates/clay.md
Normal file
@@ -0,0 +1,317 @@
|
||||
# Design System: Clay
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `DM Sans` | **Mono:** `system monospace stack`
|
||||
> - **Font stack (CSS):** `font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Clay's website is a warm, playful celebration of color that treats B2B data enrichment like a craft rather than an enterprise chore. The design language is built on a foundation of warm cream backgrounds (`#faf9f7`) and oat-toned borders (`#dad4c8`, `#eee9df`) that give every surface the tactile quality of handmade paper. Against this artisanal canvas, a vivid swatch palette explodes with personality — Matcha green, Slushie cyan, Lemon gold, Ube purple, Pomegranate pink, Blueberry navy, and Dragonfruit magenta — each named like flavors at a juice bar, not colors in an enterprise UI kit.
|
||||
|
||||
The typography is anchored by Roobert, a geometric sans-serif with character, loaded with an extensive set of OpenType stylistic sets (`"ss01"`, `"ss03"`, `"ss10"`, `"ss11"`, `"ss12"`) that give the text a distinctive, slightly quirky personality. At display scale (80px, weight 600), Roobert uses aggressive negative letter-spacing (-3.2px) that compresses headlines into punchy, billboard-like statements. Space Mono serves as the monospace companion for code and technical labels, completing the craft-meets-tech duality.
|
||||
|
||||
What makes Clay truly distinctive is its hover micro-animations: buttons on hover rotate slightly (`rotateZ(-8deg)`), translate upward (`translateY(-80%)`), change background to a contrasting swatch color, and cast a hard offset shadow (`rgb(0,0,0) -7px 7px`). This playful hover behavior — where a button literally tilts and jumps on interaction — creates a sense of physical delight that's rare in B2B software. Combined with generously rounded containers (24px–40px radius), dashed borders alongside solid ones, and a multi-layer shadow system that includes inset highlights, Clay feels like a design system that was made by people who genuinely enjoy making things.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Warm cream canvas (`#faf9f7`) with oat-toned borders (`#dad4c8`) — artisanal, not clinical
|
||||
- Named swatch palette: Matcha, Slushie, Lemon, Ube, Pomegranate, Blueberry, Dragonfruit
|
||||
- Roobert font with 5 OpenType stylistic sets — quirky geometric character
|
||||
- Playful hover animations: rotateZ(-8deg) + translateY(-80%) + hard offset shadow
|
||||
- Space Mono for code and technical labels
|
||||
- Generous border radius: 24px cards, 40px sections, 1584px pills
|
||||
- Mixed border styles: solid + dashed in the same interface
|
||||
- Multi-layer shadow with inset highlight: `0px 1px 1px` + `-1px inset` + `-0.5px`
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Clay Black** (`#000000`): Text, headings, pricing card text, `--_theme--pricing-cards---text`
|
||||
- **Pure White** (`#ffffff`): Card backgrounds, button backgrounds, inverse text
|
||||
- **Warm Cream** (`#faf9f7`): Page background — the warm, paper-like canvas
|
||||
|
||||
### Swatch Palette — Named Colors
|
||||
|
||||
**Matcha (Green)**
|
||||
- **Matcha 300** (`#84e7a5`): `--_swatches---color--matcha-300`, light green accent
|
||||
- **Matcha 600** (`#078a52`): `--_swatches---color--matcha-600`, mid green
|
||||
- **Matcha 800** (`#02492a`): `--_swatches---color--matcha-800`, deep green for dark sections
|
||||
|
||||
**Slushie (Cyan)**
|
||||
- **Slushie 500** (`#3bd3fd`): `--_swatches---color--slushie-500`, bright cyan accent
|
||||
- **Slushie 800** (`#0089ad`): `--_swatches---color--slushie-800`, deep teal
|
||||
|
||||
**Lemon (Gold)**
|
||||
- **Lemon 400** (`#f8cc65`): `--_swatches---color--lemon-400`, warm pale gold
|
||||
- **Lemon 500** (`#fbbd41`): `--_swatches---color--lemon-500`, primary gold
|
||||
- **Lemon 700** (`#d08a11`): `--_swatches---color--lemon-700`, deep amber
|
||||
- **Lemon 800** (`#9d6a09`): `--_swatches---color--lemon-800`, dark amber
|
||||
|
||||
**Ube (Purple)**
|
||||
- **Ube 300** (`#c1b0ff`): `--_swatches---color--ube-300`, soft lavender
|
||||
- **Ube 800** (`#43089f`): `--_swatches---color--ube-800`, deep purple
|
||||
- **Ube 900** (`#32037d`): `--_swatches---color--ube-900`, darkest purple
|
||||
|
||||
**Pomegranate (Pink/Red)**
|
||||
- **Pomegranate 400** (`#fc7981`): `--_swatches---color--pomegranate-400`, warm coral-pink
|
||||
|
||||
**Blueberry (Navy Blue)**
|
||||
- **Blueberry 800** (`#01418d`): `--_swatches---color--blueberry-800`, deep navy
|
||||
|
||||
### Neutral Scale (Warm)
|
||||
- **Warm Silver** (`#9f9b93`): Secondary/muted text, footer links
|
||||
- **Warm Charcoal** (`#55534e`): Tertiary text, dark muted links
|
||||
- **Dark Charcoal** (`#333333`): Link text on light backgrounds
|
||||
|
||||
### Surface & Border
|
||||
- **Oat Border** (`#dad4c8`): Primary border — warm, cream-toned structural lines
|
||||
- **Oat Light** (`#eee9df`): Secondary lighter border
|
||||
- **Cool Border** (`#e6e8ec`): Cool-toned border for contrast sections
|
||||
- **Dark Border** (`#525a69`): Border on dark sections
|
||||
- **Light Frost** (`#eff1f3`): Subtle button background (at 0% opacity on hover)
|
||||
|
||||
### Badges
|
||||
- **Badge Blue Bg** (`#f0f8ff`): Blue-tinted badge surface
|
||||
- **Badge Blue Text** (`#3859f9`): Vivid blue badge text
|
||||
- **Focus Ring** (`rgb(20, 110, 245) solid 2px`): Accessibility focus indicator
|
||||
|
||||
### Shadows
|
||||
- **Clay Shadow** (`rgba(0,0,0,0.1) 0px 1px 1px, rgba(0,0,0,0.04) 0px -1px 1px inset, rgba(0,0,0,0.05) 0px -0.5px 1px`): Multi-layer with inset highlight — the signature
|
||||
- **Hard Offset** (`rgb(0,0,0) -7px 7px`): Hover state — playful hard shadow
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Families
|
||||
- **Primary**: `Roobert`, fallback: `Arial`
|
||||
- **Monospace**: `Space Mono`
|
||||
- **OpenType Features**: `"ss01"`, `"ss03"`, `"ss10"`, `"ss11"`, `"ss12"` on all Roobert text (display uses all 5; body/UI uses `"ss03"`, `"ss10"`, `"ss11"`, `"ss12"`)
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | Roobert | 80px (5.00rem) | 600 | 1.00 (tight) | -3.2px | All 5 stylistic sets |
|
||||
| Display Secondary | Roobert | 60px (3.75rem) | 600 | 1.00 (tight) | -2.4px | All 5 stylistic sets |
|
||||
| Section Heading | Roobert | 44px (2.75rem) | 600 | 1.10 (tight) | -0.88px to -1.32px | All 5 stylistic sets |
|
||||
| Card Heading | Roobert | 32px (2.00rem) | 600 | 1.10 (tight) | -0.64px | All 5 stylistic sets |
|
||||
| Feature Title | Roobert | 20px (1.25rem) | 600 | 1.40 | -0.4px | All 5 stylistic sets |
|
||||
| Sub-heading | Roobert | 20px (1.25rem) | 500 | 1.50 | -0.16px | 4 stylistic sets (no ss01) |
|
||||
| Body Large | Roobert | 20px (1.25rem) | 400 | 1.40 | normal | 4 stylistic sets |
|
||||
| Body | Roobert | 18px (1.13rem) | 400 | 1.60 (relaxed) | -0.36px | 4 stylistic sets |
|
||||
| Body Standard | Roobert | 16px (1.00rem) | 400 | 1.50 | normal | 4 stylistic sets |
|
||||
| Body Medium | Roobert | 16px (1.00rem) | 500 | 1.20–1.40 | -0.16px to -0.32px | 4–5 stylistic sets |
|
||||
| Button | Roobert | 16px (1.00rem) | 500 | 1.50 | -0.16px | 4 stylistic sets |
|
||||
| Button Large | Roobert | 24px (1.50rem) | 400 | 1.50 | normal | 4 stylistic sets |
|
||||
| Button Small | Roobert | 12.8px (0.80rem) | 500 | 1.50 | -0.128px | 4 stylistic sets |
|
||||
| Nav Link | Roobert | 15px (0.94rem) | 500 | 1.60 (relaxed) | normal | 4 stylistic sets |
|
||||
| Caption | Roobert | 14px (0.88rem) | 400 | 1.50–1.60 | -0.14px | 4 stylistic sets |
|
||||
| Small | Roobert | 12px (0.75rem) | 400 | 1.50 | normal | 4 stylistic sets |
|
||||
| Uppercase Label | Roobert | 12px (0.75rem) | 600 | 1.20 (tight) | 1.08px | `text-transform: uppercase`, 4 sets |
|
||||
| Badge | Roobert | 9.6px | 600 | — | — | Pill badges |
|
||||
|
||||
### Principles
|
||||
- **Five stylistic sets as identity**: The combination of `"ss01"`, `"ss03"`, `"ss10"`, `"ss11"`, `"ss12"` on Roobert creates a distinctive typographic personality. `ss01` is reserved for headings and emphasis — body text omits it, creating a subtle hierarchy through glyph variation.
|
||||
- **Aggressive display compression**: -3.2px at 80px, -2.4px at 60px — the most compressed display tracking alongside the most generous body spacing (1.60 line-height), creating dramatic contrast.
|
||||
- **Weight 600 for headings, 500 for UI, 400 for body**: Clean three-tier system where each weight has a strict role.
|
||||
- **Uppercase labels with positive tracking**: 12px uppercase at 1.08px letter-spacing creates the systematic wayfinding pattern.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary (Transparent with Hover Animation)**
|
||||
- Background: transparent (`rgba(239, 241, 243, 0)`)
|
||||
- Text: `#000000`
|
||||
- Padding: 6.4px 12.8px
|
||||
- Border: none (or `1px solid #717989` for outlined variant)
|
||||
- Hover: background shifts to swatch color (e.g., `#434346`), text to white, `rotateZ(-8deg)`, `translateY(-80%)`, hard shadow `rgb(0,0,0) -7px 7px`
|
||||
- Focus: `rgb(20, 110, 245) solid 2px` outline
|
||||
|
||||
**White Solid**
|
||||
- Background: `#ffffff`
|
||||
- Text: `#000000`
|
||||
- Padding: 6.4px
|
||||
- Hover: oat-200 swatch color, animated rotation + shadow
|
||||
- Use: Primary CTA on colored sections
|
||||
|
||||
**Ghost Outlined**
|
||||
- Background: transparent
|
||||
- Text: `#000000`
|
||||
- Padding: 8px
|
||||
- Border: `1px solid #717989`
|
||||
- Radius: 4px
|
||||
- Hover: dragonfruit swatch color, white text, animated rotation
|
||||
|
||||
### Cards & Containers
|
||||
- Background: `#ffffff` on cream canvas
|
||||
- Border: `1px solid #dad4c8` (warm oat) or `1px dashed #dad4c8`
|
||||
- Radius: 12px (standard cards), 24px (feature cards/images), 40px (section containers/footer)
|
||||
- Shadow: `rgba(0,0,0,0.1) 0px 1px 1px, rgba(0,0,0,0.04) 0px -1px 1px inset, rgba(0,0,0,0.05) 0px -0.5px 1px`
|
||||
- Colorful section backgrounds using swatch palette (matcha, slushie, ube, lemon)
|
||||
|
||||
### Inputs & Forms
|
||||
- Text: `#000000`
|
||||
- Border: `1px solid #717989`
|
||||
- Radius: 4px
|
||||
- Focus: `rgb(20, 110, 245) solid 2px` outline
|
||||
|
||||
### Navigation
|
||||
- Sticky top nav on cream background
|
||||
- Roobert 15px weight 500 for nav links
|
||||
- Clay logo left-aligned
|
||||
- CTA buttons right-aligned with pill radius
|
||||
- Border bottom: `1px solid #dad4c8`
|
||||
- Mobile: hamburger collapse at 767px
|
||||
|
||||
### Image Treatment
|
||||
- Product screenshots in white cards with oat borders
|
||||
- Colorful illustrated sections with swatch background colors
|
||||
- 8px–24px radius on images
|
||||
- Full-width colorful section backgrounds
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Swatch Color Sections**
|
||||
- Full-width sections with swatch-colored backgrounds (matcha green, slushie cyan, ube purple, lemon gold)
|
||||
- White text on dark swatches, black text on light swatches
|
||||
- Each section tells a distinct product story through its color
|
||||
|
||||
**Playful Hover Buttons**
|
||||
- Rotate -8deg + translate upward on hover
|
||||
- Hard offset shadow (`-7px 7px`) instead of soft blur
|
||||
- Background transitions to contrasting swatch color
|
||||
- Creates a physical, toy-like interaction quality
|
||||
|
||||
**Dashed Border Elements**
|
||||
- Dashed borders (`1px dashed #dad4c8`) alongside solid borders
|
||||
- Used for secondary containers and decorative elements
|
||||
- Adds a hand-drawn, craft-like quality
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 1px, 2px, 4px, 6.4px, 8px, 12px, 12.8px, 16px, 18px, 20px, 24px
|
||||
|
||||
### Grid & Container
|
||||
- Max content width centered
|
||||
- Feature sections alternate between white cards and colorful swatch backgrounds
|
||||
- Card grids: 2–3 columns on desktop
|
||||
- Full-width colorful sections break the grid
|
||||
- Footer with generous 40px radius container
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Warm, generous breathing**: The cream background provides a warm rest between content blocks. Spacing is generous but not austere — it feels inviting, like a well-set table.
|
||||
- **Color as spatial rhythm**: The alternating swatch-colored sections create visual rhythm through hue rather than just whitespace. Each color section is its own "room."
|
||||
- **Craft-like density inside cards**: Within cards, content is compact and well-organized, contrasting with the generous outer spacing.
|
||||
|
||||
### Border Radius Scale
|
||||
- Sharp (4px): Ghost buttons, inputs
|
||||
- Standard (8px): Small cards, images, links
|
||||
- Badge (11px): Tag badges
|
||||
- Card (12px): Standard cards, buttons
|
||||
- Feature (24px): Feature cards, images, panels
|
||||
- Section (40px): Large sections, footer, containers
|
||||
- Pill (1584px): CTAs, pill-shaped buttons
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow, cream canvas | Page background |
|
||||
| Clay Shadow (Level 1) | `rgba(0,0,0,0.1) 0px 1px 1px, rgba(0,0,0,0.04) 0px -1px inset, rgba(0,0,0,0.05) 0px -0.5px` | Cards, buttons — multi-layer with inset highlight |
|
||||
| Hover Hard (Level 2) | `rgb(0,0,0) -7px 7px` | Hover state — playful hard offset shadow |
|
||||
| Focus (Level 3) | `rgb(20, 110, 245) solid 2px` | Keyboard focus ring |
|
||||
|
||||
**Shadow Philosophy**: Clay's shadow system is uniquely three-layered: a downward cast (`0px 1px 1px`), an upward inset highlight (`0px -1px 1px inset`), and a subtle edge (`0px -0.5px 1px`). This creates a "pressed into clay" quality where elements feel both raised AND embedded — like a clay tablet where content is stamped into the surface. The hover hard shadow (`-7px 7px`) is deliberately retro-graphic, referencing print-era drop shadows and adding physical playfulness.
|
||||
|
||||
### Decorative Depth
|
||||
- Full-width swatch-colored sections create dramatic depth through color contrast
|
||||
- Dashed borders add visual texture alongside solid borders
|
||||
- Product illustrations with warm, organic art style
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use warm cream (`#faf9f7`) as the page background — the warmth is the identity
|
||||
- Apply all 5 OpenType stylistic sets on Roobert headings: `"ss01", "ss03", "ss10", "ss11", "ss12"`
|
||||
- Use the named swatch palette (Matcha, Slushie, Lemon, Ube, Pomegranate, Blueberry) for section backgrounds
|
||||
- Apply the playful hover animation: `rotateZ(-8deg)`, `translateY(-80%)`, hard shadow `-7px 7px`
|
||||
- Use warm oat borders (`#dad4c8`) — not neutral gray
|
||||
- Mix solid and dashed borders for visual variety
|
||||
- Use generous radius: 24px for cards, 40px for sections
|
||||
- Use weight 600 exclusively for headings, 500 for UI, 400 for body
|
||||
|
||||
### Don't
|
||||
- Don't use cool gray backgrounds — the warm cream (`#faf9f7`) is non-negotiable
|
||||
- Don't use neutral gray borders (`#ccc`, `#ddd`) — always use the warm oat tones
|
||||
- Don't mix more than 2 swatch colors in the same section
|
||||
- Don't skip the OpenType stylistic sets — they define Roobert's character
|
||||
- Don't use subtle hover effects — the rotation + hard shadow is the signature interaction
|
||||
- Don't use small border radius (<12px) on feature cards — the generous rounding is structural
|
||||
- Don't use standard shadows (blur-based) — Clay uses hard offset and multi-layer inset
|
||||
- Don't forget the uppercase labels with 1.08px tracking — they're the wayfinding system
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile Small | <479px | Single column, tight padding |
|
||||
| Mobile | 479–767px | Standard mobile, stacked layout |
|
||||
| Tablet | 768–991px | 2-column grids, condensed nav |
|
||||
| Desktop | 992px+ | Full layout, 3-column grids, expanded sections |
|
||||
|
||||
### Touch Targets
|
||||
- Buttons: minimum 6.4px + 12.8px padding for adequate touch area
|
||||
- Nav links: 15px font with generous spacing
|
||||
- Mobile: full-width buttons for easy tapping
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero: 80px → 60px → smaller display text
|
||||
- Navigation: horizontal → hamburger at 767px
|
||||
- Feature sections: multi-column → stacked
|
||||
- Colorful sections: maintain full-width but compress padding
|
||||
- Card grids: 3-column → 2-column → single column
|
||||
|
||||
### Image Behavior
|
||||
- Product screenshots scale proportionally
|
||||
- Colorful section illustrations adapt to viewport width
|
||||
- Rounded corners maintained across breakpoints
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Background: Warm Cream (`#faf9f7`)
|
||||
- Text: Clay Black (`#000000`)
|
||||
- Secondary text: Warm Silver (`#9f9b93`)
|
||||
- Border: Oat Border (`#dad4c8`)
|
||||
- Green accent: Matcha 600 (`#078a52`)
|
||||
- Cyan accent: Slushie 500 (`#3bd3fd`)
|
||||
- Gold accent: Lemon 500 (`#fbbd41`)
|
||||
- Purple accent: Ube 800 (`#43089f`)
|
||||
- Pink accent: Pomegranate 400 (`#fc7981`)
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero on warm cream (#faf9f7) background. Headline at 80px Roobert weight 600, line-height 1.00, letter-spacing -3.2px, OpenType 'ss01 ss03 ss10 ss11 ss12', black text. Subtitle at 20px weight 400, line-height 1.40, #9f9b93 text. Two buttons: white solid pill (12px radius) and ghost outlined (4px radius, 1px solid #717989)."
|
||||
- "Design a colorful section with Matcha 800 (#02492a) background. Heading at 44px Roobert weight 600, letter-spacing -1.32px, white text. Body at 18px weight 400, line-height 1.60, #84e7a5 text. White card inset with oat border (#dad4c8), 24px radius."
|
||||
- "Build a button with playful hover: default transparent background, black text, 16px Roobert weight 500. On hover: background #434346, text white, transform rotateZ(-8deg) translateY(-80%), hard shadow rgb(0,0,0) -7px 7px."
|
||||
- "Create a card: white background, 1px solid #dad4c8 border, 24px radius. Shadow: rgba(0,0,0,0.1) 0px 1px 1px, rgba(0,0,0,0.04) 0px -1px 1px inset. Title at 32px Roobert weight 600, letter-spacing -0.64px."
|
||||
- "Design an uppercase label: 12px Roobert weight 600, text-transform uppercase, letter-spacing 1.08px, OpenType 'ss03 ss10 ss11 ss12'."
|
||||
|
||||
### Iteration Guide
|
||||
1. Start with warm cream (#faf9f7) — never cool white
|
||||
2. Swatch colors are for full sections, not small accents — go bold with matcha, slushie, ube
|
||||
3. Oat borders (#dad4c8) everywhere — dashed variants for decoration
|
||||
4. OpenType stylistic sets are mandatory — they make Roobert look like Roobert
|
||||
5. Hover animations are the signature — rotation + hard shadow, not subtle fades
|
||||
6. Generous radius: 24px cards, 40px sections — nothing looks sharp or corporate
|
||||
7. Three weights: 600 (headings), 500 (UI), 400 (body) — strict roles
|
||||
294
skills/creative/popular-web-designs/templates/clickhouse.md
Normal file
294
skills/creative/popular-web-designs/templates/clickhouse.md
Normal file
@@ -0,0 +1,294 @@
|
||||
# Design System: ClickHouse
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
ClickHouse's interface is a high-performance cockpit rendered in acid yellow-green on obsidian black — a design that screams "speed" before you read a single word. The entire experience lives in darkness: pure black backgrounds (`#000000`) with dark charcoal cards (`#414141` borders) creating a terminal-grade aesthetic where the only chromatic interruption is the signature neon yellow-green (`#faff69`) that slashes across CTAs, borders, and highlighted moments like a highlighter pen on a dark console.
|
||||
|
||||
The typography is aggressively heavy — Inter at weight 900 (Black) for the hero headline at 96px creates text blocks that feel like they have physical mass. This "database for AI" site communicates raw power through visual weight: thick type, high-contrast neon accents, and performance stats displayed as oversized numbers. There's nothing subtle about ClickHouse's design, and that's entirely the point — it mirrors the product's promise of extreme speed and performance.
|
||||
|
||||
What makes ClickHouse distinctive is the electrifying tension between the near-black canvas and the neon yellow-green accent. This color combination (`#faff69` on `#000000`) creates one of the highest-contrast pairings in any tech brand, making every CTA button, every highlighted card, and every accent border impossible to miss. Supporting this is a forest green (`#166534`) for secondary CTAs that adds depth to the action hierarchy without competing with the neon.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Pure black canvas (#000000) with neon yellow-green (#faff69) accent — maximum contrast
|
||||
- Extra-heavy display typography: Inter at weight 900 (Black) up to 96px
|
||||
- Dark charcoal card system with #414141 borders at 80% opacity
|
||||
- Forest green (#166534) secondary CTA buttons
|
||||
- Performance stats as oversized display numbers
|
||||
- Uppercase labels with wide letter-spacing (1.4px) for navigation structure
|
||||
- Active/pressed state shifts text to pale yellow (#f4f692)
|
||||
- All links hover to neon yellow-green — unified interactive signal
|
||||
- Inset shadows on select elements creating "pressed into the surface" depth
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Neon Volt** (`#faff69`): The signature brand color — a vivid acid yellow-green that's the sole chromatic accent on the black canvas. Used for primary CTAs, accent borders, link hovers, and highlighted moments.
|
||||
- **Forest Green** (`#166534`): Secondary CTA color — a deep, saturated green for "Get Started" and primary action buttons that need distinction from the neon.
|
||||
- **Dark Forest** (`#14572f`): A darker green variant for borders and secondary accents.
|
||||
|
||||
### Secondary & Accent
|
||||
- **Pale Yellow** (`#f4f692`): Active/pressed state text color — a softer, more muted version of Neon Volt for state feedback.
|
||||
- **Border Olive** (`#4f5100`): A dark olive-yellow for ghost button borders — the neon's muted sibling.
|
||||
- **Olive Dark** (`#161600`): The darkest neon-tinted color for subtle brand text.
|
||||
|
||||
### Surface & Background
|
||||
- **Pure Black** (`#000000`): The primary page background — absolute black for maximum contrast.
|
||||
- **Near Black** (`#141414`): Button backgrounds and slightly elevated dark surfaces.
|
||||
- **Charcoal** (`#414141`): The primary border color at 80% opacity — the workhorse for card and container containment.
|
||||
- **Deep Charcoal** (`#343434`): Darker border variant for subtle division lines.
|
||||
- **Hover Gray** (`#3a3a3a`): Button hover state background — slightly lighter than Near Black.
|
||||
|
||||
### Neutrals & Text
|
||||
- **Pure White** (`#ffffff`): Primary text on dark surfaces.
|
||||
- **Silver** (`#a0a0a0`): Secondary body text and muted content.
|
||||
- **Mid Gray** (`#585858` at 28%): Subtle gray overlay for depth effects.
|
||||
- **Border Gray** (`#e5e7eb`): Light border variant (used in rare light contexts).
|
||||
|
||||
### Gradient System
|
||||
- **None in the traditional sense.** ClickHouse uses flat color blocks and high-contrast borders. The "gradient" is the contrast itself — neon yellow-green against pure black creates a visual intensity that gradients would dilute.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Primary**: `Inter` (Next.js optimized variant `__Inter_d1b8ee`)
|
||||
- **Secondary Display**: `Basier` (`__basier_a58b65`), with fallbacks: `Arial, Helvetica`
|
||||
- **Code**: `Inconsolata` (`__Inconsolata_a25f62`)
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Mega | Inter | 96px (6rem) | 900 | 1.00 (tight) | normal | Maximum impact, extra-heavy |
|
||||
| Display / Hero | Inter | 72px (4.5rem) | 700 | 1.00 (tight) | normal | Section hero titles |
|
||||
| Feature Heading | Basier | 36px (2.25rem) | 600 | 1.30 (tight) | normal | Feature section anchors |
|
||||
| Sub-heading | Inter / Basier | 24px (1.5rem) | 600–700 | 1.17–1.38 | normal | Card headings |
|
||||
| Feature Title | Inter / Basier | 20px (1.25rem) | 600–700 | 1.40 | normal | Small feature titles |
|
||||
| Body Large | Inter | 18px (1.13rem) | 400–700 | 1.56 | normal | Intro paragraphs, button text |
|
||||
| Body / Button | Inter | 16px (1rem) | 400–700 | 1.50 | normal | Standard body, nav, buttons |
|
||||
| Caption | Inter | 14px (0.88rem) | 400–700 | 1.43 | normal | Metadata, descriptions, links |
|
||||
| Uppercase Label | Inter | 14px (0.88rem) | 600 | 1.43 | 1.4px | Section overlines, wide-tracked |
|
||||
| Code | Inconsolata | 16px (1rem) | 600 | 1.50 | normal | Code blocks, commands |
|
||||
| Small | Inter | 12px (0.75rem) | 500 | 1.33 | normal | Smallest text |
|
||||
| Micro | Inter | 11.2px (0.7rem) | 500 | 1.79 (relaxed) | normal | Tags, tiny labels |
|
||||
|
||||
### Principles
|
||||
- **Weight 900 is the weapon**: The display headline uses Inter Black (900) — a weight most sites never touch. Combined with 96px size, this creates text with a physical, almost architectural presence.
|
||||
- **Full weight spectrum**: The system uses 400, 500, 600, 700, and 900 — covering the full gamut. Weight IS hierarchy.
|
||||
- **Uppercase with maximum tracking**: Section overlines use 1.4px letter-spacing — wider than most systems — creating bold structural labels that stand out against the dense dark background.
|
||||
- **Dual sans-serif**: Inter handles display and body; Basier handles feature section headings at 600 weight. This creates a subtle personality shift between "data/performance" (Inter) and "product/feature" (Basier) contexts.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Neon Primary**
|
||||
- Background: Neon Volt (`#faff69`)
|
||||
- Text: Near Black (`#151515`)
|
||||
- Padding: 0px 16px
|
||||
- Radius: sharp (4px)
|
||||
- Border: `1px solid #faff69`
|
||||
- Hover: background shifts to dark (`rgb(29, 29, 29)`), text stays
|
||||
- Active: text shifts to Pale Yellow (`#f4f692`)
|
||||
- The eye-catching CTA — neon on black
|
||||
|
||||
**Dark Solid**
|
||||
- Background: Near Black (`#141414`)
|
||||
- Text: Pure White (`#ffffff`)
|
||||
- Padding: 12px 16px
|
||||
- Radius: 4px or 8px
|
||||
- Border: `1px solid #141414`
|
||||
- Hover: bg shifts to Hover Gray (`#3a3a3a`), text to 80% opacity
|
||||
- Active: text to Pale Yellow
|
||||
- The standard action button
|
||||
|
||||
**Forest Green**
|
||||
- Background: Forest Green (`#166534`)
|
||||
- Text: Pure White (`#ffffff`)
|
||||
- Padding: 12px 16px
|
||||
- Border: `1px solid #141414`
|
||||
- Hover: same dark shift
|
||||
- Active: Pale Yellow text
|
||||
- The "Get Started" / primary conversion button
|
||||
|
||||
**Ghost / Outlined**
|
||||
- Background: transparent
|
||||
- Text: Pure White (`#ffffff`)
|
||||
- Padding: 0px 32px
|
||||
- Radius: 4px
|
||||
- Border: `1px solid #4f5100` (olive-tinted)
|
||||
- Hover: dark bg shift
|
||||
- Active: Pale Yellow text
|
||||
- Secondary actions with neon-tinted border
|
||||
|
||||
**Pill Toggle**
|
||||
- Background: transparent
|
||||
- Radius: pill (9999px)
|
||||
- Used for toggle/switch elements
|
||||
|
||||
### Cards & Containers
|
||||
- Background: transparent or Near Black
|
||||
- Border: `1px solid rgba(65, 65, 65, 0.8)` — the signature charcoal containment
|
||||
- Radius: 4px (small elements) or 8px (cards, containers)
|
||||
- Shadow Level 1: subtle (`rgba(0,0,0,0.1) 0px 1px 3px, rgba(0,0,0,0.1) 0px 1px 2px -1px`)
|
||||
- Shadow Level 2: medium (`rgba(0,0,0,0.1) 0px 10px 15px -3px, rgba(0,0,0,0.1) 0px 4px 6px -4px`)
|
||||
- Shadow Level 3: inset (`rgba(0,0,0,0.06) 0px 4px 4px, rgba(0,0,0,0.14) 0px 4px 25px inset`) — the "pressed" effect
|
||||
- Neon-highlighted cards: selected/active cards get neon yellow-green border or accent
|
||||
|
||||
### Navigation
|
||||
- Dark nav on black background
|
||||
- Logo: ClickHouse wordmark + icon in yellow/neon
|
||||
- Links: white text, hover to Neon Volt (#faff69)
|
||||
- CTA: Neon Volt button or Forest Green button
|
||||
- Uppercase labels for categories
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Performance Stats**
|
||||
- Oversized numbers (72px+, weight 700–900)
|
||||
- Brief descriptions beneath
|
||||
- High-contrast neon accents on key metrics
|
||||
- The primary visual proof of performance claims
|
||||
|
||||
**Neon-Highlighted Card**
|
||||
- Standard dark card with neon yellow-green border highlight
|
||||
- Creates "selected" or "featured" treatment
|
||||
- The accent border makes the card pop against the dark canvas
|
||||
|
||||
**Code Blocks**
|
||||
- Dark surface with Inconsolata at weight 600
|
||||
- Neon and white syntax highlighting
|
||||
- Terminal-like aesthetic
|
||||
|
||||
**Trust Bar**
|
||||
- Company logos on dark background
|
||||
- Monochrome/white logo treatment
|
||||
- Horizontal layout
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 2px, 6px, 7px, 8px, 10px, 12px, 16px, 20px, 24px, 25px, 32px, 40px, 44px, 48px, 64px
|
||||
- Button padding: 12px 16px (standard), 0px 16px (compact), 0px 32px (wide ghost)
|
||||
- Section vertical spacing: generous (48–64px)
|
||||
|
||||
### Grid & Container
|
||||
- Max container width: up to 2200px (extra-wide) with responsive scaling
|
||||
- Hero: full-width dark with massive typography
|
||||
- Feature sections: multi-column card grids with dark borders
|
||||
- Stats: horizontal metric bar
|
||||
- Full-dark page — no light sections
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Dark void as canvas**: The pure black background provides infinite depth — elements float in darkness.
|
||||
- **Dense information**: Feature cards and stats are packed with data, reflecting the database product's performance focus.
|
||||
- **Neon highlights as wayfinding**: Yellow-green accents guide the eye through the dark interface like runway lights.
|
||||
|
||||
### Border Radius Scale
|
||||
- Sharp (4px): Buttons, badges, small elements, code blocks
|
||||
- Comfortable (8px): Cards, containers, dividers
|
||||
- Pill (9999px): Toggle buttons, status indicators
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow | Black background, text blocks |
|
||||
| Bordered (Level 1) | `1px solid rgba(65,65,65,0.8)` | Standard cards, containers |
|
||||
| Subtle (Level 2) | `0px 1px 3px rgba(0,0,0,0.1)` | Subtle card lift |
|
||||
| Elevated (Level 3) | `0px 10px 15px -3px rgba(0,0,0,0.1)` | Feature cards, hover states |
|
||||
| Pressed/Inset (Level 4) | `0px 4px 25px rgba(0,0,0,0.14) inset` | Active/pressed elements — "sunk into the surface" |
|
||||
| Neon Highlight (Level 5) | Neon Volt border (`#faff69`) | Featured/selected cards, maximum emphasis |
|
||||
|
||||
**Shadow Philosophy**: ClickHouse uses shadows on a black canvas, where they're barely visible — they exist more for subtle dimensionality than obvious elevation. The most distinctive depth mechanism is the **inset shadow** (Level 4), which creates a "pressed into the surface" effect unique to ClickHouse. The neon border highlight (Level 5) is the primary attention-getting depth mechanism.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use Neon Volt (#faff69) as the sole chromatic accent — it must pop against pure black
|
||||
- Use Inter at weight 900 for hero display text — the extreme weight IS the personality
|
||||
- Keep everything on pure black (#000000) — never use dark gray as the page background
|
||||
- Use charcoal borders (rgba(65,65,65,0.8)) for all card containment
|
||||
- Apply Forest Green (#166534) for primary CTA buttons — distinct from neon for action hierarchy
|
||||
- Show performance stats as oversized display numbers — it's the core visual argument
|
||||
- Use uppercase with wide letter-spacing (1.4px) for section labels
|
||||
- Apply Pale Yellow (#f4f692) for active/pressed text states
|
||||
- Link hovers should ALWAYS shift to Neon Volt — unified interactive feedback
|
||||
|
||||
### Don't
|
||||
- Don't introduce additional colors — the palette is strictly black, neon, green, and gray
|
||||
- Don't use the neon as a background fill — it's an accent and border color only (except on CTA buttons)
|
||||
- Don't reduce display weight below 700 — heavy weight is core to the personality
|
||||
- Don't use light/white backgrounds anywhere — the entire experience is dark
|
||||
- Don't round corners beyond 8px — the sharp geometry reflects database precision
|
||||
- Don't use soft/diffused shadows on black — they're invisible. Use border-based depth instead
|
||||
- Don't skip the inset shadow on active states — the "pressed" effect is distinctive
|
||||
- Don't use warm neutrals — all grays are perfectly neutral
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <640px | Single column, stacked cards |
|
||||
| Small Tablet | 640–768px | Minor adjustments |
|
||||
| Tablet | 768–1024px | 2-column grids |
|
||||
| Desktop | 1024–1280px | Standard layout |
|
||||
| Large Desktop | 1280–1536px | Expanded content |
|
||||
| Ultra-wide | 1536–2200px | Maximum container width |
|
||||
|
||||
### Touch Targets
|
||||
- Buttons with 12px 16px padding minimum
|
||||
- Card surfaces as touch targets
|
||||
- Adequate nav link spacing
|
||||
|
||||
### Collapsing Strategy
|
||||
- **Hero text**: 96px → 72px → 48px → 36px
|
||||
- **Feature grids**: Multi-column → 2 → 1 column
|
||||
- **Stats**: Horizontal → stacked
|
||||
- **Navigation**: Full → hamburger
|
||||
|
||||
### Image Behavior
|
||||
- Product screenshots maintain aspect ratio
|
||||
- Code blocks use horizontal scroll on narrow screens
|
||||
- All images on dark backgrounds
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Brand Accent: "Neon Volt (#faff69)"
|
||||
- Page Background: "Pure Black (#000000)"
|
||||
- CTA Green: "Forest Green (#166534)"
|
||||
- Card Border: "Charcoal (rgba(65,65,65,0.8))"
|
||||
- Primary Text: "Pure White (#ffffff)"
|
||||
- Secondary Text: "Silver (#a0a0a0)"
|
||||
- Active State: "Pale Yellow (#f4f692)"
|
||||
- Button Surface: "Near Black (#141414)"
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on Pure Black (#000000) with a massive headline at 96px Inter weight 900, line-height 1.0. Pure White text. Add a Neon Volt (#faff69) CTA button (dark text, 4px radius, 0px 16px padding) and a ghost button (transparent, 1px solid #4f5100 border)."
|
||||
- "Design a feature card on black with 1px solid rgba(65,65,65,0.8) border and 8px radius. Title at 24px Inter weight 700, body at 16px in Silver (#a0a0a0). Add a neon-highlighted variant with 1px solid #faff69 border."
|
||||
- "Build a performance stats bar: large numbers at 72px Inter weight 700 in Pure White. Brief descriptions at 14px in Silver. On black background."
|
||||
- "Create a Forest Green (#166534) CTA button: white text, 12px 16px padding, 4px radius, 1px solid #141414 border. Hover: bg shifts to #3a3a3a, text to 80% opacity."
|
||||
- "Design an uppercase section label: 14px Inter weight 600, letter-spacing 1.4px, uppercase. Silver (#a0a0a0) text on black background."
|
||||
|
||||
### Iteration Guide
|
||||
1. Keep everything on pure black — no dark gray alternatives
|
||||
2. Neon Volt (#faff69) is for accents and CTAs only — never large backgrounds
|
||||
3. Weight 900 for hero, 700 for headings, 600 for labels, 400-500 for body
|
||||
4. Active states use Pale Yellow (#f4f692) — not just opacity changes
|
||||
5. All links hover to Neon Volt — consistent interactive feedback
|
||||
6. Charcoal borders (rgba(65,65,65,0.8)) are the primary depth mechanism
|
||||
279
skills/creative/popular-web-designs/templates/cohere.md
Normal file
279
skills/creative/popular-web-designs/templates/cohere.md
Normal file
@@ -0,0 +1,279 @@
|
||||
# Design System: Cohere
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Cohere's interface is a polished enterprise command deck — confident, clean, and designed to make AI feel like serious infrastructure rather than a consumer toy. The experience lives on a bright white canvas where content is organized into generously rounded cards (22px radius) that create an organic, cloud-like containment language. This is a site that speaks to CTOs and enterprise architects: professional without being cold, sophisticated without being intimidating.
|
||||
|
||||
The design language bridges two worlds with a dual-typeface system: CohereText, a custom display serif with tight tracking, gives headlines the gravitas of a technology manifesto, while Unica77 Cohere Web handles all body and UI text with geometric Swiss precision. This serif/sans pairing creates a "confident authority meets engineering clarity" personality that perfectly reflects an enterprise AI platform.
|
||||
|
||||
Color is used with extreme restraint — the interface is almost entirely black-and-white with cool gray borders (`#d9d9dd`, `#e5e7eb`). Purple-violet appears only in photographic hero bands, gradient sections, and the interactive blue (`#1863dc`) that signals hover and focus states. This chromatic restraint means that when color DOES appear — in product screenshots, enterprise photography, and the deep purple section — it carries maximum visual weight.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Bright white canvas with cool gray containment borders
|
||||
- 22px signature border-radius — the distinctive "Cohere card" roundness
|
||||
- Dual custom typeface: CohereText (display serif) + Unica77 (body sans)
|
||||
- Enterprise-grade chromatic restraint: black, white, cool grays, minimal purple-blue accent
|
||||
- Deep purple/violet hero sections providing dramatic contrast
|
||||
- Ghost/transparent buttons that shift to blue on hover
|
||||
- Enterprise photography showing diverse real-world applications
|
||||
- CohereMono for code and technical labels with uppercase transforms
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Cohere Black** (`#000000`): Primary headline text and maximum-emphasis elements.
|
||||
- **Near Black** (`#212121`): Standard body link color — slightly softer than pure black.
|
||||
- **Deep Dark** (`#17171c`): A blue-tinted near-black for navigation and dark-section text.
|
||||
|
||||
### Secondary & Accent
|
||||
- **Interaction Blue** (`#1863dc`): The primary interactive accent — appears on button hover, focus states, and active links. The sole chromatic action color.
|
||||
- **Ring Blue** (`#4c6ee6` at 50%): Tailwind ring color for keyboard focus indicators.
|
||||
- **Focus Purple** (`#9b60aa`): Input focus border color — a muted violet.
|
||||
|
||||
### Surface & Background
|
||||
- **Pure White** (`#ffffff`): The primary page background and card surface.
|
||||
- **Snow** (`#fafafa`): Subtle elevated surfaces and light-section backgrounds.
|
||||
- **Lightest Gray** (`#f2f2f2`): Card borders and the softest containment lines.
|
||||
|
||||
### Neutrals & Text
|
||||
- **Muted Slate** (`#93939f`): De-emphasized footer links and tertiary text — a cool-toned gray with a slight blue-violet tint.
|
||||
- **Border Cool** (`#d9d9dd`): Standard section and list-item borders — a cool, slightly purple-tinted gray.
|
||||
- **Border Light** (`#e5e7eb`): Lighter border variant — Tailwind's standard gray-200.
|
||||
|
||||
### Gradient System
|
||||
- **Purple-Violet Hero Band**: Deep purple gradient sections that create dramatic contrast against the white canvas. These appear as full-width bands housing product screenshots and key messaging.
|
||||
- **Dark Footer Gradient**: The page transitions through deep purple/charcoal to the black footer, creating a "dusk" effect.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Display**: `CohereText`, with fallbacks: `Space Grotesk, Inter, ui-sans-serif, system-ui`
|
||||
- **Body / UI**: `Unica77 Cohere Web`, with fallbacks: `Inter, Arial, ui-sans-serif, system-ui`
|
||||
- **Code**: `CohereMono`, with fallbacks: `Arial, ui-sans-serif, system-ui`
|
||||
- **Icons**: `CohereIconDefault` (custom icon font)
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display / Hero | CohereText | 72px (4.5rem) | 400 | 1.00 (tight) | -1.44px | Maximum impact, serif authority |
|
||||
| Display Secondary | CohereText | 60px (3.75rem) | 400 | 1.00 (tight) | -1.2px | Large section headings |
|
||||
| Section Heading | Unica77 | 48px (3rem) | 400 | 1.20 (tight) | -0.48px | Feature section titles |
|
||||
| Sub-heading | Unica77 | 32px (2rem) | 400 | 1.20 (tight) | -0.32px | Card headings, feature names |
|
||||
| Feature Title | Unica77 | 24px (1.5rem) | 400 | 1.30 | normal | Smaller section titles |
|
||||
| Body Large | Unica77 | 18px (1.13rem) | 400 | 1.40 | normal | Intro paragraphs |
|
||||
| Body / Button | Unica77 | 16px (1rem) | 400 | 1.50 | normal | Standard body, button text |
|
||||
| Button Medium | Unica77 | 14px (0.88rem) | 500 | 1.71 (relaxed) | normal | Smaller buttons, emphasized labels |
|
||||
| Caption | Unica77 | 14px (0.88rem) | 400 | 1.40 | normal | Metadata, descriptions |
|
||||
| Uppercase Label | Unica77 / CohereMono | 14px (0.88rem) | 400 | 1.40 | 0.28px | Uppercase section labels |
|
||||
| Small | Unica77 | 12px (0.75rem) | 400 | 1.40 | normal | Smallest text, footer links |
|
||||
| Code Micro | CohereMono | 8px (0.5rem) | 400 | 1.40 | 0.16px | Tiny uppercase code labels |
|
||||
|
||||
### Principles
|
||||
- **Serif for declaration, sans for utility**: CohereText carries the brand voice at display scale — its serif terminals give headlines the authority of published research. Unica77 handles everything functional with Swiss-geometric neutrality.
|
||||
- **Negative tracking at scale**: CohereText uses -1.2px to -1.44px letter-spacing at 60–72px, creating dense, impactful text blocks.
|
||||
- **Single body weight**: Nearly all Unica77 usage is weight 400. Weight 500 appears only for small button emphasis. The system relies on size and spacing, not weight contrast.
|
||||
- **Uppercase code labels**: CohereMono uses uppercase with positive letter-spacing (0.16–0.28px) for technical tags and section markers.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Ghost / Transparent**
|
||||
- Background: transparent (`rgba(255, 255, 255, 0)`)
|
||||
- Text: Cohere Black (`#000000`)
|
||||
- No border visible
|
||||
- Hover: text shifts to Interaction Blue (`#1863dc`), opacity 0.8
|
||||
- Focus: solid 2px outline in Interaction Blue
|
||||
- The primary button style — invisible until interacted with
|
||||
|
||||
**Dark Solid**
|
||||
- Background: dark/black
|
||||
- Text: Pure White
|
||||
- For CTA on light surfaces
|
||||
- Pill-shaped or standard radius
|
||||
|
||||
**Outlined**
|
||||
- Border-based containment
|
||||
- Used in secondary actions
|
||||
|
||||
### Cards & Containers
|
||||
- Background: Pure White (`#ffffff`)
|
||||
- Border: thin solid Lightest Gray (`1px solid #f2f2f2`) for subtle cards; Cool Border (`#d9d9dd`) for emphasized
|
||||
- Radius: **22px** — the signature Cohere radius for primary cards, images, and dialog containers. Also 4px, 8px, 16px, 20px for smaller elements
|
||||
- Shadow: minimal — Cohere relies on background color and borders rather than shadows
|
||||
- Special: `0px 0px 22px 22px` radius (bottom-only rounding) for section containers
|
||||
- Dialog: 8px radius for modal/dialog boxes
|
||||
|
||||
### Inputs & Forms
|
||||
- Text: white on dark input, black on light
|
||||
- Focus border: Focus Purple (`#9b60aa`) with `1px solid`
|
||||
- Focus shadow: red ring (`rgb(179, 0, 0) 0px 0px 0px 2px`) — likely for error state indication
|
||||
- Focus outline: Interaction Blue solid 2px
|
||||
|
||||
### Navigation
|
||||
- Clean horizontal nav on white or dark background
|
||||
- Logo: Cohere wordmark (custom SVG)
|
||||
- Links: Dark text at 16px Unica77
|
||||
- CTA: Dark solid button
|
||||
- Mobile: hamburger collapse
|
||||
|
||||
### Image Treatment
|
||||
- Enterprise photography with diverse subjects and environments
|
||||
- Purple-tinted hero photography for dramatic sections
|
||||
- Product UI screenshots on dark surfaces
|
||||
- Images with 22px radius matching card system
|
||||
- Full-bleed purple gradient sections
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**22px Card System**
|
||||
- The 22px border-radius is Cohere's visual signature
|
||||
- All primary cards, images, and containers use this radius
|
||||
- Creates a cloud-like, organic softness that's distinctive from the typical 8–12px
|
||||
|
||||
**Enterprise Trust Bar**
|
||||
- Company logos displayed in a horizontal strip
|
||||
- Demonstrates enterprise adoption
|
||||
- Clean, monochrome logo treatment
|
||||
|
||||
**Purple Hero Bands**
|
||||
- Full-width deep purple sections housing product showcases
|
||||
- Create dramatic visual breaks in the white page flow
|
||||
- Product screenshots float within the purple environment
|
||||
|
||||
**Uppercase Code Tags**
|
||||
- CohereMono in uppercase with letter-spacing
|
||||
- Used as section markers and categorization labels
|
||||
- Creates a technical, structured information hierarchy
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 2px, 6px, 8px, 10px, 12px, 16px, 20px, 22px, 24px, 28px, 32px, 36px, 40px, 56px, 60px
|
||||
- Button padding varies by variant
|
||||
- Card internal padding: approximately 24–32px
|
||||
- Section vertical spacing: generous (56–60px between sections)
|
||||
|
||||
### Grid & Container
|
||||
- Max container width: up to 2560px (very wide) with responsive scaling
|
||||
- Hero: centered with dramatic typography
|
||||
- Feature sections: multi-column card grids
|
||||
- Enterprise sections: full-width purple bands
|
||||
- 26 breakpoints detected — extremely granular responsive system
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Enterprise clarity**: Each section presents one clear proposition with breathing room between.
|
||||
- **Photography as hero**: Large photographic sections provide visual interest without requiring decorative design elements.
|
||||
- **Card grouping**: Related content is grouped into 22px-rounded cards, creating natural information clusters.
|
||||
|
||||
### Border Radius Scale
|
||||
- Sharp (4px): Navigation elements, small tags, pagination
|
||||
- Comfortable (8px): Dialog boxes, secondary containers, small cards
|
||||
- Generous (16px): Featured containers, medium cards
|
||||
- Large (20px): Large feature cards
|
||||
- Signature (22px): Primary cards, hero images, main containers — THE Cohere radius
|
||||
- Pill (9999px): Buttons, tags, status indicators
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow, no border | Page background, text blocks |
|
||||
| Bordered (Level 1) | `1px solid #f2f2f2` or `#d9d9dd` | Standard cards, list separators |
|
||||
| Purple Band (Level 2) | Full-width dark purple background | Hero sections, feature showcases |
|
||||
|
||||
**Shadow Philosophy**: Cohere is nearly shadow-free. Depth is communicated through **background color contrast** (white cards on purple bands, white surface on snow), **border containment** (cool gray borders), and the dramatic **light-to-dark section alternation**. When elements need elevation, they achieve it through being white-on-dark rather than through shadow casting.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use 22px border-radius on all primary cards and containers — it's the visual signature
|
||||
- Use CohereText for display headings (72px, 60px) with negative letter-spacing
|
||||
- Use Unica77 for all body and UI text at weight 400
|
||||
- Keep the palette black-and-white with cool gray borders
|
||||
- Use Interaction Blue (#1863dc) only for hover/focus interactive states
|
||||
- Use deep purple sections for dramatic visual breaks and product showcases
|
||||
- Apply uppercase + letter-spacing on CohereMono for section labels
|
||||
- Maintain enterprise-appropriate photography with diverse subjects
|
||||
|
||||
### Don't
|
||||
- Don't use border-radius other than 22px on primary cards — the signature radius matters
|
||||
- Don't introduce warm colors — the palette is strictly cool-toned
|
||||
- Don't use heavy shadows — depth comes from color contrast and borders
|
||||
- Don't use bold (700+) weight on body text — 400–500 is the range
|
||||
- Don't skip the serif/sans hierarchy — CohereText for headlines, Unica77 for body
|
||||
- Don't use purple as a surface color for cards — purple is reserved for full-width sections
|
||||
- Don't reduce section spacing below 40px — enterprise layouts need breathing room
|
||||
- Don't use decoration on buttons by default — ghost/transparent is the base state
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Small Mobile | <425px | Compact layout, minimal spacing |
|
||||
| Mobile | 425–640px | Single column, stacked cards |
|
||||
| Large Mobile | 640–768px | Minor spacing adjustments |
|
||||
| Tablet | 768–1024px | 2-column grids begin |
|
||||
| Desktop | 1024–1440px | Full multi-column layout |
|
||||
| Large Desktop | 1440–2560px | Maximum container width |
|
||||
|
||||
*26 breakpoints detected — one of the most granularly responsive sites in the dataset.*
|
||||
|
||||
### Touch Targets
|
||||
- Buttons adequately sized for touch interaction
|
||||
- Navigation links with comfortable spacing
|
||||
- Card surfaces as touch targets
|
||||
|
||||
### Collapsing Strategy
|
||||
- **Navigation**: Full nav collapses to hamburger
|
||||
- **Feature grids**: Multi-column → 2-column → single column
|
||||
- **Hero text**: 72px → 48px → 32px progressive scaling
|
||||
- **Purple sections**: Maintain full-width, content stacks
|
||||
- **Card grids**: 3 → 2 → 1 column
|
||||
|
||||
### Image Behavior
|
||||
- Photography scales proportionally within 22px-radius containers
|
||||
- Product screenshots maintain aspect ratio
|
||||
- Purple sections scale background proportionally
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary Text: "Cohere Black (#000000)"
|
||||
- Page Background: "Pure White (#ffffff)"
|
||||
- Secondary Text: "Near Black (#212121)"
|
||||
- Hover Accent: "Interaction Blue (#1863dc)"
|
||||
- Muted Text: "Muted Slate (#93939f)"
|
||||
- Card Borders: "Lightest Gray (#f2f2f2)"
|
||||
- Section Borders: "Border Cool (#d9d9dd)"
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on Pure White (#ffffff) with CohereText at 72px weight 400, line-height 1.0, letter-spacing -1.44px. Cohere Black text. Subtitle in Unica77 at 18px weight 400, line-height 1.4."
|
||||
- "Design a feature card with 22px border-radius, 1px solid Lightest Gray (#f2f2f2) border on white. Title in Unica77 at 32px, letter-spacing -0.32px. Body in Unica77 at 16px, Muted Slate (#93939f)."
|
||||
- "Build a ghost button: transparent background, Cohere Black text in Unica77 at 16px. On hover, text shifts to Interaction Blue (#1863dc) with 0.8 opacity. Focus: 2px solid Interaction Blue outline."
|
||||
- "Create a deep purple full-width section with white text. CohereText at 60px for the heading. Product screenshot floats within using 22px border-radius."
|
||||
- "Design a section label using CohereMono at 14px, uppercase, letter-spacing 0.28px. Muted Slate (#93939f) text."
|
||||
|
||||
### Iteration Guide
|
||||
1. Focus on ONE component at a time
|
||||
2. Always use 22px radius for primary cards — "the Cohere card roundness"
|
||||
3. Specify the typeface — CohereText for headlines, Unica77 for body, CohereMono for labels
|
||||
4. Interactive elements use Interaction Blue (#1863dc) on hover only
|
||||
5. Keep surfaces white with cool gray borders — no warm tones
|
||||
6. Purple is for full-width sections, never card backgrounds
|
||||
142
skills/creative/popular-web-designs/templates/coinbase.md
Normal file
142
skills/creative/popular-web-designs/templates/coinbase.md
Normal file
@@ -0,0 +1,142 @@
|
||||
# Design System: Coinbase
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `DM Sans` | **Mono:** `system monospace stack`
|
||||
> - **Font stack (CSS):** `font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Coinbase's website is a clean, trustworthy crypto platform that communicates financial reliability through a blue-and-white binary palette. The design uses Coinbase Blue (`#0052ff`) — a deep, saturated blue — as the singular brand accent against white and near-black surfaces. The proprietary font family includes CoinbaseDisplay for hero headlines, CoinbaseSans for UI text, CoinbaseText for body reading, and CoinbaseIcons for iconography — a comprehensive four-font system.
|
||||
|
||||
The button system uses a distinctive 56px radius for pill-shaped CTAs with hover transitions to a lighter blue (`#578bfa`). The design alternates between white content sections and dark (`#0a0b0d`, `#282b31`) feature sections, creating a professional, financial-grade interface.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Coinbase Blue (`#0052ff`) as singular brand accent
|
||||
- Four-font proprietary family: Display, Sans, Text, Icons
|
||||
- 56px radius pill buttons with blue hover transition
|
||||
- Near-black (`#0a0b0d`) dark sections + white light sections
|
||||
- 1.00 line-height on display headings — ultra-tight
|
||||
- Cool gray secondary surface (`#eef0f3`) with blue tint
|
||||
- `text-transform: lowercase` on some button labels — unusual
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Coinbase Blue** (`#0052ff`): Primary brand, links, CTA borders
|
||||
- **Pure White** (`#ffffff`): Primary light surface
|
||||
- **Near Black** (`#0a0b0d`): Text, dark section backgrounds
|
||||
- **Cool Gray Surface** (`#eef0f3`): Secondary button background
|
||||
|
||||
### Interactive
|
||||
- **Hover Blue** (`#578bfa`): Button hover background
|
||||
- **Link Blue** (`#0667d0`): Secondary link color
|
||||
- **Muted Blue** (`#5b616e`): Border color at 20% opacity
|
||||
|
||||
### Surface
|
||||
- **Dark Card** (`#282b31`): Dark button/card backgrounds
|
||||
- **Light Surface** (`rgba(247,247,247,0.88)`): Subtle surface
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Families
|
||||
- **Display**: `CoinbaseDisplay` — hero headlines
|
||||
- **UI / Sans**: `CoinbaseSans` — buttons, headings, nav
|
||||
- **Body**: `CoinbaseText` — reading text
|
||||
- **Icons**: `CoinbaseIcons` — icon font
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Notes |
|
||||
|------|------|------|--------|-------------|-------|
|
||||
| Display Hero | CoinbaseDisplay | 80px | 400 | 1.00 (tight) | Maximum impact |
|
||||
| Display Secondary | CoinbaseDisplay | 64px | 400 | 1.00 | Sub-hero |
|
||||
| Display Third | CoinbaseDisplay | 52px | 400 | 1.00 | Third tier |
|
||||
| Section Heading | CoinbaseSans | 36px | 400 | 1.11 (tight) | Feature sections |
|
||||
| Card Title | CoinbaseSans | 32px | 400 | 1.13 | Card headings |
|
||||
| Feature Title | CoinbaseSans | 18px | 600 | 1.33 | Feature emphasis |
|
||||
| Body Bold | CoinbaseSans | 16px | 700 | 1.50 | Strong body |
|
||||
| Body Semibold | CoinbaseSans | 16px | 600 | 1.25 | Buttons, nav |
|
||||
| Body | CoinbaseText | 18px | 400 | 1.56 | Standard reading |
|
||||
| Body Small | CoinbaseText | 16px | 400 | 1.50 | Secondary reading |
|
||||
| Button | CoinbaseSans | 16px | 600 | 1.20 | +0.16px tracking |
|
||||
| Caption | CoinbaseSans | 14px | 600–700 | 1.50 | Metadata |
|
||||
| Small | CoinbaseSans | 13px | 600 | 1.23 | Tags |
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary Pill (56px radius)**
|
||||
- Background: `#eef0f3` or `#282b31`
|
||||
- Radius: 56px
|
||||
- Border: `1px solid` matching background
|
||||
- Hover: `#578bfa` (light blue)
|
||||
- Focus: `2px solid black` outline
|
||||
|
||||
**Full Pill (100000px radius)**
|
||||
- Used for maximum pill shape
|
||||
|
||||
**Blue Bordered**
|
||||
- Border: `1px solid #0052ff`
|
||||
- Background: transparent
|
||||
|
||||
### Cards & Containers
|
||||
- Radius: 8px–40px range
|
||||
- Borders: `1px solid rgba(91,97,110,0.2)`
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base: 8px
|
||||
- Scale: 1px, 3px, 4px, 5px, 6px, 8px, 10px, 12px, 15px, 16px, 20px, 24px, 25px, 32px, 48px
|
||||
|
||||
### Border Radius Scale
|
||||
- Small (4px–8px): Article links, small cards
|
||||
- Standard (12px–16px): Cards, menus
|
||||
- Large (24px–32px): Feature containers
|
||||
- XL (40px): Large buttons/containers
|
||||
- Pill (56px): Primary CTAs
|
||||
- Full (100000px): Maximum pill
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
Minimal shadow system — depth from color contrast between dark/light sections.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use Coinbase Blue (#0052ff) for primary interactive elements
|
||||
- Apply 56px radius for all CTA buttons
|
||||
- Use CoinbaseDisplay for hero headings only
|
||||
- Alternate dark (#0a0b0d) and white sections
|
||||
|
||||
### Don't
|
||||
- Don't use the blue decoratively — it's functional only
|
||||
- Don't use sharp corners on CTAs — 56px minimum
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
Breakpoints: 400px, 576px, 640px, 768px, 896px, 1280px, 1440px, 1600px
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Brand: Coinbase Blue (`#0052ff`)
|
||||
- Background: White (`#ffffff`)
|
||||
- Dark surface: `#0a0b0d`
|
||||
- Secondary surface: `#eef0f3`
|
||||
- Hover: `#578bfa`
|
||||
- Text: `#0a0b0d`
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create hero: white background. CoinbaseDisplay 80px, line-height 1.00. Pill CTA (#eef0f3, 56px radius). Hover: #578bfa."
|
||||
- "Build dark section: #0a0b0d background. CoinbaseDisplay 64px white text. Blue accent link (#0052ff)."
|
||||
320
skills/creative/popular-web-designs/templates/composio.md
Normal file
320
skills/creative/popular-web-designs/templates/composio.md
Normal file
@@ -0,0 +1,320 @@
|
||||
# Design System: Composio
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `DM Sans` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Composio's interface is a nocturnal command center — a dense, developer-focused darkness punctuated by electric cyan and deep cobalt signals. The entire experience is built on an almost-pure-black canvas (`#0f0f0f`) where content floats within barely-visible containment borders, creating the feeling of a high-tech control panel rather than a traditional marketing page. It's a site that whispers authority to developers who live in dark terminals.
|
||||
|
||||
The visual language leans heavily into the aesthetic of code editors and terminal windows. JetBrains Mono appears alongside the geometric precision of abcDiatype, reinforcing the message that this is a tool built *by* developers *for* developers. Decorative elements are restrained but impactful — subtle cyan-blue gradient glows emanate from cards and sections like bioluminescent organisms in deep water, while hard-offset shadows (`4px 4px`) on select elements add a raw, brutalist edge that prevents the design from feeling sterile.
|
||||
|
||||
What makes Composio distinctive is its tension between extreme minimalism and strategic bursts of luminous color. The site never shouts — headings use tight line-heights (0.87) that compress text into dense, authoritative blocks. Color is rationed like a rare resource: white text for primary content, semi-transparent white (`rgba(255,255,255,0.5-0.6)`) for secondary, and brand blue (`#0007cd`) or electric cyan (`#00ffff`) reserved exclusively for interactive moments and accent glows.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Pitch-black canvas with near-invisible white-border containment (4-12% opacity)
|
||||
- Dual-font identity: geometric sans-serif (abcDiatype) for content, monospace (JetBrains Mono) for technical credibility
|
||||
- Ultra-tight heading line-heights (0.87-1.0) creating compressed, impactful text blocks
|
||||
- Bioluminescent accent strategy — cyan and blue glows that feel like they're emitting light from within
|
||||
- Hard-offset brutalist shadows (`4px 4px`) on select interactive elements
|
||||
- Monochrome hierarchy with color used only at the highest-signal moments
|
||||
- Developer-terminal aesthetic that bridges marketing and documentation
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Composio Cobalt** (`#0007cd`): The core brand color — a deep, saturated blue used sparingly for high-priority interactive elements and brand moments. It anchors the identity with quiet intensity.
|
||||
|
||||
### Secondary & Accent
|
||||
- **Electric Cyan** (`#00ffff`): The attention-grabbing accent — used at low opacity (`rgba(0,255,255,0.12)`) for glowing button backgrounds and card highlights. At full saturation, it serves as the energetic counterpoint to the dark canvas.
|
||||
- **Signal Blue** (`#0089ff` / `rgb(0,137,255)`): Used for select button borders and interactive focus states, bridging the gap between Cobalt and Cyan.
|
||||
- **Ocean Blue** (`#0096ff` / `rgb(0,150,255)`): Accent border color on CTA buttons, slightly warmer than Signal Blue.
|
||||
|
||||
### Surface & Background
|
||||
- **Void Black** (`#0f0f0f`): The primary page background — not pure black, but a hair warmer, reducing eye strain on dark displays.
|
||||
- **Pure Black** (`#000000`): Used for card interiors and deep-nested containers, creating a subtle depth distinction from the page background.
|
||||
- **Charcoal** (`#2c2c2c` / `rgb(44,44,44)`): Used for secondary button borders and divider lines on dark surfaces.
|
||||
|
||||
### Neutrals & Text
|
||||
- **Pure White** (`#ffffff`): Primary heading and high-emphasis text color on dark surfaces.
|
||||
- **Muted Smoke** (`#444444`): De-emphasized body text, metadata, and tertiary content.
|
||||
- **Ghost White** (`rgba(255,255,255,0.6)`): Secondary body text and link labels — visible but deliberately receded.
|
||||
- **Whisper White** (`rgba(255,255,255,0.5)`): Tertiary button text and placeholder content.
|
||||
- **Phantom White** (`rgba(255,255,255,0.2)`): Subtle button backgrounds and deeply receded UI chrome.
|
||||
|
||||
### Semantic & Accent
|
||||
- **Border Mist 12** (`rgba(255,255,255,0.12)`): Highest-opacity border treatment — used for prominent card edges and content separators.
|
||||
- **Border Mist 10** (`rgba(255,255,255,0.10)`): Standard container borders on dark surfaces.
|
||||
- **Border Mist 08** (`rgba(255,255,255,0.08)`): Subtle section dividers and secondary card edges.
|
||||
- **Border Mist 06** (`rgba(255,255,255,0.06)`): Near-invisible containment borders for background groupings.
|
||||
- **Border Mist 04** (`rgba(255,255,255,0.04)`): The faintest border — used for atmospheric separation only.
|
||||
- **Light Border** (`#e0e0e0` / `rgb(224,224,224)`): Reserved for light-surface contexts (rare on this site).
|
||||
|
||||
### Gradient System
|
||||
- **Cyan Glow**: Radial gradients using `#00ffff` at very low opacity, creating bioluminescent halos behind cards and feature sections.
|
||||
- **Blue-to-Black Fade**: Linear gradients from Composio Cobalt (`#0007cd`) fading into Void Black (`#0f0f0f`), used in hero backgrounds and section transitions.
|
||||
- **White Fog**: Bottom-of-page gradient transitioning from dark to a diffused white/gray, creating an atmospheric "horizon line" effect near the footer.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Primary**: `abcDiatype`, with fallbacks: `abcDiatype Fallback, ui-sans-serif, system-ui, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji`
|
||||
- **Monospace**: `JetBrains Mono`, with fallbacks: `JetBrains Mono Fallback, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New`
|
||||
- **System Monospace** (fallback): `Menlo`, `monospace` for smallest inline code
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display / Hero | abcDiatype | 64px (4rem) | 400 | 0.87 (ultra-tight) | normal | Massive, compressed headings |
|
||||
| Section Heading | abcDiatype | 48px (3rem) | 400 | 1.00 (tight) | normal | Major feature section titles |
|
||||
| Sub-heading Large | abcDiatype | 40px (2.5rem) | 400 | 1.00 (tight) | normal | Secondary section markers |
|
||||
| Sub-heading | abcDiatype | 28px (1.75rem) | 400 | 1.20 (tight) | normal | Card titles, feature names |
|
||||
| Card Title | abcDiatype | 24px (1.5rem) | 500 | 1.20 (tight) | normal | Medium-emphasis card headings |
|
||||
| Feature Label | abcDiatype | 20px (1.25rem) | 500 | 1.20 (tight) | normal | Smaller card titles, labels |
|
||||
| Body Large | abcDiatype | 18px (1.125rem) | 400 | 1.20 (tight) | normal | Intro paragraphs |
|
||||
| Body / Button | abcDiatype | 16px (1rem) | 400 | 1.50 | normal | Standard body text, nav links, buttons |
|
||||
| Body Small | abcDiatype | 15px (0.94rem) | 400 | 1.63 (relaxed) | normal | Longer-form body text |
|
||||
| Caption | abcDiatype | 14px (0.875rem) | 400 | 1.63 (relaxed) | normal | Descriptions, metadata |
|
||||
| Label | abcDiatype | 13px (0.81rem) | 500 | 1.50 | normal | UI labels, badges |
|
||||
| Tag / Overline | abcDiatype | 12px (0.75rem) | 500 | 1.00 (tight) | 0.3px | Uppercase overline labels |
|
||||
| Micro | abcDiatype | 12px (0.75rem) | 400 | 1.00 (tight) | 0.3px | Smallest sans-serif text |
|
||||
| Code Body | JetBrains Mono | 16px (1rem) | 400 | 1.50 | -0.32px | Inline code, terminal output |
|
||||
| Code Small | JetBrains Mono | 14px (0.875rem) | 400 | 1.50 | -0.28px | Code snippets, technical labels |
|
||||
| Code Caption | JetBrains Mono | 12px (0.75rem) | 400 | 1.50 | -0.28px | Small code references |
|
||||
| Code Overline | JetBrains Mono | 14px (0.875rem) | 400 | 1.43 | 0.7px | Uppercase technical labels |
|
||||
| Code Micro | JetBrains Mono | 11px (0.69rem) | 400 | 1.33 | 0.55px | Tiny uppercase code tags |
|
||||
| Code Nano | JetBrains Mono | 9-10px | 400 | 1.33 | 0.45-0.5px | Smallest monospace text |
|
||||
|
||||
### Principles
|
||||
- **Compression creates authority**: Heading line-heights are drastically tight (0.87-1.0), making large text feel dense and commanding rather than airy and decorative.
|
||||
- **Dual personality**: abcDiatype carries the marketing voice — geometric, precise, friendly. JetBrains Mono carries the technical voice — credible, functional, familiar to developers.
|
||||
- **Weight restraint**: Almost everything is weight 400 (regular). Weight 500 (medium) is reserved for small labels, badges, and select card titles. Weight 700 (bold) appears only in microscopic system-monospace contexts.
|
||||
- **Negative letter-spacing on code**: JetBrains Mono uses negative letter-spacing (-0.28px to -0.98px) for dense, compact code blocks that feel like a real IDE.
|
||||
- **Uppercase is earned**: The `uppercase` + `letter-spacing` treatment is reserved exclusively for tiny overline labels and technical tags — never for headings.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary CTA (White Fill)**
|
||||
- Background: Pure White (`#ffffff`)
|
||||
- Text: Near Black (`oklch(0.145 0 0)`)
|
||||
- Padding: comfortable (8px 24px)
|
||||
- Border: none
|
||||
- Radius: subtly rounded (likely 4px based on token scale)
|
||||
- Hover: likely subtle opacity reduction or slight gray shift
|
||||
|
||||
**Cyan Accent CTA**
|
||||
- Background: Electric Cyan at 12% opacity (`rgba(0,255,255,0.12)`)
|
||||
- Text: Near Black (`oklch(0.145 0 0)`)
|
||||
- Padding: comfortable (8px 24px)
|
||||
- Border: thin solid Ocean Blue (`1px solid rgb(0,150,255)`)
|
||||
- Radius: subtly rounded (4px)
|
||||
- Creates a "glowing from within" effect on dark backgrounds
|
||||
|
||||
**Ghost / Outline (Signal Blue)**
|
||||
- Background: transparent
|
||||
- Text: Near Black (`oklch(0.145 0 0)`)
|
||||
- Padding: balanced (10px)
|
||||
- Border: thin solid Signal Blue (`1px solid rgb(0,137,255)`)
|
||||
- Hover: likely fill or border color shift
|
||||
|
||||
**Ghost / Outline (Charcoal)**
|
||||
- Background: transparent
|
||||
- Text: Near Black (`oklch(0.145 0 0)`)
|
||||
- Padding: balanced (10px)
|
||||
- Border: thin solid Charcoal (`1px solid rgb(44,44,44)`)
|
||||
- For secondary/tertiary actions on dark surfaces
|
||||
|
||||
**Phantom Button**
|
||||
- Background: Phantom White (`rgba(255,255,255,0.2)`)
|
||||
- Text: Whisper White (`rgba(255,255,255,0.5)`)
|
||||
- No visible border
|
||||
- Used for deeply de-emphasized actions
|
||||
|
||||
### Cards & Containers
|
||||
- Background: Pure Black (`#000000`) or transparent
|
||||
- Border: white at very low opacity, ranging from Border Mist 04 (`rgba(255,255,255,0.04)`) to Border Mist 12 (`rgba(255,255,255,0.12)`) depending on prominence
|
||||
- Radius: barely rounded corners (2px for inline elements, 4px for content cards)
|
||||
- Shadow: select cards use the hard-offset brutalist shadow (`rgba(0,0,0,0.15) 4px 4px 0px 0px`) — a distinctive design choice that adds raw depth
|
||||
- Elevation shadow: deeper containers use soft diffuse shadow (`rgba(0,0,0,0.5) 0px 8px 32px`)
|
||||
- Hover behavior: likely subtle border opacity increase or faint glow effect
|
||||
|
||||
### Inputs & Forms
|
||||
- No explicit input token data extracted — inputs likely follow the dark-surface pattern with:
|
||||
- Background: transparent or Pure Black
|
||||
- Border: Border Mist 10 (`rgba(255,255,255,0.10)`)
|
||||
- Focus: border shifts to Signal Blue (`#0089ff`) or Electric Cyan
|
||||
- Text: Pure White with Ghost White placeholder
|
||||
|
||||
### Navigation
|
||||
- Sticky top nav bar on dark/black background
|
||||
- Logo (white SVG): Composio wordmark on the left
|
||||
- Nav links: Pure White (`#ffffff`) at standard body size (16px, abcDiatype)
|
||||
- CTA button in the nav: White Fill Primary style
|
||||
- Mobile: collapses to hamburger menu, single-column layout
|
||||
- Subtle bottom border on nav (Border Mist 06-08)
|
||||
|
||||
### Image Treatment
|
||||
- Dark-themed product screenshots and UI mockups dominate
|
||||
- Images sit within bordered containers matching the card system
|
||||
- Blue/cyan gradient glows behind or beneath feature images
|
||||
- No visible border-radius on images beyond container rounding (4px)
|
||||
- Full-bleed within their card containers
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Stats/Metrics Display**
|
||||
- Large monospace numbers (JetBrains Mono) — "10k+" style
|
||||
- Tight layout with subtle label text beneath
|
||||
|
||||
**Code Blocks / Terminal Previews**
|
||||
- Dark containers with JetBrains Mono
|
||||
- Syntax-highlighted content
|
||||
- Subtle bordered containers (Border Mist 10)
|
||||
|
||||
**Integration/Partner Logos Grid**
|
||||
- Grid layout of tool logos on dark surface
|
||||
- Contained within bordered card
|
||||
- Demonstrates ecosystem breadth
|
||||
|
||||
**"COMPOSIO" Brand Display**
|
||||
- Oversized brand typography — likely the largest text on the page
|
||||
- Used as a section divider/brand statement
|
||||
- Stark white on black
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 1px, 2px, 4px, 6px, 8px, 10px, 12px, 14px, 16px, 18px, 20px, 24px, 30px, 32px, 40px
|
||||
- Component padding: typically 10px (buttons) to 24px (CTA buttons horizontal)
|
||||
- Section padding: generous vertical spacing (estimated 80-120px between major sections)
|
||||
- Card internal padding: approximately 24-32px
|
||||
|
||||
### Grid & Container
|
||||
- Max container width: approximately 1200px, centered
|
||||
- Content sections use single-column or 2-3 column grids for feature cards
|
||||
- Hero: centered single-column with maximum impact
|
||||
- Feature sections: asymmetric layouts mixing text blocks with product screenshots
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Breathing room between sections**: Large vertical gaps create distinct "chapters" in the page scroll.
|
||||
- **Dense within components**: Cards and text blocks are internally compact (tight line-heights, minimal internal padding), creating focused information nodes.
|
||||
- **Contrast-driven separation**: Rather than relying solely on whitespace, Composio uses border opacity differences and subtle background shifts to delineate content zones.
|
||||
|
||||
### Border Radius Scale
|
||||
- Nearly squared (2px): Inline code spans, small tags, pre blocks — the sharpest treatment, conveying technical precision
|
||||
- Subtly rounded (4px): Content cards, images, standard containers — the workhorse radius
|
||||
- Pill-shaped (37px): Select buttons and badges — creates a softer, more approachable feel for key CTAs
|
||||
- Full round (9999px+): Circular elements, avatar-like containers, decorative dots
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow, no border | Page background, inline text |
|
||||
| Contained (Level 1) | Border Mist 04-08, no shadow | Background groupings, subtle sections |
|
||||
| Card (Level 2) | Border Mist 10-12, no shadow | Standard content cards, code blocks |
|
||||
| Brutalist (Level 3) | Hard offset shadow (`4px 4px`, 15% black) | Select interactive cards, distinctive feature highlights |
|
||||
| Floating (Level 4) | Soft diffuse shadow (`0px 8px 32px`, 50% black) | Modals, overlays, deeply elevated content |
|
||||
|
||||
**Shadow Philosophy**: Composio uses shadows sparingly and with deliberate contrast. The hard-offset brutalist shadow is the signature — it breaks the sleek darkness with a raw, almost retro-computing feel. The soft diffuse shadow is reserved for truly floating elements. Most depth is communicated through border opacity gradations rather than shadows.
|
||||
|
||||
### Decorative Depth
|
||||
- **Cyan Glow Halos**: Radial gradient halos using Electric Cyan at low opacity behind feature cards and images. Creates a "screen glow" effect as if the UI elements are emitting light.
|
||||
- **Blue-Black Gradient Washes**: Linear gradients from Composio Cobalt to Void Black used as section backgrounds, adding subtle color temperature shifts.
|
||||
- **White Fog Horizon**: A gradient from dark to diffused white/gray at the bottom of the page, creating an atmospheric "dawn" effect before the footer.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use Void Black (`#0f0f0f`) as the primary page background — never pure white for main surfaces
|
||||
- Keep heading line-heights ultra-tight (0.87-1.0) for compressed, authoritative text blocks
|
||||
- Use white-opacity borders (4-12%) for containment — they're more important than shadows here
|
||||
- Reserve Electric Cyan (`#00ffff`) for high-signal moments only — CTAs, glows, interactive accents
|
||||
- Pair abcDiatype with JetBrains Mono to reinforce the developer-tool identity
|
||||
- Use the hard-offset shadow (`4px 4px`) intentionally on select elements for brutalist personality
|
||||
- Keep button text dark (`oklch(0.145 0 0)`) even on the darkest backgrounds — buttons carry their own surface
|
||||
- Layer opacity-based borders to create subtle depth without shadows
|
||||
- Use uppercase + letter-spacing only for tiny overline labels (12px or smaller)
|
||||
|
||||
### Don't
|
||||
- Don't use bright backgrounds or light surfaces as primary containers
|
||||
- Don't apply heavy shadows everywhere — depth comes from border opacity, not box-shadow
|
||||
- Don't use Composio Cobalt (`#0007cd`) as a text color — it's too dark on dark and too saturated on light
|
||||
- Don't increase heading line-heights beyond 1.2 — the compressed feel is core to the identity
|
||||
- Don't use bold (700) weight for body or heading text — 400-500 is the ceiling
|
||||
- Don't mix warm colors — the palette is strictly cool (blue, cyan, white, black)
|
||||
- Don't use border-radius larger than 4px on content cards — the precision of near-square corners is intentional
|
||||
- Don't place Electric Cyan at full opacity on large surfaces — it's an accent, used at 12% max for backgrounds
|
||||
- Don't use decorative serif or handwritten fonts — the entire identity is geometric sans + monospace
|
||||
- Don't skip the monospace font for technical content — JetBrains Mono is not decorative, it's a credibility signal
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <768px | Single column, hamburger nav, full-width cards, reduced section padding, hero text scales down to ~28-40px |
|
||||
| Tablet | 768-1024px | 2-column grid for cards, condensed nav, slightly reduced hero text |
|
||||
| Desktop | 1024-1440px | Full multi-column layout, expanded nav with all links visible, large hero typography (64px) |
|
||||
| Large Desktop | >1440px | Max-width container centered, generous horizontal margins |
|
||||
|
||||
### Touch Targets
|
||||
- Minimum touch target: 44x44px for all interactive elements
|
||||
- Buttons use comfortable padding (8px 24px minimum) ensuring adequate touch area
|
||||
- Nav links spaced with sufficient gap for thumb navigation
|
||||
|
||||
### Collapsing Strategy
|
||||
- **Navigation**: Full horizontal nav on desktop collapses to hamburger on mobile
|
||||
- **Feature grids**: 3-column → 2-column → single-column stacking
|
||||
- **Hero text**: 64px → 40px → 28px progressive scaling
|
||||
- **Section padding**: Reduces proportionally but maintains generous vertical rhythm
|
||||
- **Cards**: Stack vertically on mobile with full-width treatment
|
||||
- **Code blocks**: Horizontal scroll on smaller viewports rather than wrapping
|
||||
|
||||
### Image Behavior
|
||||
- Product screenshots scale proportionally within their containers
|
||||
- Dark-themed images maintain contrast on the dark background at all sizes
|
||||
- Gradient glow effects scale with container size
|
||||
- No visible art direction changes between breakpoints — same crops, proportional scaling
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary CTA: "Pure White (#ffffff)"
|
||||
- Page Background: "Void Black (#0f0f0f)"
|
||||
- Brand Accent: "Composio Cobalt (#0007cd)"
|
||||
- Glow Accent: "Electric Cyan (#00ffff)"
|
||||
- Heading Text: "Pure White (#ffffff)"
|
||||
- Body Text: "Ghost White (rgba(255,255,255,0.6))"
|
||||
- Card Border: "Border Mist 10 (rgba(255,255,255,0.10))"
|
||||
- Button Border: "Signal Blue (#0089ff)"
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a feature card with a near-black background (#000000), barely visible white border at 10% opacity, subtly rounded corners (4px), and a hard-offset shadow (4px right, 4px down, 15% black). Use Pure White for the title in abcDiatype at 24px weight 500, and Ghost White (60% opacity) for the description at 16px."
|
||||
- "Design a primary CTA button with a solid white background, near-black text, comfortable padding (8px vertical, 24px horizontal), and subtly rounded corners. Place it next to a secondary button with transparent background, Signal Blue border, and matching padding."
|
||||
- "Build a hero section on Void Black (#0f0f0f) with a massive heading at 64px, line-height 0.87, in abcDiatype. Center the text. Add a subtle blue-to-black gradient glow behind the content. Include a white CTA button and a cyan-accented secondary button below."
|
||||
- "Create a code snippet display using JetBrains Mono at 14px with -0.28px letter-spacing on a black background. Add a Border Mist 10 border (rgba(255,255,255,0.10)) and 4px radius. Show syntax-highlighted content with white and cyan text."
|
||||
- "Design a navigation bar on Void Black with the Composio wordmark in white on the left, 4-5 nav links in white abcDiatype at 16px, and a white-fill CTA button on the right. Add a Border Mist 06 bottom border."
|
||||
|
||||
### Iteration Guide
|
||||
When refining existing screens generated with this design system:
|
||||
1. Focus on ONE component at a time
|
||||
2. Reference specific color names and hex codes from this document — "use Ghost White (rgba(255,255,255,0.6))" not "make it lighter"
|
||||
3. Use natural language descriptions — "make the border barely visible" = Border Mist 04-06
|
||||
4. Describe the desired "feel" alongside specific measurements — "compressed and authoritative heading at 48px with line-height 1.0"
|
||||
5. For glow effects, specify "Electric Cyan at 12% opacity as a radial gradient behind the element"
|
||||
6. Always specify which font — abcDiatype for marketing, JetBrains Mono for technical/code content
|
||||
322
skills/creative/popular-web-designs/templates/cursor.md
Normal file
322
skills/creative/popular-web-designs/templates/cursor.md
Normal file
@@ -0,0 +1,322 @@
|
||||
# Design System: Cursor
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Cursor's website is a study in warm minimalism meets code-editor elegance. The entire experience is built on a warm off-white canvas (`#f2f1ed`) with dark warm-brown text (`#26251e`) -- not pure black, not neutral gray, but a deeply warm near-black with a yellowish undertone that evokes old paper, ink, and craft. This warmth permeates every surface: backgrounds lean toward cream (`#e6e5e0`, `#ebeae5`), borders dissolve into transparent warm overlays using `oklab` color space, and even the error state (`#cf2d56`) carries warmth rather than clinical red. The result feels more like a premium print publication than a tech website.
|
||||
|
||||
The custom CursorGothic font is the typographic signature -- a gothic sans-serif with aggressive negative letter-spacing at display sizes (-2.16px at 72px) that creates a compressed, engineered feel. As a secondary voice, the jjannon serif font (with OpenType `"cswh"` contextual swash alternates) provides literary counterpoint for body copy and editorial passages. The monospace voice comes from berkeleyMono, a refined coding font that connects the marketing site to Cursor's core identity as a code editor. This three-font system (gothic display, serif body, mono code) gives Cursor one of the most typographically rich palettes in developer tooling.
|
||||
|
||||
The border system is particularly distinctive -- Cursor uses `oklab()` color space for border colors, applying warm brown at various alpha levels (0.1, 0.2, 0.55) to create borders that feel organic rather than mechanical. The signature border color `oklab(0.263084 -0.00230259 0.0124794 / 0.1)` is not a simple rgba value but a perceptually uniform color that maintains visual consistency across different backgrounds.
|
||||
|
||||
**Key Characteristics:**
|
||||
- CursorGothic with aggressive negative letter-spacing (-2.16px at 72px, -0.72px at 36px) for compressed display headings
|
||||
- jjannon serif for body text with OpenType `"cswh"` (contextual swash alternates)
|
||||
- berkeleyMono for code and technical labels
|
||||
- Warm off-white background (`#f2f1ed`) instead of pure white -- the entire system is warm-shifted
|
||||
- Primary text color `#26251e` (warm near-black with yellow undertone)
|
||||
- Accent orange `#f54e00` for brand highlight and links
|
||||
- oklab-space borders at various alpha levels for perceptually uniform edge treatment
|
||||
- Pill-shaped elements with extreme radius (33.5M px, effectively full-pill)
|
||||
- 8px base spacing system with fine-grained sub-8px increments (1.5px, 2px, 2.5px, 3px, 4px, 5px, 6px)
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Cursor Dark** (`#26251e`): Primary text, headings, dark UI surfaces. A warm near-black with distinct yellow-brown undertone -- the defining color of the system.
|
||||
- **Cursor Cream** (`#f2f1ed`): Page background, primary surface. Not white but a warm cream that sets the entire warm tone.
|
||||
- **Cursor Light** (`#e6e5e0`): Secondary surface, button backgrounds, card fills. A slightly warmer, slightly darker cream.
|
||||
- **Pure White** (`#ffffff`): Used sparingly for maximum contrast elements and specific surface highlights.
|
||||
- **True Black** (`#000000`): Minimal use, specific code/console contexts.
|
||||
|
||||
### Accent
|
||||
- **Cursor Orange** (`#f54e00`): Brand accent, `--color-accent`. A vibrant red-orange used for primary CTAs, active links, and brand moments. Warm and urgent.
|
||||
- **Gold** (`#c08532`): Secondary accent, warm gold for premium or highlighted contexts.
|
||||
|
||||
### Semantic
|
||||
- **Error** (`#cf2d56`): `--color-error`. A warm crimson-rose rather than cold red.
|
||||
- **Success** (`#1f8a65`): `--color-success`. A muted teal-green, warm-shifted.
|
||||
|
||||
### Timeline / Feature Colors
|
||||
- **Thinking** (`#dfa88f`): Warm peach for "thinking" state in AI timeline.
|
||||
- **Grep** (`#9fc9a2`): Soft sage green for search/grep operations.
|
||||
- **Read** (`#9fbbe0`): Soft blue for file reading operations.
|
||||
- **Edit** (`#c0a8dd`): Soft lavender for editing operations.
|
||||
|
||||
### Surface Scale
|
||||
- **Surface 100** (`#f7f7f4`): Lightest button/card surface, barely tinted.
|
||||
- **Surface 200** (`#f2f1ed`): Primary page background.
|
||||
- **Surface 300** (`#ebeae5`): Button default background, subtle emphasis.
|
||||
- **Surface 400** (`#e6e5e0`): Card backgrounds, secondary surfaces.
|
||||
- **Surface 500** (`#e1e0db`): Tertiary button background, deeper emphasis.
|
||||
|
||||
### Border Colors
|
||||
- **Border Primary** (`oklab(0.263084 -0.00230259 0.0124794 / 0.1)`): Standard border, 10% warm brown in oklab space.
|
||||
- **Border Medium** (`oklab(0.263084 -0.00230259 0.0124794 / 0.2)`): Emphasized border, 20% warm brown.
|
||||
- **Border Strong** (`rgba(38, 37, 30, 0.55)`): Strong borders, table rules.
|
||||
- **Border Solid** (`#26251e`): Full-opacity dark border for maximum contrast.
|
||||
- **Border Light** (`#f2f1ed`): Light border matching page background.
|
||||
|
||||
### Shadows & Depth
|
||||
- **Card Shadow** (`rgba(0,0,0,0.14) 0px 28px 70px, rgba(0,0,0,0.1) 0px 14px 32px, oklab(0.263084 -0.00230259 0.0124794 / 0.1) 0px 0px 0px 1px`): Heavy elevated card with warm oklab border ring.
|
||||
- **Ambient Shadow** (`rgba(0,0,0,0.02) 0px 0px 16px, rgba(0,0,0,0.008) 0px 0px 8px`): Subtle ambient glow for floating elements.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Display/Headlines**: `CursorGothic`, with fallbacks: `CursorGothic Fallback, system-ui, Helvetica Neue, Helvetica, Arial`
|
||||
- **Body/Editorial**: `jjannon`, with fallbacks: `Iowan Old Style, Palatino Linotype, URW Palladio L, P052, ui-serif, Georgia, Cambria, Times New Roman, Times`
|
||||
- **Code/Technical**: `berkeleyMono`, with fallbacks: `ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New`
|
||||
- **UI/System**: `system-ui`, with fallbacks: `-apple-system, Segoe UI, Helvetica Neue, Arial`
|
||||
- **Icons**: `CursorIcons16` (icon font at 14px and 12px)
|
||||
- **OpenType Features**: `"cswh"` on jjannon body text, `"ss09"` on CursorGothic buttons/captions
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | CursorGothic | 72px (4.50rem) | 400 | 1.10 (tight) | -2.16px | Maximum compression, hero statements |
|
||||
| Section Heading | CursorGothic | 36px (2.25rem) | 400 | 1.20 (tight) | -0.72px | Feature sections, CTA headlines |
|
||||
| Sub-heading | CursorGothic | 26px (1.63rem) | 400 | 1.25 (tight) | -0.325px | Card headings, sub-sections |
|
||||
| Title Small | CursorGothic | 22px (1.38rem) | 400 | 1.30 (tight) | -0.11px | Smaller titles, list headings |
|
||||
| Body Serif | jjannon | 19.2px (1.20rem) | 500 | 1.50 | normal | Editorial body with `"cswh"` |
|
||||
| Body Serif SM | jjannon | 17.28px (1.08rem) | 400 | 1.35 | normal | Standard body text, descriptions |
|
||||
| Body Sans | CursorGothic | 16px (1.00rem) | 400 | 1.50 | normal/0.08px | UI body text |
|
||||
| Button Label | CursorGothic | 14px (0.88rem) | 400 | 1.00 (tight) | normal | Primary button text |
|
||||
| Button Caption | CursorGothic | 14px (0.88rem) | 400 | 1.50 | 0.14px | Secondary button with `"ss09"` |
|
||||
| Caption | CursorGothic | 11px (0.69rem) | 400-500 | 1.50 | normal | Small captions, metadata |
|
||||
| System Heading | system-ui | 20px (1.25rem) | 700 | 1.55 | normal | System UI headings |
|
||||
| System Caption | system-ui | 13px (0.81rem) | 500-600 | 1.33 | normal | System UI labels |
|
||||
| System Micro | system-ui | 11px (0.69rem) | 500 | 1.27 (tight) | 0.048px | Uppercase micro labels |
|
||||
| Mono Body | berkeleyMono | 12px (0.75rem) | 400 | 1.67 (relaxed) | normal | Code blocks |
|
||||
| Mono Small | berkeleyMono | 11px (0.69rem) | 400 | 1.33 | -0.275px | Inline code, terminal |
|
||||
| Lato Heading | Lato | 16px (1.00rem) | 600 | 1.33 | normal | Lato section headings |
|
||||
| Lato Caption | Lato | 14px (0.88rem) | 400-600 | 1.33 | normal | Lato captions |
|
||||
| Lato Micro | Lato | 12px (0.75rem) | 400-600 | 1.27 (tight) | 0.053px | Lato small labels |
|
||||
|
||||
### Principles
|
||||
- **Gothic compression for impact**: CursorGothic at display sizes uses -2.16px letter-spacing at 72px, progressively relaxing: -0.72px at 36px, -0.325px at 26px, -0.11px at 22px, normal at 16px and below. The tracking creates a sense of precision engineering.
|
||||
- **Serif for soul**: jjannon provides literary warmth. The `"cswh"` feature adds contextual swash alternates that give body text a calligraphic quality.
|
||||
- **Three typographic voices**: Gothic (display/UI), serif (editorial/body), mono (code/technical). Each serves a distinct communication purpose.
|
||||
- **Weight restraint**: CursorGothic uses weight 400 almost exclusively, relying on size and tracking for hierarchy rather than weight. System-ui components use 500-700 for functional emphasis.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary (Warm Surface)**
|
||||
- Background: `#ebeae5` (Surface 300)
|
||||
- Text: `#26251e` (Cursor Dark)
|
||||
- Padding: 10px 12px 10px 14px
|
||||
- Radius: 8px
|
||||
- Outline: none
|
||||
- Hover: text shifts to `var(--color-error)` (`#cf2d56`)
|
||||
- Focus shadow: `rgba(0,0,0,0.1) 0px 4px 12px`
|
||||
- Use: Primary actions, main CTAs
|
||||
|
||||
**Secondary Pill**
|
||||
- Background: `#e6e5e0` (Surface 400)
|
||||
- Text: `oklab(0.263 / 0.6)` (60% warm brown)
|
||||
- Padding: 3px 8px
|
||||
- Radius: full pill (33.5M px)
|
||||
- Hover: text shifts to `var(--color-error)`
|
||||
- Use: Tags, filters, secondary actions
|
||||
|
||||
**Tertiary Pill**
|
||||
- Background: `#e1e0db` (Surface 500)
|
||||
- Text: `oklab(0.263 / 0.6)` (60% warm brown)
|
||||
- Radius: full pill
|
||||
- Use: Active filter state, selected tags
|
||||
|
||||
**Ghost (Transparent)**
|
||||
- Background: `rgba(38, 37, 30, 0.06)` (6% warm brown)
|
||||
- Text: `rgba(38, 37, 30, 0.55)` (55% warm brown)
|
||||
- Padding: 6px 12px
|
||||
- Use: Tertiary actions, dismiss buttons
|
||||
|
||||
**Light Surface**
|
||||
- Background: `#f7f7f4` (Surface 100) or `#f2f1ed` (Surface 200)
|
||||
- Text: `#26251e` or `oklab(0.263 / 0.9)` (90%)
|
||||
- Padding: 0px 8px 1px 12px
|
||||
- Use: Dropdown triggers, subtle interactive elements
|
||||
|
||||
### Cards & Containers
|
||||
- Background: `#e6e5e0` or `#f2f1ed`
|
||||
- Border: `1px solid oklab(0.263 / 0.1)` (warm brown at 10%)
|
||||
- Radius: 8px (standard), 4px (compact), 10px (featured)
|
||||
- Shadow: `rgba(0,0,0,0.14) 0px 28px 70px, rgba(0,0,0,0.1) 0px 14px 32px` for elevated cards
|
||||
- Hover: shadow intensification
|
||||
|
||||
### Inputs & Forms
|
||||
- Background: transparent or surface
|
||||
- Text: `#26251e`
|
||||
- Padding: 8px 8px 6px (textarea)
|
||||
- Border: `1px solid oklab(0.263 / 0.1)`
|
||||
- Focus: border shifts to `oklab(0.263 / 0.2)` or accent orange
|
||||
|
||||
### Navigation
|
||||
- Clean horizontal nav on warm cream background
|
||||
- Cursor logotype left-aligned (~96x24px)
|
||||
- Links: 14px CursorGothic or system-ui, weight 500
|
||||
- CTA button: warm surface with Cursor Dark text
|
||||
- Tab navigation: bottom border `1px solid oklab(0.263 / 0.1)` with active tab differentiation
|
||||
|
||||
### Image Treatment
|
||||
- Code editor screenshots with `1px solid oklab(0.263 / 0.1)` border
|
||||
- Rounded corners: 8px standard
|
||||
- AI chat/timeline screenshots dominate feature sections
|
||||
- Warm gradient or solid cream backgrounds behind hero images
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**AI Timeline**
|
||||
- Vertical timeline showing AI operations: thinking (peach), grep (sage), read (blue), edit (lavender)
|
||||
- Each step uses its semantic color with matching text
|
||||
- Connected with vertical lines
|
||||
- Core visual metaphor for Cursor's AI-first coding experience
|
||||
|
||||
**Code Editor Previews**
|
||||
- Dark code editor screenshots with warm cream border frame
|
||||
- berkeleyMono for code text
|
||||
- Syntax highlighting using timeline colors
|
||||
|
||||
**Pricing Cards**
|
||||
- Warm surface backgrounds with bordered containers
|
||||
- Feature lists using jjannon serif for readability
|
||||
- CTA buttons with accent orange or primary dark styling
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Fine scale: 1.5px, 2px, 2.5px, 3px, 4px, 5px, 6px (sub-8px for micro-adjustments)
|
||||
- Standard scale: 8px, 10px, 12px, 14px (derived from extraction)
|
||||
- Extended scale (inferred): 16px, 24px, 32px, 48px, 64px, 96px
|
||||
- Notable: fine-grained sub-8px increments for precise icon/text alignment
|
||||
|
||||
### Grid & Container
|
||||
- Max content width: approximately 1200px
|
||||
- Hero: centered single-column with generous top padding (80-120px)
|
||||
- Feature sections: 2-3 column grids for cards and features
|
||||
- Full-width sections with warm cream or slightly darker backgrounds
|
||||
- Sidebar layouts for documentation and settings pages
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Warm negative space**: The cream background means whitespace has warmth and texture, unlike cold white minimalism. Large empty areas feel cozy rather than clinical.
|
||||
- **Compressed text, open layout**: Aggressive negative letter-spacing on CursorGothic headlines is balanced by generous surrounding margins. Text is dense; space around it breathes.
|
||||
- **Section variation**: Alternating surface tones (cream → lighter cream → cream) create subtle section differentiation without harsh boundaries.
|
||||
|
||||
### Border Radius Scale
|
||||
- Micro (1.5px): Fine detail elements
|
||||
- Small (2px): Inline elements, code spans
|
||||
- Medium (3px): Small containers, inline badges
|
||||
- Standard (4px): Cards, images, compact buttons
|
||||
- Comfortable (8px): Primary buttons, cards, menus
|
||||
- Featured (10px): Larger containers, featured cards
|
||||
- Full Pill (33.5M px / 9999px): Pill buttons, tags, badges
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow | Page background, text blocks |
|
||||
| Border Ring (Level 1) | `oklab(0.263 / 0.1) 0px 0px 0px 1px` | Standard card/container border (warm oklab) |
|
||||
| Border Medium (Level 1b) | `oklab(0.263 / 0.2) 0px 0px 0px 1px` | Emphasized borders, active states |
|
||||
| Ambient (Level 2) | `rgba(0,0,0,0.02) 0px 0px 16px, rgba(0,0,0,0.008) 0px 0px 8px` | Floating elements, subtle glow |
|
||||
| Elevated Card (Level 3) | `rgba(0,0,0,0.14) 0px 28px 70px, rgba(0,0,0,0.1) 0px 14px 32px, oklab ring` | Modals, popovers, elevated cards |
|
||||
| Focus | `rgba(0,0,0,0.1) 0px 4px 12px` on button focus | Interactive focus feedback |
|
||||
|
||||
**Shadow Philosophy**: Cursor's depth system is built around two ideas. First, borders use perceptually uniform oklab color space rather than rgba, ensuring warm brown borders look consistent across different background tones. Second, elevation shadows use dramatically large blur values (28px, 70px) with moderate opacity (0.14, 0.1), creating a diffused, atmospheric lift rather than hard-edged drop shadows. Cards don't feel like they float above the page -- they feel like the page has gently opened a space for them.
|
||||
|
||||
### Decorative Depth
|
||||
- Warm cream surface variations create subtle tonal depth without shadows
|
||||
- oklab borders at 10% and 20% create a spectrum of edge definition
|
||||
- No harsh divider lines -- section separation through background tone shifts and spacing
|
||||
|
||||
## 7. Interaction & Motion
|
||||
|
||||
### Hover States
|
||||
- Buttons: text color shifts to `--color-error` (`#cf2d56`) on hover -- a distinctive warm crimson that signals interactivity
|
||||
- Links: color shift to accent orange (`#f54e00`) or underline decoration with `rgba(38, 37, 30, 0.4)`
|
||||
- Cards: shadow intensification on hover (ambient → elevated)
|
||||
|
||||
### Focus States
|
||||
- Shadow-based focus: `rgba(0,0,0,0.1) 0px 4px 12px` for depth-based focus indication
|
||||
- Border focus: `oklab(0.263 / 0.2)` (20% border) for input/form focus
|
||||
- Consistent warm tone in all focus states -- no cold blue focus rings
|
||||
|
||||
### Transitions
|
||||
- Color transitions: 150ms ease for text/background color changes
|
||||
- Shadow transitions: 200ms ease for elevation changes
|
||||
- Transform: subtle scale or translate for interactive feedback
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <600px | Single column, reduced padding, stacked navigation |
|
||||
| Tablet Small | 600-768px | 2-column grids begin |
|
||||
| Tablet | 768-900px | Expanded card grids, sidebar appears |
|
||||
| Desktop Small | 900-1279px | Full layout forming |
|
||||
| Desktop | >1279px | Full layout, maximum content width |
|
||||
|
||||
### Touch Targets
|
||||
- Buttons use comfortable padding (6px-14px vertical, 8px-14px horizontal)
|
||||
- Pill buttons maintain tap-friendly sizing with 3px-10px padding
|
||||
- Navigation links at 14px with adequate spacing for touch
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero: 72px CursorGothic → 36px → 26px on smaller screens, maintaining proportional letter-spacing
|
||||
- Navigation: horizontal links → hamburger menu on mobile
|
||||
- Feature cards: 3-column → 2-column → single column stacked
|
||||
- Code editor screenshots: maintain aspect ratio, may shrink with border treatment preserved
|
||||
- Timeline visualization: horizontal → vertical stacking
|
||||
- Section spacing: 80px+ → 48px → 32px on mobile
|
||||
|
||||
### Image Behavior
|
||||
- Editor screenshots maintain warm border treatment at all sizes
|
||||
- AI timeline adapts from horizontal to vertical layout
|
||||
- Product screenshots use responsive images with consistent border radius
|
||||
- Full-width hero images scale proportionally
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary CTA background: `#ebeae5` (warm cream button)
|
||||
- Page background: `#f2f1ed` (warm off-white)
|
||||
- Text color: `#26251e` (warm near-black)
|
||||
- Secondary text: `rgba(38, 37, 30, 0.55)` (55% warm brown)
|
||||
- Accent: `#f54e00` (orange)
|
||||
- Error/hover: `#cf2d56` (warm crimson)
|
||||
- Success: `#1f8a65` (muted teal)
|
||||
- Border: `oklab(0.263084 -0.00230259 0.0124794 / 0.1)` or `rgba(38, 37, 30, 0.1)` as fallback
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on `#f2f1ed` warm cream background. Headline at 72px CursorGothic weight 400, line-height 1.10, letter-spacing -2.16px, color `#26251e`. Subtitle at 17.28px jjannon weight 400, line-height 1.35, color `rgba(38,37,30,0.55)`. Primary CTA button (`#ebeae5` bg, 8px radius, 10px 14px padding) with hover text shift to `#cf2d56`."
|
||||
- "Design a card: `#e6e5e0` background, border `1px solid rgba(38,37,30,0.1)`. Radius 8px. Title at 22px CursorGothic weight 400, letter-spacing -0.11px. Body at 17.28px jjannon weight 400, color `rgba(38,37,30,0.55)`. Use `#f54e00` for link accents."
|
||||
- "Build a pill tag: `#e6e5e0` background, `rgba(38,37,30,0.6)` text, full-pill radius (9999px), 3px 8px padding, 14px CursorGothic weight 400."
|
||||
- "Create navigation: sticky `#f2f1ed` background with backdrop-filter blur. 14px system-ui weight 500 for links, `#26251e` text. CTA button right-aligned with `#ebeae5` bg and 8px radius. Bottom border `1px solid rgba(38,37,30,0.1)`."
|
||||
- "Design an AI timeline showing four steps: Thinking (`#dfa88f`), Grep (`#9fc9a2`), Read (`#9fbbe0`), Edit (`#c0a8dd`). Each step: 14px system-ui label + 16px CursorGothic description + vertical connecting line in `rgba(38,37,30,0.1)`."
|
||||
|
||||
### Iteration Guide
|
||||
1. Always use warm tones -- `#f2f1ed` background, `#26251e` text, never pure white/black for primary surfaces
|
||||
2. Letter-spacing scales with font size for CursorGothic: -2.16px at 72px, -0.72px at 36px, -0.325px at 26px, normal at 16px
|
||||
3. Use `rgba(38, 37, 30, alpha)` as a CSS-compatible fallback for oklab borders
|
||||
4. Three fonts, three voices: CursorGothic (display/UI), jjannon (editorial), berkeleyMono (code)
|
||||
5. Pill shapes (9999px radius) for tags and filters; 8px radius for primary buttons and cards
|
||||
6. Hover states use `#cf2d56` text color -- the warm crimson shift is a signature interaction
|
||||
7. Shadows use large blur values (28px, 70px) for diffused atmospheric depth
|
||||
8. The sub-8px spacing scale (1.5, 2, 2.5, 3, 4, 5, 6px) is critical for icon/text micro-alignment
|
||||
278
skills/creative/popular-web-designs/templates/elevenlabs.md
Normal file
278
skills/creative/popular-web-designs/templates/elevenlabs.md
Normal file
@@ -0,0 +1,278 @@
|
||||
# Design System: ElevenLabs
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
ElevenLabs' website is a study in restrained elegance — a near-white canvas (`#ffffff`, `#f5f5f5`) where typography and subtle shadows do all the heavy lifting. The design feels like a premium audio product brochure: clean, spacious, and confident enough to let the content speak (literally, given ElevenLabs makes voice AI). There's an almost Apple-like quality to the whitespace strategy, but warmer — the occasional warm stone tint (`#f5f2ef`, `#777169`) prevents the purity from feeling clinical.
|
||||
|
||||
The typography system is built on a fascinating duality: Waldenburg at weight 300 (light) for display headings creates ethereal, whisper-thin titles that feel like sound waves rendered in type — delicate, precise, and surprisingly impactful at large sizes. This light-weight display approach is the design's signature — where most sites use bold headings to grab attention, ElevenLabs uses lightness to create intrigue. Inter handles all body and UI text with workmanlike reliability, using slight positive letter-spacing (0.14px–0.18px) that gives body text an airy, well-spaced quality. WaldenburgFH appears as a bold uppercase variant for specific button labels.
|
||||
|
||||
What makes ElevenLabs distinctive is its multi-layered shadow system. Rather than simple box-shadows, elements use complex stacks: inset border-shadows (`rgba(0,0,0,0.075) 0px 0px 0px 0.5px inset`), outline shadows (`rgba(0,0,0,0.06) 0px 0px 0px 1px`), and soft elevation shadows (`rgba(0,0,0,0.04) 0px 4px 4px`) — all at remarkably low opacities. The result is a design where surfaces seem to barely exist, floating just above the page with the lightest possible touch. Pill-shaped buttons (9999px) with warm-tinted backgrounds (`rgba(245,242,239,0.8)`) and warm shadows (`rgba(78,50,23,0.04)`) add a tactile, physical quality.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Near-white canvas with warm undertones (`#f5f5f5`, `#f5f2ef`)
|
||||
- Waldenburg weight 300 (light) for display — ethereal, whisper-thin headings
|
||||
- Inter with positive letter-spacing (0.14–0.18px) for body — airy readability
|
||||
- Multi-layered shadow stacks at sub-0.1 opacity — surfaces barely exist
|
||||
- Pill buttons (9999px) with warm stone-tinted backgrounds
|
||||
- WaldenburgFH bold uppercase for specific CTA labels
|
||||
- Warm shadow tints: `rgba(78, 50, 23, 0.04)` — shadows have color, not just darkness
|
||||
- Geist Mono / ui-monospace for code snippets
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Pure White** (`#ffffff`): Primary background, card surfaces, button backgrounds
|
||||
- **Light Gray** (`#f5f5f5`): Secondary surface, subtle section differentiation
|
||||
- **Warm Stone** (`#f5f2ef`): Button background (at 80% opacity) — the warm signature
|
||||
- **Black** (`#000000`): Primary text, headings, dark buttons
|
||||
|
||||
### Neutral Scale
|
||||
- **Dark Gray** (`#4e4e4e`): Secondary text, descriptions
|
||||
- **Warm Gray** (`#777169`): Tertiary text, muted links, decorative underlines
|
||||
- **Near White** (`#f6f6f6`): Alternate light surface
|
||||
|
||||
### Interactive
|
||||
- **Grid Cyan** (`#7fffff`): `--grid-column-bg`, at 25% opacity — decorative grid overlay
|
||||
- **Ring Blue** (`rgb(147 197 253 / 0.5)`): `--tw-ring-color`, focus ring
|
||||
- **Border Light** (`#e5e5e5`): Explicit borders
|
||||
- **Border Subtle** (`rgba(0, 0, 0, 0.05)`): Ultra-subtle bottom borders
|
||||
|
||||
### Shadows
|
||||
- **Inset Border** (`rgba(0,0,0,0.075) 0px 0px 0px 0.5px inset`): Internal edge definition
|
||||
- **Inset Dark** (`rgba(0,0,0,0.1) 0px 0px 0px 0.5px inset`): Stronger inset variant
|
||||
- **Outline Ring** (`rgba(0,0,0,0.06) 0px 0px 0px 1px`): Shadow-as-border
|
||||
- **Soft Elevation** (`rgba(0,0,0,0.04) 0px 4px 4px`): Gentle lift
|
||||
- **Card Shadow** (`rgba(0,0,0,0.4) 0px 0px 1px, rgba(0,0,0,0.04) 0px 4px 4px`): Button/card elevation
|
||||
- **Warm Shadow** (`rgba(78,50,23,0.04) 0px 6px 16px`): Warm-tinted button shadow
|
||||
- **Edge Shadow** (`rgba(0,0,0,0.08) 0px 0px 0px 0.5px`): Subtle edge definition
|
||||
- **Inset Ring** (`rgba(0,0,0,0.1) 0px 0px 0px 1px inset`): Strong inset border
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Families
|
||||
- **Display**: `Waldenburg`, fallback: `Waldenburg Fallback`
|
||||
- **Display Bold**: `WaldenburgFH`, fallback: `WaldenburgFH Fallback`
|
||||
- **Body / UI**: `Inter`, fallback: `Inter Fallback`
|
||||
- **Monospace**: `Geist Mono` or `ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | Waldenburg | 48px (3.00rem) | 300 | 1.08 (tight) | -0.96px | Whisper-thin, ethereal |
|
||||
| Section Heading | Waldenburg | 36px (2.25rem) | 300 | 1.17 (tight) | normal | Light display |
|
||||
| Card Heading | Waldenburg | 32px (2.00rem) | 300 | 1.13 (tight) | normal | Light card titles |
|
||||
| Body Large | Inter | 20px (1.25rem) | 400 | 1.35 | normal | Introductions |
|
||||
| Body | Inter | 18px (1.13rem) | 400 | 1.44–1.60 | 0.18px | Standard reading text |
|
||||
| Body Standard | Inter | 16px (1.00rem) | 400 | 1.50 | 0.16px | UI text |
|
||||
| Body Medium | Inter | 16px (1.00rem) | 500 | 1.50 | 0.16px | Emphasized body |
|
||||
| Nav / UI | Inter | 15px (0.94rem) | 500 | 1.33–1.47 | 0.15px | Navigation links |
|
||||
| Button | Inter | 15px (0.94rem) | 500 | 1.47 | normal | Button labels |
|
||||
| Button Uppercase | WaldenburgFH | 14px (0.88rem) | 700 | 1.10 (tight) | 0.7px | `text-transform: uppercase` |
|
||||
| Caption | Inter | 14px (0.88rem) | 400–500 | 1.43–1.50 | 0.14px | Metadata |
|
||||
| Small | Inter | 13px (0.81rem) | 500 | 1.38 | normal | Tags, badges |
|
||||
| Code | Geist Mono | 13px (0.81rem) | 400 | 1.85 (relaxed) | normal | Code blocks |
|
||||
| Micro | Inter | 12px (0.75rem) | 500 | 1.33 | normal | Tiny labels |
|
||||
| Tiny | Inter | 10px (0.63rem) | 400 | 1.60 (relaxed) | normal | Fine print |
|
||||
|
||||
### Principles
|
||||
- **Light as the hero weight**: Waldenburg at 300 is the defining typographic choice. Where other design systems use bold for impact, ElevenLabs uses lightness — thin strokes that feel like audio waveforms, creating intrigue through restraint.
|
||||
- **Positive letter-spacing on body**: Inter uses +0.14px to +0.18px tracking across body text, creating an airy, well-spaced reading rhythm that contrasts with the tight display tracking (-0.96px).
|
||||
- **WaldenburgFH for emphasis**: A bold (700) uppercase variant of Waldenburg appears only in specific CTA button labels with 0.7px letter-spacing — the one place where the type system gets loud.
|
||||
- **Monospace as ambient**: Geist Mono at relaxed line-height (1.85) for code blocks feels unhurried and readable.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary Black Pill**
|
||||
- Background: `#000000`
|
||||
- Text: `#ffffff`
|
||||
- Padding: 0px 14px
|
||||
- Radius: 9999px (full pill)
|
||||
- Use: Primary CTA
|
||||
|
||||
**White Pill (Shadow-bordered)**
|
||||
- Background: `#ffffff`
|
||||
- Text: `#000000`
|
||||
- Radius: 9999px
|
||||
- Shadow: `rgba(0,0,0,0.4) 0px 0px 1px, rgba(0,0,0,0.04) 0px 4px 4px`
|
||||
- Use: Secondary CTA on white
|
||||
|
||||
**Warm Stone Pill**
|
||||
- Background: `rgba(245, 242, 239, 0.8)` (warm translucent)
|
||||
- Text: `#000000`
|
||||
- Padding: 12px 20px 12px 14px (asymmetric)
|
||||
- Radius: 30px
|
||||
- Shadow: `rgba(78, 50, 23, 0.04) 0px 6px 16px` (warm-tinted)
|
||||
- Use: Featured CTA, hero action — the signature warm button
|
||||
|
||||
**Uppercase Waldenburg Button**
|
||||
- Font: WaldenburgFH 14px weight 700
|
||||
- Text-transform: uppercase
|
||||
- Letter-spacing: 0.7px
|
||||
- Use: Specific bold CTA labels
|
||||
|
||||
### Cards & Containers
|
||||
- Background: `#ffffff`
|
||||
- Border: `1px solid #e5e5e5` or shadow-as-border
|
||||
- Radius: 16px–24px
|
||||
- Shadow: multi-layer stack (inset + outline + elevation)
|
||||
- Content: product screenshots, code examples, audio waveform previews
|
||||
|
||||
### Inputs & Forms
|
||||
- Textarea: padding 12px 20px, transparent text at default
|
||||
- Select: white background, standard styling
|
||||
- Radio: standard with tw-ring focus
|
||||
- Focus: `var(--tw-ring-offset-shadow)` ring system
|
||||
|
||||
### Navigation
|
||||
- Clean white sticky header
|
||||
- Inter 15px weight 500 for nav links
|
||||
- Pill CTAs right-aligned (black primary, white secondary)
|
||||
- Mobile: hamburger collapse at 1024px
|
||||
|
||||
### Image Treatment
|
||||
- Product screenshots and audio waveform visualizations
|
||||
- Warm gradient backgrounds in feature sections
|
||||
- 20px–24px radius on image containers
|
||||
- Full-width sections alternating white and light gray
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Audio Waveform Sections**
|
||||
- Colorful gradient backgrounds showcasing voice AI capabilities
|
||||
- Warm amber, blue, and green gradients behind product demos
|
||||
- Screenshots of the ElevenLabs product interface
|
||||
|
||||
**Warm Stone CTA Block**
|
||||
- `rgba(245,242,239,0.8)` background with warm shadow
|
||||
- Asymmetric padding (more right padding)
|
||||
- Creates a physical, tactile quality unique to ElevenLabs
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 1px, 3px, 4px, 8px, 9px, 10px, 11px, 12px, 16px, 18px, 20px, 24px, 28px, 32px, 40px
|
||||
|
||||
### Grid & Container
|
||||
- Centered content with generous max-width
|
||||
- Single-column hero, expanding to feature grids
|
||||
- Full-width gradient sections for product showcases
|
||||
- White card grids on light gray backgrounds
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Apple-like generosity**: Massive vertical spacing between sections creates a premium, unhurried pace. Each section is an exhibit.
|
||||
- **Warm emptiness**: The whitespace isn't cold — the warm stone undertones and warm shadows give empty space a tactile, physical quality.
|
||||
- **Typography-led rhythm**: The light-weight Waldenburg headings create visual "whispers" that draw the eye through vast white space.
|
||||
|
||||
### Border Radius Scale
|
||||
- Minimal (2px): Small links, inline elements
|
||||
- Subtle (4px): Nav items, tab panels, tags
|
||||
- Standard (8px): Small containers
|
||||
- Comfortable (10px–12px): Medium cards, dropdowns
|
||||
- Card (16px): Standard cards, articles
|
||||
- Large (18px–20px): Featured cards, code panels
|
||||
- Section (24px): Large panels, section containers
|
||||
- Warm Button (30px): Warm stone CTA
|
||||
- Pill (9999px): Primary buttons, navigation pills
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow | Page background, text blocks |
|
||||
| Inset Edge (Level 0.5) | `rgba(0,0,0,0.075) 0px 0px 0px 0.5px inset, #fff 0px 0px 0px 0px inset` | Internal border definition |
|
||||
| Outline Ring (Level 1) | `rgba(0,0,0,0.06) 0px 0px 0px 1px` + `rgba(0,0,0,0.04) 0px 1px 2px` + `rgba(0,0,0,0.04) 0px 2px 4px` | Shadow-as-border for cards |
|
||||
| Card (Level 2) | `rgba(0,0,0,0.4) 0px 0px 1px, rgba(0,0,0,0.04) 0px 4px 4px` | Button elevation, prominent cards |
|
||||
| Warm Lift (Level 3) | `rgba(78,50,23,0.04) 0px 6px 16px` | Featured CTAs — warm-tinted |
|
||||
| Focus (Accessibility) | `var(--tw-ring-offset-shadow)` blue ring | Keyboard focus |
|
||||
|
||||
**Shadow Philosophy**: ElevenLabs uses the most refined shadow system of any design system analyzed. Every shadow is at sub-0.1 opacity, many include both outward cast AND inward inset components, and the warm CTA shadows use an actual warm color (`rgba(78,50,23,...)`) rather than neutral black. The inset half-pixel borders (`0px 0px 0px 0.5px inset`) create edges so subtle they're felt rather than seen — surfaces define themselves through the lightest possible touch.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use Waldenburg weight 300 for all display headings — the lightness IS the brand
|
||||
- Apply multi-layer shadows (inset + outline + elevation) at sub-0.1 opacity
|
||||
- Use warm stone tints (`#f5f2ef`, `rgba(245,242,239,0.8)`) for featured elements
|
||||
- Apply positive letter-spacing (+0.14px to +0.18px) on Inter body text
|
||||
- Use 9999px radius for primary buttons — pill shape is standard
|
||||
- Use warm-tinted shadows (`rgba(78,50,23,0.04)`) on featured CTAs
|
||||
- Keep the page predominantly white with subtle gray section differentiation
|
||||
- Use WaldenburgFH bold uppercase ONLY for specific CTA button labels
|
||||
|
||||
### Don't
|
||||
- Don't use bold (700) Waldenburg for headings — weight 300 is non-negotiable
|
||||
- Don't use heavy shadows (>0.1 opacity) — the ethereal quality requires whisper-level depth
|
||||
- Don't use cool gray borders — the system is warm-tinted throughout
|
||||
- Don't skip the inset shadow component — half-pixel inset borders define edges
|
||||
- Don't apply negative letter-spacing to body text — Inter uses positive tracking
|
||||
- Don't use sharp corners (<8px) on cards — the generous radius is structural
|
||||
- Don't introduce brand colors — the palette is intentionally achromatic with warm undertones
|
||||
- Don't make buttons opaque and heavy — the warm translucent stone treatment is the signature
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <1024px | Single column, hamburger nav, stacked sections |
|
||||
| Desktop | >1024px | Full layout, horizontal nav, multi-column grids |
|
||||
|
||||
### Touch Targets
|
||||
- Pill buttons with generous padding (12px–20px)
|
||||
- Navigation links at 15px with adequate spacing
|
||||
- Select dropdowns maintain comfortable sizing
|
||||
|
||||
### Collapsing Strategy
|
||||
- Navigation: horizontal → hamburger at 1024px
|
||||
- Feature grids: multi-column → stacked
|
||||
- Hero: maintains centered layout, font scales proportionally
|
||||
- Gradient sections: full-width maintained, content stacks
|
||||
- Spacing compresses proportionally
|
||||
|
||||
### Image Behavior
|
||||
- Product screenshots scale responsively
|
||||
- Gradient backgrounds simplify on mobile
|
||||
- Audio waveform previews maintain aspect ratio
|
||||
- Rounded corners maintained across breakpoints
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Background: Pure White (`#ffffff`) or Light Gray (`#f5f5f5`)
|
||||
- Text: Black (`#000000`)
|
||||
- Secondary text: Dark Gray (`#4e4e4e`)
|
||||
- Muted text: Warm Gray (`#777169`)
|
||||
- Warm surface: Warm Stone (`rgba(245, 242, 239, 0.8)`)
|
||||
- Border: `#e5e5e5` or `rgba(0,0,0,0.05)`
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero on white background. Headline at 48px Waldenburg weight 300, line-height 1.08, letter-spacing -0.96px, black text. Subtitle at 18px Inter weight 400, line-height 1.60, letter-spacing 0.18px, #4e4e4e text. Two pill buttons: black (9999px, 0px 14px padding) and warm stone (rgba(245,242,239,0.8), 30px radius, 12px 20px padding, warm shadow rgba(78,50,23,0.04) 0px 6px 16px)."
|
||||
- "Design a card: white background, 20px radius. Shadow: rgba(0,0,0,0.06) 0px 0px 0px 1px, rgba(0,0,0,0.04) 0px 1px 2px, rgba(0,0,0,0.04) 0px 2px 4px. Title at 32px Waldenburg weight 300, body at 16px Inter weight 400 letter-spacing 0.16px, #4e4e4e."
|
||||
- "Build a white pill button: white bg, 9999px radius. Shadow: rgba(0,0,0,0.4) 0px 0px 1px, rgba(0,0,0,0.04) 0px 4px 4px. Text at 15px Inter weight 500."
|
||||
- "Create an uppercase CTA label: 14px WaldenburgFH weight 700, text-transform uppercase, letter-spacing 0.7px."
|
||||
- "Design navigation: white sticky header. Inter 15px weight 500. Black pill CTA right-aligned. Border-bottom: rgba(0,0,0,0.05)."
|
||||
|
||||
### Iteration Guide
|
||||
1. Start with white — the warm undertone comes from shadows and stone surfaces, not backgrounds
|
||||
2. Waldenburg 300 for headings — never bold, the lightness is the identity
|
||||
3. Multi-layer shadows: always include inset + outline + elevation at sub-0.1 opacity
|
||||
4. Positive letter-spacing on Inter body (+0.14px to +0.18px) — the airy reading quality
|
||||
5. Warm stone CTA is the signature — `rgba(245,242,239,0.8)` with `rgba(78,50,23,0.04)` shadow
|
||||
6. Pill (9999px) for buttons, generous radius (16px–24px) for cards
|
||||
294
skills/creative/popular-web-designs/templates/expo.md
Normal file
294
skills/creative/popular-web-designs/templates/expo.md
Normal file
@@ -0,0 +1,294 @@
|
||||
# Design System: Expo
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Expo's interface is a luminous, confidence-radiating developer platform built on the premise that tools for building apps should feel as polished as the apps themselves. The entire experience lives on a bright, airy canvas — a cool-tinted off-white (`#f0f0f3`) that gives the page a subtle technological coolness without the starkness of pure white. This is a site that breathes: enormous vertical spacing between sections creates a gallery-like pace where each feature gets its own "room."
|
||||
|
||||
The design language is decisively monochromatic — pure black (`#000000`) headlines against the lightest possible backgrounds, with a spectrum of cool blue-grays (`#60646c`, `#b0b4ba`, `#555860`) handling all secondary communication. Color is almost entirely absent from the interface itself; when it appears, it's reserved for product screenshots, app icons, and the React universe illustration — making the actual content burst with life against the neutral canvas.
|
||||
|
||||
What makes Expo distinctive is its pill-shaped geometry. Buttons, tabs, video containers, and even images use generously rounded or fully pill-shaped corners (24px–9999px), creating an organic, approachable feel that contradicts the typical sharp-edged developer tool aesthetic. Combined with tight letter-spacing on massive headlines (-1.6px to -3px at 64px), the result is a design that's simultaneously premium and friendly — like an Apple product page reimagined for developers.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Luminous cool-white canvas (`#f0f0f3`) with gallery-like vertical spacing
|
||||
- Strictly monochromatic: pure black headlines, cool blue-gray body text, no decorative color
|
||||
- Pill-shaped geometry everywhere — buttons, tabs, containers, images (24px–9999px radius)
|
||||
- Massive display headlines (64px) with extreme negative letter-spacing (-1.6px to -3px)
|
||||
- Inter as the sole typeface, used at weights 400–900 for full expressive range
|
||||
- Whisper-soft shadows that barely lift elements from the surface
|
||||
- Product screenshots as the only source of color in the interface
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Expo Black** (`#000000`): The absolute anchor — used for primary headlines, CTA buttons, and the brand identity. Pure black on cool white creates maximum contrast without feeling aggressive.
|
||||
- **Near Black** (`#1c2024`): The primary text color for body content — a barely perceptible blue-black that's softer than pure #000 for extended reading.
|
||||
|
||||
### Secondary & Accent
|
||||
- **Link Cobalt** (`#0d74ce`): The standard link color — a trustworthy, saturated blue that signals interactivity without competing with the monochrome hierarchy.
|
||||
- **Legal Blue** (`#476cff`): A brighter, more saturated blue for legal/footer links — slightly more attention-grabbing than Link Cobalt.
|
||||
- **Widget Sky** (`#47c2ff`): A light, friendly cyan-blue for widget branding elements — the brightest accent in the system.
|
||||
- **Preview Purple** (`#8145b5`): A rich violet used for "preview" or beta feature indicators — creating clear visual distinction from standard content.
|
||||
|
||||
### Surface & Background
|
||||
- **Cloud Gray** (`#f0f0f3`): The primary page background — a cool off-white with the faintest blue-violet tint. Not warm, not sterile — precisely technological.
|
||||
- **Pure White** (`#ffffff`): Card surfaces, button backgrounds, and elevated content containers. Creates a clear "lifted" distinction from Cloud Gray.
|
||||
- **Widget Dark** (`#1a1a1a`): Dark surface for dark-theme widgets and overlay elements.
|
||||
- **Banner Dark** (`#171717`): The darkest surface variant, used for promotional banners and high-contrast containers.
|
||||
|
||||
### Neutrals & Text
|
||||
- **Slate Gray** (`#60646c`): The workhorse secondary text color (305 instances). A cool blue-gray that's authoritative without being heavy.
|
||||
- **Mid Slate** (`#555860`): Slightly darker than Slate, used for emphasized secondary text.
|
||||
- **Silver** (`#b0b4ba`): Tertiary text, placeholders, and de-emphasized metadata. Comfortably readable but clearly receded.
|
||||
- **Pewter** (`#999999`): Accordion icons and deeply de-emphasized UI elements in dark contexts.
|
||||
- **Light Silver** (`#cccccc`): Arrow icons and decorative elements in dark contexts.
|
||||
- **Dark Slate** (`#363a3f`): Borders on dark surfaces, switch tracks, and emphasized containment.
|
||||
- **Charcoal** (`#333333`): Dark mode switch backgrounds and deep secondary surfaces.
|
||||
|
||||
### Semantic & Accent
|
||||
- **Warning Amber** (`#ab6400`): A warm, deep amber for warning states — deliberately not bright yellow, conveying seriousness.
|
||||
- **Destructive Rose** (`#eb8e90`): A soft pink-coral for disabled destructive actions — gentler than typical red, reducing alarm fatigue.
|
||||
- **Border Lavender** (`#e0e1e6`): Standard card/container borders — a cool lavender-gray that's visible without being heavy.
|
||||
- **Input Border** (`#d9d9e0`): Button and form element borders — slightly warmer/darker than card borders for interactive elements.
|
||||
- **Dark Focus Ring** (`#2547d0`): Deep blue for keyboard focus indicators in dark theme contexts.
|
||||
|
||||
### Gradient System
|
||||
- The design is notably **gradient-free** in the interface layer. Visual richness comes from product screenshots, the React universe illustration, and careful shadow layering rather than color gradients. This absence IS the design decision — gradients would undermine the clinical precision.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Primary**: `Inter`, with fallbacks: `-apple-system, system-ui`
|
||||
- **Monospace**: `JetBrains Mono`, with fallback: `ui-monospace`
|
||||
- **System Fallback**: `system-ui, Segoe UI, Roboto, Helvetica, Arial, Apple Color Emoji, Segoe UI Emoji`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display / Hero | Inter | 64px (4rem) | 700–900 | 1.10 (tight) | -1.6px to -3px | Maximum impact, extreme tracking |
|
||||
| Section Heading | Inter | 48px (3rem) | 600 | 1.10 (tight) | -2px | Feature section anchors |
|
||||
| Sub-heading | Inter | 20px (1.25rem) | 600 | 1.20 (tight) | -0.25px | Card titles, feature names |
|
||||
| Body Large | Inter | 18px (1.13rem) | 400–500 | 1.40 | normal | Intro paragraphs, section descriptions |
|
||||
| Body / Button | Inter | 16px (1rem) | 400–700 | 1.25–1.40 | normal | Standard text, nav links, buttons |
|
||||
| Caption / Label | Inter | 14px (0.88rem) | 400–600 | 1.00–1.40 | normal | Descriptions, metadata, badge text |
|
||||
| Tag / Small | Inter | 12px (0.75rem) | 500 | 1.00–1.60 | normal | Smallest sans-serif text, badges |
|
||||
| Code Body | JetBrains Mono | 16px (1rem) | 400–600 | 1.40 | normal | Inline code, terminal commands |
|
||||
| Code Caption | JetBrains Mono | 14px (0.88rem) | 400–600 | 1.40 | normal | Code snippets, technical labels |
|
||||
| Code Small | JetBrains Mono | 12px (0.75rem) | 400 | 1.60 | normal | Uppercase tech tags |
|
||||
|
||||
### Principles
|
||||
- **One typeface, full expression**: Inter is the only sans-serif, used from weight 400 (regular) through 900 (black). This gives the design a unified voice while still achieving dramatic contrast between whisper-light body text and thundering display headlines.
|
||||
- **Extreme negative tracking at scale**: Headlines at 64px use -1.6px to -3px letter-spacing, creating ultra-dense text blocks that feel like logotypes. This aggressive compression is the signature typographic move.
|
||||
- **Weight as hierarchy**: 700–900 for display, 600 for headings, 500 for emphasis, 400 for body. The jumps are decisive — no ambiguous in-between weights.
|
||||
- **Consistent 1.40 body line-height**: Nearly all body and UI text shares 1.40 line-height, creating a rhythmic vertical consistency.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary (White on border)**
|
||||
- Background: Pure White (`#ffffff`)
|
||||
- Text: Near Black (`#1c2024`)
|
||||
- Padding: 0px 12px (compact, content-driven height)
|
||||
- Border: thin solid Input Border (`1px solid #d9d9e0`)
|
||||
- Radius: subtly rounded (6px)
|
||||
- Shadow: subtle combined shadow on hover
|
||||
- The understated default — clean, professional, unheroic
|
||||
|
||||
**Primary Pill**
|
||||
- Same as Primary but with pill-shaped radius (9999px)
|
||||
- Used for hero CTAs and high-emphasis actions
|
||||
- The extra roundness signals "start here"
|
||||
|
||||
**Dark Primary**
|
||||
- Background: Expo Black (`#000000`)
|
||||
- Text: Pure White (`#ffffff`)
|
||||
- Pill-shaped (9999px) or generously rounded (32–36px)
|
||||
- No border (black IS the border)
|
||||
- The maximum-emphasis CTA — reserved for primary conversion actions
|
||||
|
||||
### Cards & Containers
|
||||
- Background: Pure White (`#ffffff`) — clearly lifted from Cloud Gray page
|
||||
- Border: thin solid Border Lavender (`1px solid #e0e1e6`) for standard cards
|
||||
- Radius: comfortably rounded (8px) for standard cards; generously rounded (16–24px) for featured containers
|
||||
- Shadow Level 1: Whisper (`rgba(0,0,0,0.08) 0px 3px 6px, rgba(0,0,0,0.07) 0px 2px 4px`) — barely perceptible lift
|
||||
- Shadow Level 2: Standard (`rgba(0,0,0,0.1) 0px 10px 20px, rgba(0,0,0,0.05) 0px 3px 6px`) — clear floating elevation
|
||||
- Hover: likely subtle shadow deepening or background shift
|
||||
|
||||
### Inputs & Forms
|
||||
- Background: Pure White (`#ffffff`)
|
||||
- Text: Near Black (`#1c2024`)
|
||||
- Border: thin solid Input Border (`1px solid #d9d9e0`)
|
||||
- Padding: 0px 12px (inline with button sizing)
|
||||
- Radius: subtly rounded (6px)
|
||||
- Focus: blue ring shadow via CSS custom property
|
||||
|
||||
### Navigation
|
||||
- Sticky top nav on transparent/blurred background
|
||||
- Logo: Expo wordmark in black
|
||||
- Links: Near Black (`#1c2024`) or Slate Gray (`#60646c`) at 14–16px Inter weight 500
|
||||
- CTA: Black pill button ("Sign Up") on the right
|
||||
- GitHub star badge as social proof
|
||||
- Status indicator ("All Systems Operational") with green dot
|
||||
|
||||
### Image Treatment
|
||||
- Product screenshots and device mockups are the visual heroes
|
||||
- Generously rounded corners (24px) on video and image containers
|
||||
- Screenshots shown in realistic device frames
|
||||
- Dark UI screenshots provide contrast against the light canvas
|
||||
- Full-bleed within rounded containers
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Universe React Logo**
|
||||
- Animated/illustrated React logo as the visual centerpiece
|
||||
- Connects Expo's identity to the React ecosystem
|
||||
- The only illustrative element on an otherwise photographic page
|
||||
|
||||
**Device Preview Grid**
|
||||
- Multiple device types (phone, tablet, web) shown simultaneously
|
||||
- Demonstrates cross-platform capability visually
|
||||
- Each device uses realistic device chrome
|
||||
|
||||
**Status Badge**
|
||||
- "All Systems Operational" pill in the nav
|
||||
- Green dot + text — compact trust signal
|
||||
- Pill-shaped (36px radius)
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 1px, 2px, 4px, 8px, 12px, 16px, 24px, 32px, 40px, 48px, 64px, 80px, 96px, 144px
|
||||
- Button padding: 0px 12px (unusually compact — height driven by line-height)
|
||||
- Card internal padding: approximately 24–32px
|
||||
- Section vertical spacing: enormous (estimated 96–144px between major sections)
|
||||
- Component gap: 16–24px between sibling elements
|
||||
|
||||
### Grid & Container
|
||||
- Max container width: approximately 1200–1400px, centered
|
||||
- Hero: centered single-column with massive breathing room
|
||||
- Feature sections: alternating layouts (image left/right, full-width showcases)
|
||||
- Card grids: 2–3 column for feature highlights
|
||||
- Full-width sections with contained inner content
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Gallery-like pacing**: Each section feels like its own exhibit, surrounded by vast empty space. This creates a premium, unhurried browsing experience.
|
||||
- **Breathing room is the design**: The generous whitespace IS the primary design element — it communicates confidence, quality, and that each feature deserves individual attention.
|
||||
- **Content islands**: Sections float as isolated "islands" in the white space, connected by scrolling rather than visual continuation.
|
||||
|
||||
### Border Radius Scale
|
||||
- Nearly squared (4px): Small inline elements, tags
|
||||
- Subtly rounded (6px): Buttons, form inputs, combo boxes — the functional interactive radius
|
||||
- Comfortably rounded (8px): Standard content cards, containers
|
||||
- Generously rounded (16px): Feature tabs, content panels
|
||||
- Very rounded (24px): Buttons, video/image containers, tabpanels — the signature softness
|
||||
- Highly rounded (32–36px): Hero CTAs, status badges, nav buttons
|
||||
- Pill-shaped (9999px): Primary action buttons, tags, avatars — maximum friendliness
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow | Cloud Gray page background, inline text |
|
||||
| Surface (Level 1) | White bg, no shadow | Standard white cards on Cloud Gray |
|
||||
| Whisper (Level 2) | `rgba(0,0,0,0.08) 0px 3px 6px` + `rgba(0,0,0,0.07) 0px 2px 4px` | Subtle card lift, hover states |
|
||||
| Elevated (Level 3) | `rgba(0,0,0,0.1) 0px 10px 20px` + `rgba(0,0,0,0.05) 0px 3px 6px` | Feature showcases, product screenshots |
|
||||
| Modal (Level 4) | Dark overlay (`--dialog-overlay-background-color`) + heavy shadow | Dialogs, overlays |
|
||||
|
||||
**Shadow Philosophy**: Expo uses shadows as gentle whispers rather than architectural statements. The primary depth mechanism is **background color contrast** — white cards floating on Cloud Gray — rather than shadow casting. When shadows appear, they're soft, diffused, and directional (downward), creating the feeling of paper hovering millimeters above a desk.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use Cloud Gray (`#f0f0f3`) as the page background and Pure White (`#ffffff`) for elevated cards — the two-tone light system is essential
|
||||
- Keep display headlines at extreme negative letter-spacing (-1.6px to -3px at 64px) for the signature compressed look
|
||||
- Use pill-shaped (9999px) radius for primary CTA buttons — the organic shape is core to the identity
|
||||
- Reserve black (`#000000`) for headlines and primary CTAs — it carries maximum authority on the light canvas
|
||||
- Use Slate Gray (`#60646c`) for secondary text — it's the precise balance between readable and receded
|
||||
- Maintain enormous vertical spacing between sections (96px+) — the gallery pacing defines the premium feel
|
||||
- Use product screenshots as the primary visual content — the interface stays monochrome, the products bring color
|
||||
- Apply Inter at the full weight range (400–900) — weight contrast IS the hierarchy
|
||||
|
||||
### Don't
|
||||
- Don't introduce decorative colors into the interface chrome — the monochromatic palette is intentional
|
||||
- Don't use sharp corners (border-radius < 6px) on interactive elements — the pill/rounded geometry is the signature
|
||||
- Don't reduce section spacing below 64px — the breathing room is the design
|
||||
- Don't use heavy drop shadows — depth comes from background contrast and whisper-soft shadows
|
||||
- Don't mix in additional typefaces — Inter handles everything from display to caption
|
||||
- Don't use letter-spacing wider than -0.25px on body text — extreme tracking is reserved for display only
|
||||
- Don't use borders heavier than 2px — containment is subtle, achieved through background color and gentle borders
|
||||
- Don't add gradients to the interface — visual richness comes from content, not decoration
|
||||
- Don't use saturated colors outside of semantic contexts — the palette is strictly grayscale + functional blue
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <640px | Single column, hamburger nav, stacked cards, hero text scales to ~36px |
|
||||
| Tablet | 640–1024px | 2-column grids, condensed nav, medium hero text |
|
||||
| Desktop | >1024px | Full multi-column layout, expanded nav, massive hero (64px) |
|
||||
|
||||
*Only one explicit breakpoint detected (640px), suggesting a fluid, container-query or min()/clamp()-based responsive system rather than fixed breakpoint snapping.*
|
||||
|
||||
### Touch Targets
|
||||
- Buttons use generous radius (24–36px) creating large, finger-friendly surfaces
|
||||
- Navigation links spaced with adequate gap
|
||||
- Status badge sized for touch (36px radius)
|
||||
- Minimum recommended: 44x44px
|
||||
|
||||
### Collapsing Strategy
|
||||
- **Navigation**: Full horizontal nav with CTA collapses to hamburger on mobile
|
||||
- **Feature sections**: Multi-column → stacked single column
|
||||
- **Hero text**: 64px → ~36px progressive scaling
|
||||
- **Device previews**: Grid → stacked/carousel
|
||||
- **Cards**: Side-by-side → vertical stacking
|
||||
- **Spacing**: Reduces proportionally but maintains generous rhythm
|
||||
|
||||
### Image Behavior
|
||||
- Product screenshots scale proportionally
|
||||
- Device mockups may simplify or show fewer devices on mobile
|
||||
- Rounded corners maintained at all sizes
|
||||
- Lazy loading for below-fold content
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary CTA / Headlines: "Expo Black (#000000)"
|
||||
- Page Background: "Cloud Gray (#f0f0f3)"
|
||||
- Card Surface: "Pure White (#ffffff)"
|
||||
- Body Text: "Near Black (#1c2024)"
|
||||
- Secondary Text: "Slate Gray (#60646c)"
|
||||
- Borders: "Border Lavender (#e0e1e6)"
|
||||
- Links: "Link Cobalt (#0d74ce)"
|
||||
- Tertiary Text: "Silver (#b0b4ba)"
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on Cloud Gray (#f0f0f3) with a massive headline at 64px Inter weight 700, line-height 1.10, letter-spacing -3px. Text in Expo Black (#000000). Below, add a subtitle in Slate Gray (#60646c) at 18px. Place a black pill-shaped CTA button (9999px radius) beneath."
|
||||
- "Design a feature card on Pure White (#ffffff) with a 1px solid Border Lavender (#e0e1e6) border and comfortably rounded corners (8px). Title in Near Black (#1c2024) at 20px Inter weight 600, description in Slate Gray (#60646c) at 16px. Add a whisper shadow (rgba(0,0,0,0.08) 0px 3px 6px)."
|
||||
- "Build a navigation bar with Expo logo on the left, text links in Near Black (#1c2024) at 14px Inter weight 500, and a black pill CTA button on the right. Background: transparent with blur backdrop. Bottom border: 1px solid Border Lavender (#e0e1e6)."
|
||||
- "Create a code block using JetBrains Mono at 14px on a Pure White surface with Border Lavender border and 8px radius. Code in Near Black, keywords in Link Cobalt (#0d74ce)."
|
||||
- "Design a status badge pill (9999px radius) with a green dot and 'All Systems Operational' text in Inter 12px weight 500. Background: Pure White, border: 1px solid Input Border (#d9d9e0)."
|
||||
|
||||
### Iteration Guide
|
||||
1. Focus on ONE component at a time
|
||||
2. Reference specific color names and hex codes — "use Slate Gray (#60646c)" not "make it gray"
|
||||
3. Use radius values deliberately — 6px for buttons, 8px for cards, 24px for images, 9999px for pills
|
||||
4. Describe the "feel" alongside measurements — "enormous breathing room with 96px section spacing"
|
||||
5. Always specify Inter and the exact weight — weight contrast IS the hierarchy
|
||||
6. For shadows, specify "whisper shadow" or "standard elevation" from the elevation table
|
||||
7. Keep the interface monochrome — let product content be the color
|
||||
233
skills/creative/popular-web-designs/templates/figma.md
Normal file
233
skills/creative/popular-web-designs/templates/figma.md
Normal file
@@ -0,0 +1,233 @@
|
||||
# Design System: Figma
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Figma's interface is the design tool that designed itself — a masterclass in typographic sophistication where a custom variable font (figmaSans) modulates between razor-thin (weight 320) and bold (weight 700) with stops at unusual intermediates (330, 340, 450, 480, 540) that most type systems never explore. This granular weight control gives every text element a precisely calibrated visual weight, creating hierarchy through micro-differences rather than the blunt instrument of "regular vs bold."
|
||||
|
||||
The page presents a fascinating duality: the interface chrome is strictly black-and-white (literally only `#000000` and `#ffffff` detected as colors), while the hero section and product showcases explode with vibrant multi-color gradients — electric greens, bright yellows, deep purples, hot pinks. This separation means the design system itself is colorless, treating the product's colorful output as the hero content. Figma's marketing page is essentially a white gallery wall displaying colorful art.
|
||||
|
||||
What makes Figma distinctive beyond the variable font is its circle-and-pill geometry. Buttons use 50px radius (pill) or 50% (perfect circle for icon buttons), creating an organic, tool-palette-like feel. The dashed-outline focus indicator (`dashed 2px`) is a deliberate design choice that echoes selection handles in the Figma editor itself — the website's UI language references the product's UI language.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Custom variable font (figmaSans) with unusual weight stops: 320, 330, 340, 450, 480, 540, 700
|
||||
- Strictly black-and-white interface chrome — color exists only in product content
|
||||
- figmaMono for uppercase technical labels with wide letter-spacing
|
||||
- Pill (50px) and circular (50%) button geometry
|
||||
- Dashed focus outlines echoing Figma's editor selection handles
|
||||
- Vibrant multi-color hero gradients (green, yellow, purple, pink)
|
||||
- OpenType `"kern"` feature enabled globally
|
||||
- Negative letter-spacing throughout — even body text at -0.14px to -0.26px
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Pure Black** (`#000000`): All text, all solid buttons, all borders. The sole "color" of the interface.
|
||||
- **Pure White** (`#ffffff`): All backgrounds, white buttons, text on dark surfaces. The other half of the binary.
|
||||
|
||||
*Note: Figma's marketing site uses ONLY these two colors for its interface layer. All vibrant colors appear exclusively in product screenshots, hero gradients, and embedded content.*
|
||||
|
||||
### Surface & Background
|
||||
- **Pure White** (`#ffffff`): Primary page background and card surfaces.
|
||||
- **Glass Black** (`rgba(0, 0, 0, 0.08)`): Subtle dark overlay for secondary circular buttons and glass effects.
|
||||
- **Glass White** (`rgba(255, 255, 255, 0.16)`): Frosted glass overlay for buttons on dark/colored surfaces.
|
||||
|
||||
### Gradient System
|
||||
- **Hero Gradient**: A vibrant multi-stop gradient using electric green, bright yellow, deep purple, and hot pink. This gradient is the visual signature of the hero section — it represents the creative possibilities of the tool.
|
||||
- **Product Section Gradients**: Individual product areas (Design, Dev Mode, Prototyping) may use distinct color themes in their showcases.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Primary**: `figmaSans`, with fallbacks: `figmaSans Fallback, SF Pro Display, system-ui, helvetica`
|
||||
- **Monospace / Labels**: `figmaMono`, with fallbacks: `figmaMono Fallback, SF Mono, menlo`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display / Hero | figmaSans | 86px (5.38rem) | 400 | 1.00 (tight) | -1.72px | Maximum impact, extreme tracking |
|
||||
| Section Heading | figmaSans | 64px (4rem) | 400 | 1.10 (tight) | -0.96px | Feature section titles |
|
||||
| Sub-heading | figmaSans | 26px (1.63rem) | 540 | 1.35 | -0.26px | Emphasized section text |
|
||||
| Sub-heading Light | figmaSans | 26px (1.63rem) | 340 | 1.35 | -0.26px | Light-weight section text |
|
||||
| Feature Title | figmaSans | 24px (1.5rem) | 700 | 1.45 | normal | Bold card headings |
|
||||
| Body Large | figmaSans | 20px (1.25rem) | 330–450 | 1.30–1.40 | -0.1px to -0.14px | Descriptions, intros |
|
||||
| Body / Button | figmaSans | 16px (1rem) | 330–400 | 1.40–1.45 | -0.14px to normal | Standard body, nav, buttons |
|
||||
| Body Light | figmaSans | 18px (1.13rem) | 320 | 1.45 | -0.26px to normal | Light-weight body text |
|
||||
| Mono Label | figmaMono | 18px (1.13rem) | 400 | 1.30 (tight) | 0.54px | Uppercase section labels |
|
||||
| Mono Small | figmaMono | 12px (0.75rem) | 400 | 1.00 (tight) | 0.6px | Uppercase tiny tags |
|
||||
|
||||
### Principles
|
||||
- **Variable font precision**: figmaSans uses weights that most systems never touch — 320, 330, 340, 450, 480, 540. This creates hierarchy through subtle weight differences rather than dramatic jumps. The difference between 330 and 340 is nearly imperceptible but structurally significant.
|
||||
- **Light as the base**: Most body text uses 320–340 (lighter than typical 400 "regular"), creating an ethereal, airy reading experience that matches the design-tool aesthetic.
|
||||
- **Kern everywhere**: Every text element enables OpenType `"kern"` feature — kerning is not optional, it's structural.
|
||||
- **Negative tracking by default**: Even body text uses -0.1px to -0.26px letter-spacing, creating universally tight text. Display text compresses further to -0.96px and -1.72px.
|
||||
- **Mono for structure**: figmaMono in uppercase with positive letter-spacing (0.54px–0.6px) creates technical signpost labels.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Black Solid (Pill)**
|
||||
- Background: Pure Black (`#000000`)
|
||||
- Text: Pure White (`#ffffff`)
|
||||
- Radius: circle (50%) for icon buttons
|
||||
- Focus: dashed 2px outline
|
||||
- Maximum emphasis
|
||||
|
||||
**White Pill**
|
||||
- Background: Pure White (`#ffffff`)
|
||||
- Text: Pure Black (`#000000`)
|
||||
- Padding: 8px 18px 10px (asymmetric vertical)
|
||||
- Radius: pill (50px)
|
||||
- Focus: dashed 2px outline
|
||||
- Standard CTA on dark/colored surfaces
|
||||
|
||||
**Glass Dark**
|
||||
- Background: `rgba(0, 0, 0, 0.08)` (subtle dark overlay)
|
||||
- Text: Pure Black
|
||||
- Radius: circle (50%)
|
||||
- Focus: dashed 2px outline
|
||||
- Secondary action on light surfaces
|
||||
|
||||
**Glass Light**
|
||||
- Background: `rgba(255, 255, 255, 0.16)` (frosted glass)
|
||||
- Text: Pure White
|
||||
- Radius: circle (50%)
|
||||
- Focus: dashed 2px outline
|
||||
- Secondary action on dark/colored surfaces
|
||||
|
||||
### Cards & Containers
|
||||
- Background: Pure White
|
||||
- Border: none or minimal
|
||||
- Radius: 6px (small containers), 8px (images, cards, dialogs)
|
||||
- Shadow: subtle to medium elevation effects
|
||||
- Product screenshots as card content
|
||||
|
||||
### Navigation
|
||||
- Clean horizontal nav on white
|
||||
- Logo: Figma wordmark in black
|
||||
- Product tabs: pill-shaped (50px) tab navigation
|
||||
- Links: black text, underline 1px decoration
|
||||
- CTA: Black pill button
|
||||
- Hover: text color via CSS variable
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Product Tab Bar**
|
||||
- Horizontal pill-shaped tabs (50px radius)
|
||||
- Each tab represents a Figma product area (Design, Dev Mode, Prototyping, etc.)
|
||||
- Active tab highlighted
|
||||
|
||||
**Hero Gradient Section**
|
||||
- Full-width vibrant multi-color gradient background
|
||||
- White text overlay with 86px display heading
|
||||
- Product screenshots floating within the gradient
|
||||
|
||||
**Dashed Focus Indicators**
|
||||
- All interactive elements use `dashed 2px` outline on focus
|
||||
- References the selection handles in the Figma editor
|
||||
- A meta-design choice connecting website and product
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 1px, 2px, 4px, 4.5px, 8px, 10px, 12px, 16px, 18px, 24px, 32px, 40px, 46px, 48px, 50px
|
||||
|
||||
### Grid & Container
|
||||
- Max container width: up to 1920px
|
||||
- Hero: full-width gradient with centered content
|
||||
- Product sections: alternating showcases
|
||||
- Footer: dark full-width section
|
||||
- Responsive from 559px to 1920px
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Gallery-like pacing**: Generous spacing lets each product section breathe as its own exhibit.
|
||||
- **Color sections as visual breathing**: The gradient hero and product showcases provide chromatic relief between the monochrome interface sections.
|
||||
|
||||
### Border Radius Scale
|
||||
- Minimal (2px): Small link elements
|
||||
- Subtle (6px): Small containers, dividers
|
||||
- Comfortable (8px): Cards, images, dialogs
|
||||
- Pill (50px): Tab buttons, CTAs
|
||||
- Circle (50%): Icon buttons, circular elements
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow | Page background, most text |
|
||||
| Surface (Level 1) | White card on gradient/dark section | Cards, product showcases |
|
||||
| Elevated (Level 2) | Subtle shadow | Floating cards, hover states |
|
||||
|
||||
**Shadow Philosophy**: Figma uses shadows sparingly. The primary depth mechanisms are **background contrast** (white content on colorful/dark sections) and the inherent dimensionality of the product screenshots themselves.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use figmaSans with precise variable weights (320–540) — the granular weight control IS the design
|
||||
- Keep the interface strictly black-and-white — color comes from product content only
|
||||
- Use pill (50px) and circular (50%) geometry for all interactive elements
|
||||
- Apply dashed 2px focus outlines — the signature accessibility pattern
|
||||
- Enable `"kern"` feature on all text
|
||||
- Use figmaMono in uppercase with positive letter-spacing for labels
|
||||
- Apply negative letter-spacing throughout (-0.1px to -1.72px)
|
||||
|
||||
### Don't
|
||||
- Don't add interface colors — the monochrome palette is absolute
|
||||
- Don't use standard font weights (400, 500, 600, 700) — use the variable font's unique stops (320, 330, 340, 450, 480, 540)
|
||||
- Don't use sharp corners on buttons — pill and circular geometry only
|
||||
- Don't use solid focus outlines — dashed is the signature
|
||||
- Don't increase body font weight above 450 — the light-weight aesthetic is core
|
||||
- Don't use positive letter-spacing on body text — it's always negative
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Small Mobile | <560px | Compact layout, stacked |
|
||||
| Tablet | 560–768px | Minor adjustments |
|
||||
| Small Desktop | 768–960px | 2-column layouts |
|
||||
| Desktop | 960–1280px | Standard layout |
|
||||
| Large Desktop | 1280–1440px | Expanded |
|
||||
| Ultra-wide | 1440–1920px | Maximum width |
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero text: 86px → 64px → 48px
|
||||
- Product tabs: horizontal scroll on mobile
|
||||
- Feature sections: stacked single column
|
||||
- Footer: multi-column → stacked
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Everything: "Pure Black (#000000)" and "Pure White (#ffffff)"
|
||||
- Glass Dark: "rgba(0, 0, 0, 0.08)"
|
||||
- Glass Light: "rgba(255, 255, 255, 0.16)"
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero on a vibrant multi-color gradient (green, yellow, purple, pink). Headline at 86px figmaSans weight 400, line-height 1.0, letter-spacing -1.72px. White text. White pill CTA button (50px radius, 8px 18px padding)."
|
||||
- "Design a product tab bar with pill-shaped buttons (50px radius). Active: Black bg, white text. Inactive: transparent, black text. figmaSans at 20px weight 480."
|
||||
- "Build a section label: figmaMono 18px, uppercase, letter-spacing 0.54px, black text. Kern enabled."
|
||||
- "Create body text at 20px figmaSans weight 330, line-height 1.40, letter-spacing -0.14px. Pure Black on white."
|
||||
|
||||
### Iteration Guide
|
||||
1. Use variable font weight stops precisely: 320, 330, 340, 450, 480, 540, 700
|
||||
2. Interface is always black + white — never add colors to chrome
|
||||
3. Dashed focus outlines, not solid
|
||||
4. Letter-spacing is always negative on body, always positive on mono labels
|
||||
5. Pill (50px) for buttons/tabs, circle (50%) for icon buttons
|
||||
259
skills/creative/popular-web-designs/templates/framer.md
Normal file
259
skills/creative/popular-web-designs/templates/framer.md
Normal file
@@ -0,0 +1,259 @@
|
||||
# Design System: Framer
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `Azeret Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'Azeret Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Azeret+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Framer's website is a cinematic, tool-obsessed dark canvas that radiates the confidence of a design tool built by designers who worship craft. The entire experience is drenched in pure black — not a warm charcoal or a cozy dark gray, but an absolute void (`#000000`) that makes every element, every screenshot, every typographic flourish feel like it's floating in deep space. This is a website that treats its own product UI as the hero art, embedding full-fidelity screenshots and interactive demos directly into the narrative flow.
|
||||
|
||||
The typography is the signature move: GT Walsheim with aggressively tight letter-spacing (as extreme as -5.5px on 110px display text) creates headlines that feel compressed, kinetic, almost spring-loaded — like words under pressure that might expand at any moment. The transition to Inter for body text is seamless, with extensive OpenType feature usage (`cv01`, `cv05`, `cv09`, `cv11`, `ss03`, `ss07`) that gives even small text a refined, custom feel. Framer Blue (`#0099ff`) is deployed sparingly but decisively — as link color, border accents, and subtle ring shadows — creating a cold, electric throughline against the warm-less black.
|
||||
|
||||
The overall effect is a nightclub for web designers: dark, precise, seductive, and unapologetically product-forward. Every section exists to showcase what the tool can do, with the website itself serving as proof of concept.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Pure black (`#000000`) void canvas — absolute dark, not warm or gray-tinted
|
||||
- GT Walsheim display font with extreme negative letter-spacing (-5.5px at 110px)
|
||||
- Framer Blue (`#0099ff`) as the sole accent color — cold, electric, precise
|
||||
- Pill-shaped buttons (40px–100px radius) — no sharp corners on interactive elements
|
||||
- Product screenshots as hero art — the tool IS the marketing
|
||||
- Frosted glass button variants using `rgba(255, 255, 255, 0.1)` on dark surfaces
|
||||
- Extensive OpenType feature usage across Inter for refined micro-typography
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Pure Black** (`#000000`): Primary background, the void canvas that defines Framer's dark-first identity
|
||||
- **Pure White** (`#ffffff`): Primary text color on dark surfaces, button text on accent backgrounds
|
||||
- **Framer Blue** (`#0099ff`): Primary accent color — links, borders, ring shadows, interactive highlights
|
||||
|
||||
### Secondary & Accent
|
||||
- **Muted Silver** (`#a6a6a6`): Secondary text, subdued labels, dimmed descriptions on dark surfaces
|
||||
- **Near Black** (`#090909`): Elevated dark surface, shadow ring color for subtle depth separation
|
||||
|
||||
### Surface & Background
|
||||
- **Void Black** (`#000000`): Page background, primary canvas
|
||||
- **Frosted White** (`rgba(255, 255, 255, 0.1)`): Translucent button backgrounds, glass-effect surfaces on dark
|
||||
- **Subtle White** (`rgba(255, 255, 255, 0.5)`): Slightly more opaque frosted elements for hover states
|
||||
|
||||
### Neutrals & Text
|
||||
- **Pure White** (`#ffffff`): Heading text, high-emphasis body text
|
||||
- **Muted Silver** (`#a6a6a6`): Body text, descriptions, secondary information
|
||||
- **Ghost White** (`rgba(255, 255, 255, 0.6)`): Tertiary text, placeholders on dark surfaces
|
||||
|
||||
### Semantic & Accent
|
||||
- **Framer Blue** (`#0099ff`): Links, interactive borders, focus rings
|
||||
- **Blue Glow** (`rgba(0, 153, 255, 0.15)`): Focus ring shadow, subtle blue halo around interactive elements
|
||||
- **Default Link Blue** (`#0000ee`): Standard browser link color (used sparingly in content areas)
|
||||
|
||||
### Gradient System
|
||||
- No prominent gradient usage — Framer relies on pure flat black surfaces with occasional blue-tinted glows for depth
|
||||
- Subtle radial glow effects behind product screenshots using Framer Blue at very low opacity
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Display**: `GT Walsheim Framer Medium` / `GT Walsheim Medium` — custom geometric sans-serif, weight 500. Fallbacks: `GT Walsheim Framer Medium Placeholder`, system sans-serif
|
||||
- **Body/UI**: `Inter Variable` / `Inter` — variable sans-serif with extensive OpenType features. Fallbacks: `Inter Placeholder`, `-apple-system`, `system-ui`
|
||||
- **Accent**: `Mona Sans` — GitHub's open-source font, used for select elements at ultra-light weight (100)
|
||||
- **Monospace**: `Azeret Mono` — companion mono for code and technical labels
|
||||
- **Rounded**: `Open Runde` — small rounded companion font for micro-labels
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | GT Walsheim Framer Medium | 110px | 500 | 0.85 | -5.5px | Extreme negative tracking, compressed impact |
|
||||
| Section Display | GT Walsheim Medium | 85px | 500 | 0.95 | -4.25px | OpenType: ss02, tnum |
|
||||
| Section Heading | GT Walsheim Medium | 62px | 500 | 1.00 | -3.1px | OpenType: ss02 |
|
||||
| Feature Heading | GT Walsheim Medium | 32px | 500 | 1.13 | -1px | Tightest of the smaller headings |
|
||||
| Accent Display | Mona Sans | 61.5px | 100 | 1.00 | -3.1px | Ultra-light weight, ethereal |
|
||||
| Card Title | Inter Variable | 24px | 400 | 1.30 | -0.01px | OpenType: cv01, cv05, cv09, cv11, ss03, ss07 |
|
||||
| Feature Title | Inter | 22px | 700 | 1.20 | -0.8px | OpenType: cv05 |
|
||||
| Sub-heading | Inter | 20px | 600 | 1.20 | -0.8px | OpenType: cv01, cv09 |
|
||||
| Body Large | Inter Variable | 18px | 400 | 1.30 | -0.01px | OpenType: cv01, cv05, cv09, cv11, ss03, ss07 |
|
||||
| Body | Inter Variable | 15px | 400 | 1.30 | -0.01px | OpenType: cv11 |
|
||||
| Nav/UI | Inter Variable | 15px | 400 | 1.00 | -0.15px | OpenType: cv06, cv11, dlig, ss03 |
|
||||
| Body Readable | Inter Framer Regular | 14px | 400 | 1.60 | normal | Long-form body text |
|
||||
| Caption | Inter Variable | 14px | 400 | 1.40 | normal | OpenType: cv01, cv06, cv09, cv11, ss03, ss07 |
|
||||
| Label | Inter | 13px | 500 | 1.60 | normal | OpenType: cv06, cv11, ss03 |
|
||||
| Small Caption | Inter Variable | 12px | 400 | 1.40 | normal | OpenType: cv01, cv06, cv09, cv11, ss03, ss07 |
|
||||
| Micro Code | Azeret Mono | 10.4px | 400 | 1.60 | normal | OpenType: cv06, cv11, ss03 |
|
||||
| Badge | Open Runde | 9px | 600 | 1.11 | normal | OpenType: cv01, cv09 |
|
||||
| Micro Uppercase | Inter Variable | 7px | 400 | 1.00 | 0.21px | uppercase transform |
|
||||
|
||||
### Principles
|
||||
- **Compression as personality**: GT Walsheim's extreme negative letter-spacing (-5.5px at 110px) is the defining typographic gesture — headlines feel spring-loaded, urgent, almost breathless
|
||||
- **OpenType maximalism**: Inter is deployed with 6+ OpenType features simultaneously (`cv01`, `cv05`, `cv09`, `cv11`, `ss03`, `ss07`), creating a subtly custom feel even at body sizes
|
||||
- **Weight restraint on display**: All GT Walsheim usage is weight 500 (medium) — never bold, never regular. This creates a confident-but-not-aggressive display tone
|
||||
- **Ultra-tight line heights**: Display text at 0.85 line-height means letters nearly overlap vertically — intentional density that rewards reading at arm's length
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
- **Frosted Pill**: `rgba(255, 255, 255, 0.1)` background, black text (`#000000`), pill shape (40px radius). The glass-effect button that lives on dark surfaces — translucent, ambient, subtle
|
||||
- **Solid White Pill**: `rgb(255, 255, 255)` background, black text (`#000000`), full pill shape (100px radius), padding `10px 15px`. The primary CTA — clean, high-contrast on dark, unmissable
|
||||
- **Ghost**: No visible background, white text, relies on text styling alone. Hover reveals subtle frosted background
|
||||
- **Transition**: Scale-based animations (matrix transform with 0.85 scale factor), opacity transitions for reveal effects
|
||||
|
||||
### Cards & Containers
|
||||
- **Dark Surface Card**: Black or near-black (`#090909`) background, `rgba(0, 153, 255, 0.15) 0px 0px 0px 1px` blue ring shadow border, rounded corners (10px–15px radius)
|
||||
- **Elevated Card**: Multi-layer shadow — `rgba(255, 255, 255, 0.1) 0px 0.5px 0px 0.5px` (subtle top highlight) + `rgba(0, 0, 0, 0.25) 0px 10px 30px` (deep ambient shadow)
|
||||
- **Product Screenshots**: Full-width or padded within dark containers, 8px–12px border-radius for software UI previews
|
||||
- **Hover**: Subtle glow increase on Framer Blue ring shadow, or brightness shift on frosted surfaces
|
||||
|
||||
### Inputs & Forms
|
||||
- Minimal form presence on the marketing site
|
||||
- Input fields follow dark theme: dark background, subtle border, white text
|
||||
- Focus state: Framer Blue (`#0099ff`) ring border, `1px solid #0099ff`
|
||||
- Placeholder text in `rgba(255, 255, 255, 0.4)`
|
||||
|
||||
### Navigation
|
||||
- **Dark floating nav bar**: Black background with frosted glass effect, white text links
|
||||
- **Nav links**: Inter at 15px, weight 400, white text with subtle hover opacity change
|
||||
- **CTA button**: Pill-shaped, white or frosted, positioned at right end of nav
|
||||
- **Mobile**: Collapses to hamburger menu, maintains dark theme
|
||||
- **Sticky behavior**: Nav remains fixed at top on scroll
|
||||
|
||||
### Image Treatment
|
||||
- **Product screenshots as hero art**: Full-width embedded UI screenshots with rounded corners (8px–12px)
|
||||
- **Dark-on-dark composition**: Screenshots placed on black backgrounds with subtle shadow for depth separation
|
||||
- **16:9 and custom aspect ratios**: Product demos fill their containers
|
||||
- **No decorative imagery**: All images are functional — showing the tool, the output, or the workflow
|
||||
|
||||
### Trust & Social Proof
|
||||
- Customer logos and testimonials in muted gray on dark surfaces
|
||||
- Minimal ornamentation — the product screenshots serve as the trust signal
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- **Base unit**: 8px
|
||||
- **Scale**: 1px, 2px, 3px, 4px, 5px, 6px, 8px, 10px, 12px, 15px, 20px, 30px, 35px
|
||||
- **Section padding**: Large vertical spacing (80px–120px between sections)
|
||||
- **Card padding**: 15px–30px internal padding
|
||||
- **Component gaps**: 8px–20px between related elements
|
||||
|
||||
### Grid & Container
|
||||
- **Max width**: ~1200px container, centered
|
||||
- **Column patterns**: Full-width hero, 2-column feature sections, single-column product showcases
|
||||
- **Asymmetric layouts**: Feature sections often pair text (40%) with screenshot (60%)
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Breathe through darkness**: Generous vertical spacing between sections — the black background means whitespace manifests as void, creating dramatic pauses between content blocks
|
||||
- **Dense within, spacious between**: Individual components are tightly composed (tight line-heights, compressed text) but float in generous surrounding space
|
||||
- **Product-first density**: Screenshot areas are allowed to be dense and information-rich, contrasting with the sparse marketing text
|
||||
|
||||
### Border Radius Scale
|
||||
- **1px**: Micro-elements, nearly squared precision edges
|
||||
- **5px–7px**: Small UI elements, image thumbnails — subtly softened
|
||||
- **8px**: Standard component radius — code blocks, buttons, interactive elements
|
||||
- **10px–12px**: Cards, product screenshots — comfortably rounded
|
||||
- **15px–20px**: Large containers, feature cards — generously rounded
|
||||
- **30px–40px**: Navigation pills, pagination — noticeably rounded
|
||||
- **100px**: Full pill shape — primary CTAs, tag elements
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Level 0 (Flat) | No shadow, pure black surface | Page background, empty areas |
|
||||
| Level 1 (Ring) | `rgba(0, 153, 255, 0.15) 0px 0px 0px 1px` | Card borders, interactive element outlines — Framer Blue glow ring |
|
||||
| Level 2 (Contained) | `rgb(9, 9, 9) 0px 0px 0px 2px` | Near-black ring for subtle containment on dark surfaces |
|
||||
| Level 3 (Floating) | `rgba(255, 255, 255, 0.1) 0px 0.5px 0px 0.5px, rgba(0, 0, 0, 0.25) 0px 10px 30px` | Elevated cards, floating elements — subtle white top-edge highlight + deep ambient shadow |
|
||||
|
||||
### Shadow Philosophy
|
||||
Framer's elevation system is inverted from traditional light-theme designs. Instead of darker shadows on light backgrounds, Framer uses:
|
||||
- **Blue-tinted ring shadows** at very low opacity (0.15) for containment — a signature move that subtly brands every bordered element
|
||||
- **White edge highlights** (0.5px) on the top edge of elevated elements — simulating light hitting the top surface
|
||||
- **Deep ambient shadows** for true floating elements — `rgba(0, 0, 0, 0.25)` at large spread (30px)
|
||||
|
||||
### Decorative Depth
|
||||
- **Blue glow auras**: Subtle Framer Blue (`#0099ff`) radial gradients behind key interactive areas
|
||||
- **No background blur/glassmorphism**: Despite the frosted button effect, there's no heavy glass blur usage — the translucency is achieved through simple rgba opacity
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use pure black (`#000000`) as the primary background — not dark gray, not charcoal
|
||||
- Apply extreme negative letter-spacing on GT Walsheim display text (-3px to -5.5px)
|
||||
- Keep all buttons pill-shaped (40px+ radius) — never use squared or slightly-rounded buttons
|
||||
- Use Framer Blue (`#0099ff`) exclusively for interactive accents — links, borders, focus states
|
||||
- Deploy `rgba(255, 255, 255, 0.1)` for frosted glass surfaces on dark backgrounds
|
||||
- Maintain GT Walsheim at weight 500 only — the medium weight IS the brand
|
||||
- Use extensive OpenType features on Inter text (cv01, cv05, cv09, cv11, ss03, ss07)
|
||||
- Let product screenshots be the visual centerpiece — the tool markets itself
|
||||
- Apply blue ring shadows (`rgba(0, 153, 255, 0.15) 0px 0px 0px 1px`) for card containment
|
||||
|
||||
### Don't
|
||||
- Use warm dark backgrounds (no `#1a1a1a`, `#2d2d2d`, or brownish blacks)
|
||||
- Apply bold (700+) weight to GT Walsheim display text — medium 500 only
|
||||
- Introduce additional accent colors beyond Framer Blue — this is a one-accent-color system
|
||||
- Use large border-radius on non-interactive elements (cards use 10px–15px, only buttons get 40px+)
|
||||
- Add decorative imagery, illustrations, or icons — the product IS the illustration
|
||||
- Use positive letter-spacing on headlines — everything is compressed, negative tracking
|
||||
- Create heavy drop shadows — depth is communicated through subtle rings and minimal ambients
|
||||
- Place light/white backgrounds behind content sections — the void is sacred
|
||||
- Use serif or display-weight fonts — the system is geometric sans-serif only
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <809px | Single column, stacked feature sections, reduced hero text (62px→40px), hamburger nav |
|
||||
| Tablet | 809px–1199px | 2-column features begin, nav links partially visible, screenshots scale down |
|
||||
| Desktop | >1199px | Full layout, expanded nav with all links + CTA, 110px display hero, side-by-side features |
|
||||
|
||||
### Touch Targets
|
||||
- Pill buttons: minimum 40px height with 10px vertical padding — exceeds 44px WCAG minimum
|
||||
- Nav links: 15px text with generous padding for touch accessibility
|
||||
- Mobile CTA buttons: Full-width pills on mobile for easy thumb reach
|
||||
|
||||
### Collapsing Strategy
|
||||
- **Navigation**: Full horizontal nav → hamburger menu at mobile breakpoint
|
||||
- **Hero text**: 110px display → 85px → 62px → ~40px across breakpoints, maintaining extreme negative tracking proportionally
|
||||
- **Feature sections**: Side-by-side (text + screenshot) → stacked vertically on mobile
|
||||
- **Product screenshots**: Scale responsively within containers, maintaining aspect ratios
|
||||
- **Section spacing**: Reduces proportionally — 120px desktop → 60px mobile
|
||||
|
||||
### Image Behavior
|
||||
- Product screenshots are responsive, scaling within their container boundaries
|
||||
- No art direction changes — same crops across breakpoints
|
||||
- Dark background ensures screenshots maintain visual impact at any size
|
||||
- Screenshots lazy-load as user scrolls into view
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary Background: Void Black (`#000000`)
|
||||
- Primary Text: Pure White (`#ffffff`)
|
||||
- Accent/CTA: Framer Blue (`#0099ff`)
|
||||
- Secondary Text: Muted Silver (`#a6a6a6`)
|
||||
- Frosted Surface: Translucent White (`rgba(255, 255, 255, 0.1)`)
|
||||
- Elevation Ring: Blue Glow (`rgba(0, 153, 255, 0.15)`)
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on pure black background with 110px GT Walsheim heading in white, letter-spacing -5.5px, line-height 0.85, and a pill-shaped white CTA button (100px radius) with black text"
|
||||
- "Design a feature card on black background with a 1px Framer Blue ring shadow border (rgba(0,153,255,0.15)), 12px border-radius, white heading in Inter at 22px weight 700, and muted silver (a6a6a6) body text"
|
||||
- "Build a navigation bar with black background, white Inter text links at 15px, and a frosted pill button (rgba(255,255,255,0.1) background, 40px radius) as the CTA"
|
||||
- "Create a product showcase section with a full-width screenshot embedded on black, 10px border-radius, subtle multi-layer shadow (white 0.5px top highlight + rgba(0,0,0,0.25) 30px ambient)"
|
||||
- "Design a pricing card using pure black surface, Framer Blue (#0099ff) accent for the selected plan border, white text hierarchy (24px Inter bold heading, 14px regular body), and a solid white pill CTA button"
|
||||
|
||||
### Iteration Guide
|
||||
When refining existing screens generated with this design system:
|
||||
1. Focus on ONE component at a time — the dark canvas makes each element precious
|
||||
2. Always verify letter-spacing on GT Walsheim headings — the extreme negative tracking is non-negotiable
|
||||
3. Check that Framer Blue appears ONLY on interactive elements — never as decorative background or text color for non-links
|
||||
4. Ensure all buttons are pill-shaped — any squared corner immediately breaks the Framer aesthetic
|
||||
5. Test frosted glass surfaces by checking they have exactly `rgba(255, 255, 255, 0.1)` — too opaque looks like a bug, too transparent disappears
|
||||
291
skills/creative/popular-web-designs/templates/hashicorp.md
Normal file
291
skills/creative/popular-web-designs/templates/hashicorp.md
Normal file
@@ -0,0 +1,291 @@
|
||||
# Design System: HashiCorp
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
HashiCorp's website is enterprise infrastructure made tangible — a design system that must communicate the complexity of cloud infrastructure management while remaining approachable. The visual language splits between two modes: a clean white light-mode for informational sections and a dramatic dark-mode (`#15181e`, `#0d0e12`) for hero areas and product showcases, creating a day/night duality that mirrors the "build in light, deploy in dark" developer workflow.
|
||||
|
||||
The typography is anchored by a custom brand font (HashiCorp Sans, loaded as `__hashicorpSans_96f0ca`) that carries substantial weight — literally. Headings use 600–700 weights with tight line-heights (1.17–1.19), creating dense, authoritative text blocks that communicate enterprise confidence. The hero headline at 82px weight 600 with OpenType `"kern"` enabled is not decorative — it's infrastructure-grade typography.
|
||||
|
||||
What distinguishes HashiCorp is its multi-product color system. Each product in the portfolio has its own brand color — Terraform purple (`#7b42bc`), Vault yellow (`#ffcf25`), Waypoint teal (`#14c6cb`), Vagrant blue (`#1868f2`) — and these colors appear throughout as accent tokens via a CSS custom property system (`--mds-color-*`). This creates a design system within a design system: the parent brand is black-and-white with blue accents, while each child product injects its own chromatic identity.
|
||||
|
||||
The component system uses the `mds` (Markdown Design System) prefix, indicating a systematic, token-driven approach where colors, spacing, and states are all managed through CSS variables. Shadows are remarkably subtle — dual-layer micro-shadows using `rgba(97, 104, 117, 0.05)` that are nearly invisible but provide just enough depth to separate interactive surfaces from the background.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Dual-mode: clean white sections + dramatic dark (`#15181e`) hero/product areas
|
||||
- Custom HashiCorp Sans font with 600–700 weights and `"kern"` feature
|
||||
- Multi-product color system via `--mds-color-*` CSS custom properties
|
||||
- Product brand colors: Terraform purple, Vault yellow, Waypoint teal, Vagrant blue
|
||||
- Uppercase letter-spaced captions (13px, weight 600, 1.3px letter-spacing)
|
||||
- Micro-shadows: dual-layer at 0.05 opacity — depth through whisper, not shout
|
||||
- Token-driven `mds` component system with semantic variable names
|
||||
- Tight border radius: 2px–8px, nothing pill-shaped or circular
|
||||
- System-ui fallback stack for secondary text
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Brand Primary
|
||||
- **Black** (`#000000`): Primary brand color, text on light surfaces, `--mds-color-hcp-brand`
|
||||
- **Dark Charcoal** (`#15181e`): Dark mode backgrounds, hero sections
|
||||
- **Near Black** (`#0d0e12`): Deepest dark mode surface, form inputs on dark
|
||||
|
||||
### Neutral Scale
|
||||
- **Light Gray** (`#f1f2f3`): Light backgrounds, subtle surfaces
|
||||
- **Mid Gray** (`#d5d7db`): Borders, button text on dark
|
||||
- **Cool Gray** (`#b2b6bd`): Border accents (at 0.1–0.4 opacity)
|
||||
- **Dark Gray** (`#656a76`): Helper text, secondary labels, `--mds-form-helper-text-color`
|
||||
- **Charcoal** (`#3b3d45`): Secondary text on light, button borders
|
||||
- **Near White** (`#efeff1`): Primary text on dark surfaces
|
||||
|
||||
### Product Brand Colors
|
||||
- **Terraform Purple** (`#7b42bc`): `--mds-color-terraform-button-background`
|
||||
- **Vault Yellow** (`#ffcf25`): `--mds-color-vault-button-background`
|
||||
- **Waypoint Teal** (`#14c6cb`): `--mds-color-waypoint-button-background-focus`
|
||||
- **Waypoint Teal Hover** (`#12b6bb`): `--mds-color-waypoint-button-background-hover`
|
||||
- **Vagrant Blue** (`#1868f2`): `--mds-color-vagrant-brand`
|
||||
- **Purple Accent** (`#911ced`): `--mds-color-palette-purple-300`
|
||||
- **Visited Purple** (`#a737ff`): `--mds-color-foreground-action-visited`
|
||||
|
||||
### Semantic Colors
|
||||
- **Action Blue** (`#1060ff`): Primary action links on dark
|
||||
- **Link Blue** (`#2264d6`): Primary links on light
|
||||
- **Bright Blue** (`#2b89ff`): Active links, hover accent
|
||||
- **Amber** (`#bb5a00`): `--mds-color-palette-amber-200`, warning states
|
||||
- **Amber Light** (`#fbeabf`): `--mds-color-palette-amber-100`, warning backgrounds
|
||||
- **Vault Faint Yellow** (`#fff9cf`): `--mds-color-vault-radar-gradient-faint-stop`
|
||||
- **Orange** (`#a9722e`): `--mds-color-unified-core-orange-6`
|
||||
- **Red** (`#731e25`): `--mds-color-unified-core-red-7`, error states
|
||||
- **Navy** (`#101a59`): `--mds-color-unified-core-blue-7`
|
||||
|
||||
### Shadows
|
||||
- **Micro Shadow** (`rgba(97, 104, 117, 0.05) 0px 1px 1px, rgba(97, 104, 117, 0.05) 0px 2px 2px`): Default card/button elevation
|
||||
- **Focus Outline**: `3px solid var(--mds-color-focus-action-external)` — systematic focus ring
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Families
|
||||
- **Primary Brand**: `__hashicorpSans_96f0ca` (HashiCorp Sans), with fallback: `__hashicorpSans_Fallback_96f0ca`
|
||||
- **System UI**: `system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | HashiCorp Sans | 82px (5.13rem) | 600 | 1.17 (tight) | normal | `"kern"` enabled |
|
||||
| Section Heading | HashiCorp Sans | 52px (3.25rem) | 600 | 1.19 (tight) | normal | `"kern"` enabled |
|
||||
| Feature Heading | HashiCorp Sans | 42px (2.63rem) | 700 | 1.19 (tight) | -0.42px | Negative tracking |
|
||||
| Sub-heading | HashiCorp Sans | 34px (2.13rem) | 600–700 | 1.18 (tight) | normal | Feature blocks |
|
||||
| Card Title | HashiCorp Sans | 26px (1.63rem) | 700 | 1.19 (tight) | normal | Card and panel headings |
|
||||
| Small Title | HashiCorp Sans | 19px (1.19rem) | 700 | 1.21 (tight) | normal | Compact headings |
|
||||
| Body Emphasis | HashiCorp Sans | 17px (1.06rem) | 600–700 | 1.18–1.35 | normal | Bold body text |
|
||||
| Body Large | system-ui | 20px (1.25rem) | 400–600 | 1.50 | normal | Hero descriptions |
|
||||
| Body | system-ui | 16px (1.00rem) | 400–500 | 1.63–1.69 (relaxed) | normal | Standard body text |
|
||||
| Nav Link | system-ui | 15px (0.94rem) | 500 | 1.60 (relaxed) | normal | Navigation items |
|
||||
| Small Body | system-ui | 14px (0.88rem) | 400–500 | 1.29–1.71 | normal | Secondary content |
|
||||
| Caption | system-ui | 13px (0.81rem) | 400–500 | 1.23–1.69 | normal | Metadata, footer links |
|
||||
| Uppercase Label | HashiCorp Sans | 13px (0.81rem) | 600 | 1.69 (relaxed) | 1.3px | `text-transform: uppercase` |
|
||||
|
||||
### Principles
|
||||
- **Brand/System split**: HashiCorp Sans for headings and brand-critical text; system-ui for body, navigation, and functional text. The brand font carries the weight, system-ui carries the words.
|
||||
- **Kern always on**: All HashiCorp Sans text enables OpenType `"kern"` — letterfitting is non-negotiable.
|
||||
- **Tight headings**: Every heading uses 1.17–1.21 line-height, creating dense, stacked text blocks that feel infrastructural — solid, load-bearing.
|
||||
- **Relaxed body**: Body text uses 1.50–1.69 line-height (notably generous), creating comfortable reading rhythm beneath the dense headings.
|
||||
- **Uppercase labels as wayfinding**: 13px uppercase with 1.3px letter-spacing serves as the systematic category/section marker — always HashiCorp Sans weight 600.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary Dark**
|
||||
- Background: `#15181e`
|
||||
- Text: `#d5d7db`
|
||||
- Padding: 9px 9px 9px 15px (asymmetric, more left padding)
|
||||
- Radius: 5px
|
||||
- Border: `1px solid rgba(178, 182, 189, 0.4)`
|
||||
- Shadow: `rgba(97, 104, 117, 0.05) 0px 1px 1px, rgba(97, 104, 117, 0.05) 0px 2px 2px`
|
||||
- Focus: `3px solid var(--mds-color-focus-action-external)`
|
||||
- Hover: uses `--mds-color-surface-interactive` token
|
||||
|
||||
**Secondary White**
|
||||
- Background: `#ffffff`
|
||||
- Text: `#3b3d45`
|
||||
- Padding: 8px 12px
|
||||
- Radius: 4px
|
||||
- Hover: `--mds-color-surface-interactive` + low-shadow elevation
|
||||
- Focus: `3px solid transparent` outline
|
||||
- Clean, minimal appearance
|
||||
|
||||
**Product-Colored Buttons**
|
||||
- Terraform: background `#7b42bc`
|
||||
- Vault: background `#ffcf25` (dark text)
|
||||
- Waypoint: background `#14c6cb`, hover `#12b6bb`
|
||||
- Each product button follows the same structural pattern but uses its brand color
|
||||
|
||||
### Badges / Pills
|
||||
- Background: `#42225b` (deep purple)
|
||||
- Text: `#efeff1`
|
||||
- Padding: 3px 7px
|
||||
- Radius: 5px
|
||||
- Border: `1px solid rgb(180, 87, 255)`
|
||||
- Font: 16px
|
||||
|
||||
### Inputs
|
||||
|
||||
**Text Input (Dark Mode)**
|
||||
- Background: `#0d0e12`
|
||||
- Text: `#efeff1`
|
||||
- Border: `1px solid rgb(97, 104, 117)`
|
||||
- Padding: 11px
|
||||
- Radius: 5px
|
||||
- Focus: `3px solid var(--mds-color-focus-action-external)` outline
|
||||
|
||||
**Checkbox**
|
||||
- Background: `#0d0e12`
|
||||
- Border: `1px solid rgb(97, 104, 117)`
|
||||
- Radius: 3px
|
||||
|
||||
### Links
|
||||
- **Action Blue on Light**: `#2264d6`, hover → blue-600 variable, underline on hover
|
||||
- **Action Blue on Dark**: `#1060ff` or `#2b89ff`, underline on hover
|
||||
- **White on Dark**: `#ffffff`, transparent underline → visible underline on hover
|
||||
- **Neutral on Light**: `#3b3d45`, transparent underline → visible underline on hover
|
||||
- **Light on Dark**: `#efeff1`, similar hover pattern
|
||||
- All links use `var(--wpl-blue-600)` as hover color
|
||||
|
||||
### Cards & Containers
|
||||
- Light mode: white background, micro-shadow elevation
|
||||
- Dark mode: `#15181e` or darker surfaces
|
||||
- Radius: 8px for cards and containers
|
||||
- Product showcase cards with gradient borders or accent lighting
|
||||
|
||||
### Navigation
|
||||
- Clean horizontal nav with mega-menu dropdowns
|
||||
- HashiCorp logo left-aligned
|
||||
- system-ui 15px weight 500 for links
|
||||
- Product categories organized by lifecycle management group
|
||||
- "Get started" and "Contact us" CTAs in header
|
||||
- Dark mode variant for hero sections
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 2px, 3px, 4px, 6px, 7px, 8px, 9px, 11px, 12px, 16px, 20px, 24px, 32px, 40px, 48px
|
||||
|
||||
### Grid & Container
|
||||
- Max content width: ~1150px (xl breakpoint)
|
||||
- Full-width dark hero sections with contained content
|
||||
- Card grids: 2–3 column layouts
|
||||
- Generous horizontal padding at desktop scale
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile Small | <375px | Tight single column |
|
||||
| Mobile | 375–480px | Standard mobile |
|
||||
| Small Tablet | 480–600px | Minor adjustments |
|
||||
| Tablet | 600–768px | 2-column grids begin |
|
||||
| Small Desktop | 768–992px | Full nav visible |
|
||||
| Desktop | 992–1120px | Standard layout |
|
||||
| Large Desktop | 1120–1440px | Max-width content |
|
||||
| Ultra-wide | >1440px | Centered, generous margins |
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Enterprise breathing room**: Generous vertical spacing between sections (48px–80px+) communicates stability and seriousness.
|
||||
- **Dense headings, spacious body**: Tight line-height headings sit above relaxed body text, creating visual "weight at the top" of each section.
|
||||
- **Dark as canvas**: Dark hero sections use extra vertical padding to let 3D illustrations and gradients breathe.
|
||||
|
||||
### Border Radius Scale
|
||||
- Minimal (2px): Links, small inline elements
|
||||
- Subtle (3px): Checkboxes, small inputs
|
||||
- Standard (4px): Secondary buttons
|
||||
- Comfortable (5px): Primary buttons, badges, inputs
|
||||
- Card (8px): Cards, containers, images
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow | Default surfaces, text blocks |
|
||||
| Whisper (Level 1) | `rgba(97, 104, 117, 0.05) 0px 1px 1px, rgba(97, 104, 117, 0.05) 0px 2px 2px` | Cards, buttons, interactive surfaces |
|
||||
| Focus (Level 2) | `3px solid var(--mds-color-focus-action-external)` outline | Focus rings — color-matched to context |
|
||||
|
||||
**Shadow Philosophy**: HashiCorp uses arguably the subtlest shadow system in modern web design. The dual-layer shadows at 5% opacity are nearly invisible — they exist not to create visual depth but to signal interactivity. If you can see the shadow, it's too strong. This restraint communicates the enterprise value of stability — nothing floats, nothing is uncertain.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use HashiCorp Sans for headings and brand text, system-ui for body and UI text
|
||||
- Enable `"kern"` on all HashiCorp Sans text
|
||||
- Use product brand colors ONLY for their respective products (Terraform = purple, Vault = yellow, etc.)
|
||||
- Apply uppercase labels at 13px weight 600 with 1.3px letter-spacing for section markers
|
||||
- Keep shadows at the "whisper" level (0.05 opacity dual-layer)
|
||||
- Use the `--mds-color-*` token system for consistent color application
|
||||
- Maintain the tight-heading / relaxed-body rhythm (1.17–1.21 vs 1.50–1.69 line-heights)
|
||||
- Use `3px solid` focus outlines for accessibility
|
||||
|
||||
### Don't
|
||||
- Don't use product brand colors outside their product context (no Terraform purple on Vault content)
|
||||
- Don't increase shadow opacity above 0.1 — the whisper level is intentional
|
||||
- Don't use pill-shaped buttons (>8px radius) — the sharp, minimal radius is structural
|
||||
- Don't skip the `"kern"` feature on headings — the font requires it
|
||||
- Don't use HashiCorp Sans for small body text — it's designed for 17px+ heading use
|
||||
- Don't mix product colors in the same component — each product has one color
|
||||
- Don't use pure black (`#000000`) for dark backgrounds — use `#15181e` or `#0d0e12`
|
||||
- Don't forget the asymmetric button padding — 9px 9px 9px 15px is intentional
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <768px | Single column, hamburger nav, stacked CTAs |
|
||||
| Tablet | 768–992px | 2-column grids, nav begins expanding |
|
||||
| Desktop | 992–1150px | Full layout, mega-menu nav |
|
||||
| Large | >1150px | Max-width centered, generous margins |
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero: 82px → 52px → 42px heading sizes
|
||||
- Navigation: mega-menu → hamburger
|
||||
- Product cards: 3-column → 2-column → stacked
|
||||
- Dark sections maintain full-width but compress padding
|
||||
- Buttons: inline → full-width stacked on mobile
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Light bg: `#ffffff`, `#f1f2f3`
|
||||
- Dark bg: `#15181e`, `#0d0e12`
|
||||
- Text light: `#000000`, `#3b3d45`
|
||||
- Text dark: `#efeff1`, `#d5d7db`
|
||||
- Links: `#2264d6` (light), `#1060ff` (dark), `#2b89ff` (active)
|
||||
- Helper text: `#656a76`
|
||||
- Borders: `rgba(178, 182, 189, 0.4)`, `rgb(97, 104, 117)`
|
||||
- Focus: `3px solid` product-appropriate color
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero on dark background (#15181e). Headline at 82px HashiCorp Sans weight 600, line-height 1.17, kern enabled, white text. Sub-text at 20px system-ui weight 400, line-height 1.50, #d5d7db text. Two buttons: primary dark (#15181e, 5px radius, 9px 15px padding) and secondary white (#ffffff, 4px radius, 8px 12px padding)."
|
||||
- "Design a product card: white background, 8px radius, dual-layer shadow at rgba(97,104,117,0.05). Title at 26px HashiCorp Sans weight 700, body at 16px system-ui weight 400 line-height 1.63."
|
||||
- "Build an uppercase section label: 13px HashiCorp Sans weight 600, line-height 1.69, letter-spacing 1.3px, text-transform uppercase, #656a76 color."
|
||||
- "Create a product-specific CTA button: Terraform → #7b42bc background, Vault → #ffcf25 with dark text, Waypoint → #14c6cb. All: 5px radius, 500 weight text, 16px system-ui."
|
||||
- "Design a dark form: #0d0e12 input background, #efeff1 text, 1px solid rgb(97,104,117) border, 5px radius, 11px padding. Focus: 3px solid accent-color outline."
|
||||
|
||||
### Iteration Guide
|
||||
1. Always start with the mode decision: light (white) for informational, dark (#15181e) for hero/product
|
||||
2. HashiCorp Sans for headings only (17px+), system-ui for everything else
|
||||
3. Shadows are at whisper level (0.05 opacity) — if visible, reduce
|
||||
4. Product colors are sacred — each product owns exactly one color
|
||||
5. Focus rings are always 3px solid, color-matched to product context
|
||||
6. Uppercase labels are the systematic wayfinding pattern — 13px, 600, 1.3px tracking
|
||||
345
skills/creative/popular-web-designs/templates/ibm.md
Normal file
345
skills/creative/popular-web-designs/templates/ibm.md
Normal file
@@ -0,0 +1,345 @@
|
||||
# Design System: IBM
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `IBM Plex Sans` | **Mono:** `IBM Plex Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
IBM's website is the digital embodiment of enterprise authority built on the Carbon Design System — a design language so methodically structured it reads like an engineering specification rendered as a webpage. The page operates on a stark duality: a bright white (`#ffffff`) canvas with near-black (`#161616`) text, punctuated by a single, unwavering accent — IBM Blue 60 (`#0f62fe`). This isn't playful tech-startup minimalism; it's corporate precision distilled into pixels. Every element exists within Carbon's rigid 2x grid, every color maps to a semantic token, every spacing value snaps to the 8px base unit.
|
||||
|
||||
The IBM Plex type family is the system's backbone. IBM Plex Sans at light weight (300) for display headlines creates an unexpectedly airy, almost delicate quality at large sizes — a deliberate counterpoint to IBM's corporate gravity. At body sizes, regular weight (400) with 0.16px letter-spacing on 14px captions introduces the meticulous micro-tracking that makes Carbon text feel engineered rather than designed. IBM Plex Mono serves code, data, and technical labels, completing the family trinity alongside the rarely-surfaced IBM Plex Serif.
|
||||
|
||||
What defines IBM's visual identity beyond monochrome-plus-blue is the reliance on Carbon's component token system. Every interactive state maps to a CSS custom property prefixed with `--cds-` (Carbon Design System). Buttons don't have hardcoded colors; they reference `--cds-button-primary`, `--cds-button-primary-hover`, `--cds-button-primary-active`. This tokenized architecture means the entire visual layer is a thin skin over a deeply systematic foundation — the design equivalent of a well-typed API.
|
||||
|
||||
**Key Characteristics:**
|
||||
- IBM Plex Sans at weight 300 (Light) for display — corporate gravitas through typographic restraint
|
||||
- IBM Plex Mono for code and technical content with consistent 0.16px letter-spacing at small sizes
|
||||
- Single accent color: IBM Blue 60 (`#0f62fe`) — every interactive element, every CTA, every link
|
||||
- Carbon token system (`--cds-*`) driving all semantic colors, enabling theme-switching at the variable level
|
||||
- 8px spacing grid with strict adherence — no arbitrary values, everything aligns
|
||||
- Flat, borderless cards on `#f4f4f4` Gray 10 surface — depth through background-color layering, not shadows
|
||||
- Bottom-border inputs (not boxed) — the signature Carbon form pattern
|
||||
- 0px border-radius on primary buttons — unapologetically rectangular, no softening
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **IBM Blue 60** (`#0f62fe`): The singular interactive color. Primary buttons, links, focus states, active indicators. This is the only chromatic hue in the core UI palette.
|
||||
- **White** (`#ffffff`): Page background, card surfaces, button text on blue, `--cds-background`.
|
||||
- **Gray 100** (`#161616`): Primary text, headings, dark surface backgrounds, nav bar, footer. `--cds-text-primary`.
|
||||
|
||||
### Neutral Scale (Gray Family)
|
||||
- **Gray 100** (`#161616`): Primary text, headings, dark UI chrome, footer background.
|
||||
- **Gray 90** (`#262626`): Secondary dark surfaces, hover states on dark backgrounds.
|
||||
- **Gray 80** (`#393939`): Tertiary dark, active states.
|
||||
- **Gray 70** (`#525252`): Secondary text, helper text, descriptions. `--cds-text-secondary`.
|
||||
- **Gray 60** (`#6f6f6f`): Placeholder text, disabled text.
|
||||
- **Gray 50** (`#8d8d8d`): Disabled icons, muted labels.
|
||||
- **Gray 30** (`#c6c6c6`): Borders, divider lines, input bottom-borders. `--cds-border-subtle`.
|
||||
- **Gray 20** (`#e0e0e0`): Subtle borders, card outlines.
|
||||
- **Gray 10** (`#f4f4f4`): Secondary surface background, card fills, alternating rows. `--cds-layer-01`.
|
||||
- **Gray 10 Hover** (`#e8e8e8`): Hover state for Gray 10 surfaces.
|
||||
|
||||
### Interactive
|
||||
- **Blue 60** (`#0f62fe`): Primary interactive — buttons, links, focus. `--cds-link-primary`, `--cds-button-primary`.
|
||||
- **Blue 70** (`#0043ce`): Link hover state. `--cds-link-primary-hover`.
|
||||
- **Blue 80** (`#002d9c`): Active/pressed state for blue elements.
|
||||
- **Blue 10** (`#edf5ff`): Blue tint surface, selected row background.
|
||||
- **Focus Blue** (`#0f62fe`): `--cds-focus` — 2px inset border on focused elements.
|
||||
- **Focus Inset** (`#ffffff`): `--cds-focus-inset` — white inner ring for focus on dark backgrounds.
|
||||
|
||||
### Support & Status
|
||||
- **Red 60** (`#da1e28`): Error, danger. `--cds-support-error`.
|
||||
- **Green 50** (`#24a148`): Success. `--cds-support-success`.
|
||||
- **Yellow 30** (`#f1c21b`): Warning. `--cds-support-warning`.
|
||||
- **Blue 60** (`#0f62fe`): Informational. `--cds-support-info`.
|
||||
|
||||
### Dark Theme (Gray 100 Theme)
|
||||
- **Background**: Gray 100 (`#161616`). `--cds-background`.
|
||||
- **Layer 01**: Gray 90 (`#262626`). Card and container surfaces.
|
||||
- **Layer 02**: Gray 80 (`#393939`). Elevated surfaces.
|
||||
- **Text Primary**: Gray 10 (`#f4f4f4`). `--cds-text-primary`.
|
||||
- **Text Secondary**: Gray 30 (`#c6c6c6`). `--cds-text-secondary`.
|
||||
- **Border Subtle**: Gray 80 (`#393939`). `--cds-border-subtle`.
|
||||
- **Interactive**: Blue 40 (`#78a9ff`). Links and interactive elements shift lighter for contrast.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Primary**: `IBM Plex Sans`, with fallbacks: `Helvetica Neue, Arial, sans-serif`
|
||||
- **Monospace**: `IBM Plex Mono`, with fallbacks: `Menlo, Courier, monospace`
|
||||
- **Serif** (limited use): `IBM Plex Serif`, for editorial/expressive contexts
|
||||
- **Icon Font**: `ibm_icons` — proprietary icon glyphs at 20px
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display 01 | IBM Plex Sans | 60px (3.75rem) | 300 (Light) | 1.17 (70px) | 0 | Maximum impact, light weight for elegance |
|
||||
| Display 02 | IBM Plex Sans | 48px (3.00rem) | 300 (Light) | 1.17 (56px) | 0 | Secondary hero, responsive fallback |
|
||||
| Heading 01 | IBM Plex Sans | 42px (2.63rem) | 300 (Light) | 1.19 (50px) | 0 | Expressive heading |
|
||||
| Heading 02 | IBM Plex Sans | 32px (2.00rem) | 400 (Regular) | 1.25 (40px) | 0 | Section headings |
|
||||
| Heading 03 | IBM Plex Sans | 24px (1.50rem) | 400 (Regular) | 1.33 (32px) | 0 | Sub-section titles |
|
||||
| Heading 04 | IBM Plex Sans | 20px (1.25rem) | 600 (Semibold) | 1.40 (28px) | 0 | Card titles, feature headers |
|
||||
| Heading 05 | IBM Plex Sans | 20px (1.25rem) | 400 (Regular) | 1.40 (28px) | 0 | Lighter card headings |
|
||||
| Body Long 01 | IBM Plex Sans | 16px (1.00rem) | 400 (Regular) | 1.50 (24px) | 0 | Standard reading text |
|
||||
| Body Long 02 | IBM Plex Sans | 16px (1.00rem) | 600 (Semibold) | 1.50 (24px) | 0 | Emphasized body, labels |
|
||||
| Body Short 01 | IBM Plex Sans | 14px (0.88rem) | 400 (Regular) | 1.29 (18px) | 0.16px | Compact body, captions |
|
||||
| Body Short 02 | IBM Plex Sans | 14px (0.88rem) | 600 (Semibold) | 1.29 (18px) | 0.16px | Bold captions, nav items |
|
||||
| Caption 01 | IBM Plex Sans | 12px (0.75rem) | 400 (Regular) | 1.33 (16px) | 0.32px | Metadata, timestamps |
|
||||
| Code 01 | IBM Plex Mono | 14px (0.88rem) | 400 (Regular) | 1.43 (20px) | 0.16px | Inline code, terminal |
|
||||
| Code 02 | IBM Plex Mono | 16px (1.00rem) | 400 (Regular) | 1.50 (24px) | 0 | Code blocks |
|
||||
| Mono Display | IBM Plex Mono | 42px (2.63rem) | 400 (Regular) | 1.19 (50px) | 0 | Hero mono decorative |
|
||||
|
||||
### Principles
|
||||
- **Light weight at display sizes**: Carbon's expressive type set uses weight 300 (Light) at 42px+. This creates a distinctive tension — the content speaks with corporate authority while the letterforms whisper with typographic lightness.
|
||||
- **Micro-tracking at small sizes**: 0.16px letter-spacing at 14px and 0.32px at 12px. These seemingly negligible values are Carbon's secret weapon for readability at compact sizes — they open up the tight IBM Plex letterforms just enough.
|
||||
- **Three functional weights**: 300 (display/expressive), 400 (body/reading), 600 (emphasis/UI labels). Weight 700 is intentionally absent from the production type scale.
|
||||
- **Productive vs. Expressive**: Productive sets use tighter line-heights (1.29) for dense UI. Expressive sets breathe more (1.40-1.50) for marketing and editorial content.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary Button (Blue)**
|
||||
- Background: `#0f62fe` (Blue 60) → `--cds-button-primary`
|
||||
- Text: `#ffffff` (White)
|
||||
- Padding: 14px 63px 14px 15px (asymmetric — room for trailing icon)
|
||||
- Border: 1px solid transparent
|
||||
- Border-radius: 0px (sharp rectangle — the Carbon signature)
|
||||
- Height: 48px (default), 40px (compact), 64px (expressive)
|
||||
- Hover: `#0353e9` (Blue 60 Hover) → `--cds-button-primary-hover`
|
||||
- Active: `#002d9c` (Blue 80) → `--cds-button-primary-active`
|
||||
- Focus: `2px solid #0f62fe` inset + `1px solid #ffffff` inner
|
||||
|
||||
**Secondary Button (Gray)**
|
||||
- Background: `#393939` (Gray 80)
|
||||
- Text: `#ffffff`
|
||||
- Hover: `#4c4c4c` (Gray 70)
|
||||
- Active: `#6f6f6f` (Gray 60)
|
||||
- Same padding/radius as primary
|
||||
|
||||
**Tertiary Button (Ghost Blue)**
|
||||
- Background: transparent
|
||||
- Text: `#0f62fe` (Blue 60)
|
||||
- Border: 1px solid `#0f62fe`
|
||||
- Hover: `#0353e9` text + Blue 10 background tint
|
||||
- Border-radius: 0px
|
||||
|
||||
**Ghost Button**
|
||||
- Background: transparent
|
||||
- Text: `#0f62fe` (Blue 60)
|
||||
- Padding: 14px 16px
|
||||
- Border: none
|
||||
- Hover: `#e8e8e8` background tint
|
||||
|
||||
**Danger Button**
|
||||
- Background: `#da1e28` (Red 60)
|
||||
- Text: `#ffffff`
|
||||
- Hover: `#b81921` (Red 70)
|
||||
|
||||
### Cards & Containers
|
||||
- Background: `#ffffff` on white theme, `#f4f4f4` (Gray 10) for elevated cards
|
||||
- Border: none (flat design — no border or shadow on most cards)
|
||||
- Border-radius: 0px (matching the rectangular button aesthetic)
|
||||
- Hover: background shifts to `#e8e8e8` (Gray 10 Hover) for clickable cards
|
||||
- Content padding: 16px
|
||||
- Separation: background-color layering (white → gray 10 → white) rather than shadows
|
||||
|
||||
### Inputs & Forms
|
||||
- Background: `#f4f4f4` (Gray 10) — `--cds-field`
|
||||
- Text: `#161616` (Gray 100)
|
||||
- Padding: 0px 16px (horizontal only)
|
||||
- Height: 40px (default), 48px (large)
|
||||
- Border: none on sides/top — `2px solid transparent` bottom
|
||||
- Bottom-border active: `2px solid #161616` (Gray 100)
|
||||
- Focus: `2px solid #0f62fe` (Blue 60) bottom-border — `--cds-focus`
|
||||
- Error: `2px solid #da1e28` (Red 60) bottom-border
|
||||
- Label: 12px IBM Plex Sans, 0.32px letter-spacing, Gray 70
|
||||
- Helper text: 12px, Gray 60
|
||||
- Placeholder: Gray 60 (`#6f6f6f`)
|
||||
- Border-radius: 0px (top) — inputs are sharp-cornered
|
||||
|
||||
### Navigation
|
||||
- Background: `#161616` (Gray 100) — full-width dark masthead
|
||||
- Height: 48px
|
||||
- Logo: IBM 8-bar logo, white on dark, left-aligned
|
||||
- Links: 14px IBM Plex Sans, weight 400, `#c6c6c6` (Gray 30) default
|
||||
- Link hover: `#ffffff` text
|
||||
- Active link: `#ffffff` with bottom-border indicator
|
||||
- Platform switcher: left-aligned horizontal tabs
|
||||
- Search: icon-triggered slide-out search field
|
||||
- Mobile: hamburger with left-sliding panel
|
||||
|
||||
### Links
|
||||
- Default: `#0f62fe` (Blue 60) with no underline
|
||||
- Hover: `#0043ce` (Blue 70) with underline
|
||||
- Visited: remains Blue 60 (no visited state change)
|
||||
- Inline links: underlined by default in body copy
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Content Block (Hero/Feature)**
|
||||
- Full-width alternating white/gray-10 background bands
|
||||
- Headline left-aligned with 60px or 48px display type
|
||||
- CTA as blue primary button with arrow icon
|
||||
- Image/illustration right-aligned or below on mobile
|
||||
|
||||
**Tile (Clickable Card)**
|
||||
- Background: `#f4f4f4` or `#ffffff`
|
||||
- Full-width bottom-border or background-shift hover
|
||||
- Arrow icon bottom-right on hover
|
||||
- No shadow — flatness is the identity
|
||||
|
||||
**Tag / Label**
|
||||
- Background: contextual color at 10% opacity (e.g., Blue 10, Red 10)
|
||||
- Text: corresponding 60-grade color
|
||||
- Padding: 4px 8px
|
||||
- Border-radius: 24px (pill — exception to the 0px rule)
|
||||
- Font: 12px weight 400
|
||||
|
||||
**Notification Banner**
|
||||
- Full-width bar, typically Blue 60 or Gray 100 background
|
||||
- White text, 14px
|
||||
- Close/dismiss icon right-aligned
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px (Carbon 2x grid)
|
||||
- Component spacing scale: 2px, 4px, 8px, 12px, 16px, 24px, 32px, 40px, 48px
|
||||
- Layout spacing scale: 16px, 24px, 32px, 48px, 64px, 80px, 96px, 160px
|
||||
- Mini unit: 8px (smallest usable spacing)
|
||||
- Padding within components: typically 16px
|
||||
- Gap between cards/tiles: 1px (hairline) or 16px (standard)
|
||||
|
||||
### Grid & Container
|
||||
- 16-column grid (Carbon's 2x grid system)
|
||||
- Max content width: 1584px (max breakpoint)
|
||||
- Column gutters: 32px (16px on mobile)
|
||||
- Margin: 16px (mobile), 32px (tablet+)
|
||||
- Content typically spans 8-12 columns for readable line lengths
|
||||
- Full-bleed sections alternate with contained content
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Functional density**: Carbon favors productive density over expansive whitespace. Sections are tightly packed compared to consumer design systems — this reflects IBM's enterprise DNA.
|
||||
- **Background-color zoning**: Instead of massive padding between sections, IBM uses alternating background colors (white → gray 10 → white) to create visual separation with minimal vertical space.
|
||||
- **Consistent 48px rhythm**: Major section transitions use 48px vertical spacing. Hero sections may use 80px–96px.
|
||||
|
||||
### Border Radius Scale
|
||||
- **0px**: Primary buttons, inputs, tiles, cards — the dominant treatment. Carbon is fundamentally rectangular.
|
||||
- **2px**: Occasionally on small interactive elements (tags)
|
||||
- **24px**: Tags/labels (pill shape — the sole rounded exception)
|
||||
- **50%**: Avatar circles, icon containers
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow, `#ffffff` background | Default page surface |
|
||||
| Layer 01 | No shadow, `#f4f4f4` background | Cards, tiles, alternating sections |
|
||||
| Layer 02 | No shadow, `#e0e0e0` background | Elevated panels within Layer 01 |
|
||||
| Raised | `0 2px 6px rgba(0,0,0,0.3)` | Dropdowns, tooltips, overflow menus |
|
||||
| Overlay | `0 2px 6px rgba(0,0,0,0.3)` + dark scrim | Modal dialogs, side panels |
|
||||
| Focus | `2px solid #0f62fe` inset + `1px solid #ffffff` | Keyboard focus ring |
|
||||
| Bottom-border | `2px solid #161616` on bottom edge | Active input, active tab indicator |
|
||||
|
||||
**Shadow Philosophy**: Carbon is deliberately shadow-averse. IBM achieves depth primarily through background-color layering — stacking surfaces of progressively darker grays rather than adding box-shadows. This creates a flat, print-inspired aesthetic where hierarchy is communicated through color value, not simulated light. Shadows are reserved exclusively for floating elements (dropdowns, tooltips, modals) where the element genuinely overlaps content. This restraint gives the rare shadow meaningful impact — when something floats in Carbon, it matters.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use IBM Plex Sans at weight 300 for display sizes (42px+) — the lightness is intentional
|
||||
- Apply 0.16px letter-spacing on 14px body text and 0.32px on 12px captions
|
||||
- Use 0px border-radius on buttons, inputs, cards, and tiles — rectangles are the system
|
||||
- Reference `--cds-*` token names when implementing (e.g., `--cds-button-primary`, `--cds-text-primary`)
|
||||
- Use background-color layering (white → gray 10 → gray 20) for depth instead of shadows
|
||||
- Use bottom-border (not box) for input field indicators
|
||||
- Maintain the 48px default button height and asymmetric padding for icon accommodation
|
||||
- Apply Blue 60 (`#0f62fe`) as the sole accent — one blue to rule them all
|
||||
|
||||
### Don't
|
||||
- Don't round button corners — 0px radius is the Carbon identity
|
||||
- Don't use shadows on cards or tiles — flatness is the point
|
||||
- Don't introduce additional accent colors — IBM's system is monochromatic + blue
|
||||
- Don't use weight 700 (Bold) — the scale stops at 600 (Semibold)
|
||||
- Don't add letter-spacing to display-size text — tracking is only for 14px and below
|
||||
- Don't box inputs with full borders — Carbon inputs use bottom-border only
|
||||
- Don't use gradient backgrounds — IBM's surfaces are flat, solid colors
|
||||
- Don't deviate from the 8px spacing grid — every value should be divisible by 8 (with 2px and 4px for micro-adjustments)
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Small (sm) | 320px | Single column, hamburger nav, 16px margins |
|
||||
| Medium (md) | 672px | 2-column grids begin, expanded content |
|
||||
| Large (lg) | 1056px | Full navigation visible, 3-4 column grids |
|
||||
| X-Large (xlg) | 1312px | Maximum content density, wide layouts |
|
||||
| Max | 1584px | Maximum content width, centered with margins |
|
||||
|
||||
### Touch Targets
|
||||
- Button height: 48px default, minimum 40px (compact)
|
||||
- Navigation links: 48px row height for touch
|
||||
- Input height: 40px default, 48px large
|
||||
- Icon buttons: 48px square touch target
|
||||
- Mobile menu items: full-width 48px rows
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero: 60px display → 42px → 32px heading as viewport narrows
|
||||
- Navigation: full horizontal masthead → hamburger with slide-out panel
|
||||
- Grid: 4-column → 2-column → single column
|
||||
- Tiles/cards: horizontal grid → vertical stack
|
||||
- Images: maintain aspect ratio, max-width 100%
|
||||
- Footer: multi-column link groups → stacked single column
|
||||
- Section padding: 48px → 32px → 16px
|
||||
|
||||
### Image Behavior
|
||||
- Responsive images with `max-width: 100%`
|
||||
- Product illustrations scale proportionally
|
||||
- Hero images may shift from side-by-side to stacked below
|
||||
- Data visualizations maintain aspect ratio with horizontal scroll on mobile
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary CTA: IBM Blue 60 (`#0f62fe`)
|
||||
- Background: White (`#ffffff`)
|
||||
- Heading text: Gray 100 (`#161616`)
|
||||
- Body text: Gray 100 (`#161616`)
|
||||
- Secondary text: Gray 70 (`#525252`)
|
||||
- Surface/Card: Gray 10 (`#f4f4f4`)
|
||||
- Border: Gray 30 (`#c6c6c6`)
|
||||
- Link: Blue 60 (`#0f62fe`)
|
||||
- Link hover: Blue 70 (`#0043ce`)
|
||||
- Focus ring: Blue 60 (`#0f62fe`)
|
||||
- Error: Red 60 (`#da1e28`)
|
||||
- Success: Green 50 (`#24a148`)
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on white background. Headline at 60px IBM Plex Sans weight 300, line-height 1.17, color #161616. Subtitle at 16px weight 400, line-height 1.50, color #525252, max-width 640px. Blue CTA button (#0f62fe background, #ffffff text, 0px border-radius, 48px height, 14px 63px 14px 15px padding)."
|
||||
- "Design a card tile: #f4f4f4 background, 0px border-radius, 16px padding. Title at 20px IBM Plex Sans weight 600, line-height 1.40, color #161616. Body at 14px weight 400, letter-spacing 0.16px, line-height 1.29, color #525252. Hover: background shifts to #e8e8e8."
|
||||
- "Build a form field: #f4f4f4 background, 0px border-radius, 40px height, 16px horizontal padding. Label above at 12px weight 400, letter-spacing 0.32px, color #525252. Bottom-border: 2px solid transparent default, 2px solid #0f62fe on focus. Placeholder: #6f6f6f."
|
||||
- "Create a dark navigation bar: #161616 background, 48px height. IBM logo white left-aligned. Links at 14px IBM Plex Sans weight 400, color #c6c6c6. Hover: #ffffff text. Active: #ffffff with 2px bottom border."
|
||||
- "Build a tag component: Blue 10 (#edf5ff) background, Blue 60 (#0f62fe) text, 4px 8px padding, 24px border-radius, 12px IBM Plex Sans weight 400."
|
||||
|
||||
### Iteration Guide
|
||||
1. Always use 0px border-radius on buttons, inputs, and cards — this is non-negotiable in Carbon
|
||||
2. Letter-spacing only at small sizes: 0.16px at 14px, 0.32px at 12px — never on display text
|
||||
3. Three weights: 300 (display), 400 (body), 600 (emphasis) — no bold
|
||||
4. Blue 60 is the only accent color — do not introduce secondary accent hues
|
||||
5. Depth comes from background-color layering (white → #f4f4f4 → #e0e0e0), not shadows
|
||||
6. Inputs have bottom-border only, never fully boxed
|
||||
7. Use `--cds-` prefix for token naming to stay Carbon-compatible
|
||||
8. 48px is the universal interactive element height
|
||||
159
skills/creative/popular-web-designs/templates/intercom.md
Normal file
159
skills/creative/popular-web-designs/templates/intercom.md
Normal file
@@ -0,0 +1,159 @@
|
||||
# Design System: Intercom
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `system monospace stack`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Intercom's website is a warm, confident customer service platform that communicates "AI-first helpdesk" through a clean, editorial design language. The page operates on a warm off-white canvas (`#faf9f6`) with off-black (`#111111`) text, creating an intimate, magazine-like reading experience. The signature Fin Orange (`#ff5600`) — named after Intercom's AI agent — serves as the singular vibrant accent against the warm neutral palette.
|
||||
|
||||
The typography uses Saans — a custom geometric sans-serif with aggressive negative letter-spacing (-2.4px at 80px, -0.48px at 24px) and a consistent 1.00 line-height across all heading sizes. This creates ultra-compressed, billboard-like headlines that feel engineered and precise. Serrif provides the serif companion for editorial moments, and SaansMono handles code and uppercase technical labels. MediumLL and LLMedium appear for specific UI contexts, creating a rich five-font ecosystem.
|
||||
|
||||
What distinguishes Intercom is its remarkably sharp geometry — 4px border-radius on buttons creates near-rectangular interactive elements that feel industrial and precise, contrasting with the warm surface colors. Button hover states use `scale(1.1)` expansion, creating a physical "growing" interaction. The border system uses warm oat tones (`#dedbd6`) and oklab-based opacity values for sophisticated color management.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Warm off-white canvas (`#faf9f6`) with oat-toned borders (`#dedbd6`)
|
||||
- Saans font with extreme negative tracking (-2.4px at 80px) and 1.00 line-height
|
||||
- Fin Orange (`#ff5600`) as singular brand accent
|
||||
- Sharp 4px border-radius — near-rectangular buttons and elements
|
||||
- Scale(1.1) hover with scale(0.85) active — physical button interaction
|
||||
- SaansMono uppercase labels with wide tracking (0.6px–1.2px)
|
||||
- Rich multi-color report palette (blue, green, red, pink, lime, orange)
|
||||
- oklab color values for sophisticated opacity management
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Off Black** (`#111111`): `--color-off-black`, primary text, button backgrounds
|
||||
- **Pure White** (`#ffffff`): `--wsc-color-content-primary`, primary surface
|
||||
- **Warm Cream** (`#faf9f6`): Button backgrounds, card surfaces
|
||||
- **Fin Orange** (`#ff5600`): `--color-fin`, primary brand accent
|
||||
- **Report Orange** (`#fe4c02`): `--color-report-orange`, data visualization
|
||||
|
||||
### Report Palette
|
||||
- **Report Blue** (`#65b5ff`): `--color-report-blue`
|
||||
- **Report Green** (`#0bdf50`): `--color-report-green`
|
||||
- **Report Red** (`#c41c1c`): `--color-report-red`
|
||||
- **Report Pink** (`#ff2067`): `--color-report-pink`
|
||||
- **Report Lime** (`#b3e01c`): `--color-report-lime-300`
|
||||
- **Green** (`#00da00`): `--color-green`
|
||||
- **Deep Blue** (`#0007cb`): Deep blue accent
|
||||
|
||||
### Neutral Scale (Warm)
|
||||
- **Black 80** (`#313130`): `--wsc-color-black-80`, dark neutral
|
||||
- **Black 60** (`#626260`): `--wsc-color-black-60`, mid neutral
|
||||
- **Black 50** (`#7b7b78`): `--wsc-color-black-50`, muted text
|
||||
- **Content Tertiary** (`#9c9fa5`): `--wsc-color-content-tertiary`
|
||||
- **Oat Border** (`#dedbd6`): Warm border color
|
||||
- **Warm Sand** (`#d3cec6`): Light warm neutral
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Families
|
||||
- **Primary**: `Saans`, fallbacks: `Saans Fallback, ui-sans-serif, system-ui`
|
||||
- **Serif**: `Serrif`, fallbacks: `Serrif Fallback, ui-serif, Georgia`
|
||||
- **Monospace**: `SaansMono`, fallbacks: `SaansMono Fallback, ui-monospace`
|
||||
- **UI**: `MediumLL` / `LLMedium`, fallbacks: `system-ui, -apple-system`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing |
|
||||
|------|------|------|--------|-------------|----------------|
|
||||
| Display Hero | Saans | 80px | 400 | 1.00 (tight) | -2.4px |
|
||||
| Section Heading | Saans | 54px | 400 | 1.00 | -1.6px |
|
||||
| Sub-heading | Saans | 40px | 400 | 1.00 | -1.2px |
|
||||
| Card Title | Saans | 32px | 400 | 1.00 | -0.96px |
|
||||
| Feature Title | Saans | 24px | 400 | 1.00 | -0.48px |
|
||||
| Body Emphasis | Saans | 20px | 400 | 0.95 | -0.2px |
|
||||
| Nav / UI | Saans | 18px | 400 | 1.00 | normal |
|
||||
| Body | Saans | 16px | 400 | 1.50 | normal |
|
||||
| Body Light | Saans | 14px | 300 | 1.40 | normal |
|
||||
| Button | Saans | 16px / 14px | 400 | 1.50 / 1.43 | normal |
|
||||
| Button Bold | LLMedium | 16px | 700 | 1.20 | 0.16px |
|
||||
| Serif Body | Serrif | 16px | 300 | 1.40 | -0.16px |
|
||||
| Mono Label | SaansMono | 12px | 400–500 | 1.00–1.30 | 0.6px–1.2px uppercase |
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary Dark**
|
||||
- Background: `#111111`
|
||||
- Text: `#ffffff`
|
||||
- Padding: 0px 14px
|
||||
- Radius: 4px
|
||||
- Hover: white background, dark text, scale(1.1)
|
||||
- Active: green background (`#2c6415`), scale(0.85)
|
||||
|
||||
**Outlined**
|
||||
- Background: transparent
|
||||
- Text: `#111111`
|
||||
- Border: `1px solid #111111`
|
||||
- Radius: 4px
|
||||
- Same scale hover/active behavior
|
||||
|
||||
**Warm Card Button**
|
||||
- Background: `#faf9f6`
|
||||
- Text: `#111111`
|
||||
- Padding: 16px
|
||||
- Border: `1px solid oklab(... / 0.1)`
|
||||
|
||||
### Cards & Containers
|
||||
- Background: `#faf9f6` (warm cream)
|
||||
- Border: `1px solid #dedbd6` (warm oat)
|
||||
- Radius: 8px
|
||||
- No visible shadows
|
||||
|
||||
### Navigation
|
||||
- Saans 16px for links
|
||||
- Off-black text on white
|
||||
- Small 4px–6px radius buttons
|
||||
- Orange Fin accent for AI features
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing: 8px, 10px, 12px, 14px, 16px, 20px, 24px, 32px, 40px, 48px, 60px, 64px, 80px, 96px
|
||||
### Border Radius: 4px (buttons), 6px (nav items), 8px (cards, containers)
|
||||
|
||||
## 6. Depth & Elevation
|
||||
Minimal shadows. Depth through warm border colors and surface tints.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use Saans with 1.00 line-height and negative tracking on all headings
|
||||
- Apply 4px radius on buttons — sharp geometry is the identity
|
||||
- Use Fin Orange (#ff5600) for AI/brand accent only
|
||||
- Apply scale(1.1) hover on buttons
|
||||
- Use warm neutrals (#faf9f6, #dedbd6)
|
||||
|
||||
### Don't
|
||||
- Don't round buttons beyond 4px
|
||||
- Don't use Fin Orange decoratively
|
||||
- Don't use cool gray borders — always warm oat tones
|
||||
- Don't skip the negative tracking on headings
|
||||
|
||||
## 8. Responsive Behavior
|
||||
Breakpoints: 425px, 530px, 600px, 640px, 768px, 896px
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Text: Off Black (`#111111`)
|
||||
- Background: Warm Cream (`#faf9f6`)
|
||||
- Accent: Fin Orange (`#ff5600`)
|
||||
- Border: Oat (`#dedbd6`)
|
||||
- Muted: `#7b7b78`
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create hero: warm cream (#faf9f6) background. Saans 80px weight 400, line-height 1.00, letter-spacing -2.4px, #111111. Dark button (#111111, 4px radius). Hover: scale(1.1), white bg."
|
||||
138
skills/creative/popular-web-designs/templates/kraken.md
Normal file
138
skills/creative/popular-web-designs/templates/kraken.md
Normal file
@@ -0,0 +1,138 @@
|
||||
# Design System: Kraken
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `system monospace stack`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Kraken's website is a clean, trustworthy crypto exchange that uses purple as its commanding brand color. The design operates on white backgrounds with Kraken Purple (`#7132f5`, `#5741d8`, `#5b1ecf`) creating a distinctive, professional crypto identity. The proprietary Kraken-Brand font handles display headings with bold (700) weight and negative tracking, while Kraken-Product (with IBM Plex Sans fallback) serves as the UI workhorse.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Kraken Purple (`#7132f5`) as primary brand with darker variants (`#5741d8`, `#5b1ecf`)
|
||||
- Kraken-Brand (display) + Kraken-Product (UI) dual font system
|
||||
- Near-black (`#101114`) text with cool blue-gray neutral scale
|
||||
- 12px radius buttons (rounded but not pill)
|
||||
- Subtle shadows (`rgba(0,0,0,0.03) 0px 4px 24px`) — whisper-level
|
||||
- Green accent (`#149e61`) for positive/success states
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Kraken Purple** (`#7132f5`): Primary CTA, brand accent, links
|
||||
- **Purple Dark** (`#5741d8`): Button borders, outlined variants
|
||||
- **Purple Deep** (`#5b1ecf`): Deepest purple
|
||||
- **Purple Subtle** (`rgba(133,91,251,0.16)`): Purple at 16% — subtle button backgrounds
|
||||
- **Near Black** (`#101114`): Primary text
|
||||
|
||||
### Neutral
|
||||
- **Cool Gray** (`#686b82`): Primary neutral, borders at 24% opacity
|
||||
- **Silver Blue** (`#9497a9`): Secondary text, muted elements
|
||||
- **White** (`#ffffff`): Primary surface
|
||||
- **Border Gray** (`#dedee5`): Divider borders
|
||||
|
||||
### Semantic
|
||||
- **Green** (`#149e61`): Success/positive at 16% opacity for badges
|
||||
- **Green Dark** (`#026b3f`): Badge text
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Families
|
||||
- **Display**: `Kraken-Brand`, fallbacks: `IBM Plex Sans, Helvetica, Arial`
|
||||
- **UI / Body**: `Kraken-Product`, fallbacks: `Helvetica Neue, Helvetica, Arial`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing |
|
||||
|------|------|------|--------|-------------|----------------|
|
||||
| Display Hero | Kraken-Brand | 48px | 700 | 1.17 | -1px |
|
||||
| Section Heading | Kraken-Brand | 36px | 700 | 1.22 | -0.5px |
|
||||
| Sub-heading | Kraken-Brand | 28px | 700 | 1.29 | -0.5px |
|
||||
| Feature Title | Kraken-Product | 22px | 600 | 1.20 | normal |
|
||||
| Body | Kraken-Product | 16px | 400 | 1.38 | normal |
|
||||
| Body Medium | Kraken-Product | 16px | 500 | 1.38 | normal |
|
||||
| Button | Kraken-Product | 16px | 500–600 | 1.38 | normal |
|
||||
| Caption | Kraken-Product | 14px | 400–700 | 1.43–1.71 | normal |
|
||||
| Small | Kraken-Product | 12px | 400–500 | 1.33 | normal |
|
||||
| Micro | Kraken-Product | 7px | 500 | 1.00 | uppercase |
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary Purple**
|
||||
- Background: `#7132f5`
|
||||
- Text: `#ffffff`
|
||||
- Padding: 13px 16px
|
||||
- Radius: 12px
|
||||
|
||||
**Purple Outlined**
|
||||
- Background: `#ffffff`
|
||||
- Text: `#5741d8`
|
||||
- Border: `1px solid #5741d8`
|
||||
- Radius: 12px
|
||||
|
||||
**Purple Subtle**
|
||||
- Background: `rgba(133,91,251,0.16)`
|
||||
- Text: `#7132f5`
|
||||
- Padding: 8px
|
||||
- Radius: 12px
|
||||
|
||||
**White Button**
|
||||
- Background: `#ffffff`
|
||||
- Text: `#101114`
|
||||
- Radius: 10px
|
||||
- Shadow: `rgba(0,0,0,0.03) 0px 4px 24px`
|
||||
|
||||
**Secondary Gray**
|
||||
- Background: `rgba(148,151,169,0.08)`
|
||||
- Text: `#101114`
|
||||
- Radius: 12px
|
||||
|
||||
### Badges
|
||||
- Success: `rgba(20,158,97,0.16)` bg, `#026b3f` text, 6px radius
|
||||
- Neutral: `rgba(104,107,130,0.12)` bg, `#484b5e` text, 8px radius
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing: 1px, 2px, 3px, 4px, 5px, 6px, 8px, 10px, 12px, 13px, 15px, 16px, 20px, 24px, 25px
|
||||
### Border Radius: 3px, 6px, 8px, 10px, 12px, 16px, 9999px, 50%
|
||||
|
||||
## 6. Depth & Elevation
|
||||
- Subtle: `rgba(0,0,0,0.03) 0px 4px 24px`
|
||||
- Micro: `rgba(16,24,40,0.04) 0px 1px 4px`
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use Kraken Purple (#7132f5) for CTAs and links
|
||||
- Apply 12px radius on all buttons
|
||||
- Use Kraken-Brand for headings, Kraken-Product for body
|
||||
|
||||
### Don't
|
||||
- Don't use pill buttons — 12px is the max radius for buttons
|
||||
- Don't use other purples outside the defined scale
|
||||
|
||||
## 8. Responsive Behavior
|
||||
Breakpoints: 375px, 425px, 640px, 768px, 1024px, 1280px, 1536px
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Brand: Kraken Purple (`#7132f5`)
|
||||
- Dark variant: `#5741d8`
|
||||
- Text: Near Black (`#101114`)
|
||||
- Secondary text: `#9497a9`
|
||||
- Background: White (`#ffffff`)
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create hero: white background. Kraken-Brand 48px weight 700, letter-spacing -1px. Purple CTA (#7132f5, 12px radius, 13px 16px padding)."
|
||||
380
skills/creative/popular-web-designs/templates/linear.app.md
Normal file
380
skills/creative/popular-web-designs/templates/linear.app.md
Normal file
@@ -0,0 +1,380 @@
|
||||
# Design System: Linear
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Linear's website is a masterclass in dark-mode-first product design — a near-black canvas (`#08090a`) where content emerges from darkness like starlight. The overall impression is one of extreme precision engineering: every element exists in a carefully calibrated hierarchy of luminance, from barely-visible borders (`rgba(255,255,255,0.05)`) to soft, luminous text (`#f7f8f8`). This is not a dark theme applied to a light design — it is darkness as the native medium, where information density is managed through subtle gradations of white opacity rather than color variation.
|
||||
|
||||
The typography system is built entirely on Inter Variable with OpenType features `"cv01"` and `"ss03"` enabled globally, giving the typeface a cleaner, more geometric character. Inter is used at a remarkable range of weights — from 300 (light body) through 510 (medium, Linear's signature weight) to 590 (semibold emphasis). The 510 weight is particularly distinctive: it sits between regular and medium, creating a subtle emphasis that doesn't shout. At display sizes (72px, 64px, 48px), Inter uses aggressive negative letter-spacing (-1.584px to -1.056px), creating compressed, authoritative headlines that feel engineered rather than designed. Berkeley Mono serves as the monospace companion for code and technical labels, with fallbacks to ui-monospace, SF Mono, and Menlo.
|
||||
|
||||
The color system is almost entirely achromatic — dark backgrounds with white/gray text — punctuated by a single brand accent: Linear's signature indigo-violet (`#5e6ad2` for backgrounds, `#7170ff` for interactive accents). This accent color is used sparingly and intentionally, appearing only on CTAs, active states, and brand elements. The border system uses ultra-thin, semi-transparent white borders (`rgba(255,255,255,0.05)` to `rgba(255,255,255,0.08)`) that create structure without visual noise, like wireframes drawn in moonlight.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Dark-mode-native: `#08090a` marketing background, `#0f1011` panel background, `#191a1b` elevated surfaces
|
||||
- Inter Variable with `"cv01", "ss03"` globally — geometric alternates for a cleaner aesthetic
|
||||
- Signature weight 510 (between regular and medium) for most UI text
|
||||
- Aggressive negative letter-spacing at display sizes (-1.584px at 72px, -1.056px at 48px)
|
||||
- Brand indigo-violet: `#5e6ad2` (bg) / `#7170ff` (accent) / `#828fff` (hover) — the only chromatic color in the system
|
||||
- Semi-transparent white borders throughout: `rgba(255,255,255,0.05)` to `rgba(255,255,255,0.08)`
|
||||
- Button backgrounds at near-zero opacity: `rgba(255,255,255,0.02)` to `rgba(255,255,255,0.05)`
|
||||
- Multi-layered shadows with inset variants for depth on dark surfaces
|
||||
- Radix UI primitives as the component foundation (6 detected primitives)
|
||||
- Success green (`#27a644`, `#10b981`) used only for status indicators
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Background Surfaces
|
||||
- **Marketing Black** (`#010102` / `#08090a`): The deepest background — the canvas for hero sections and marketing pages. Near-pure black with an imperceptible blue-cool undertone.
|
||||
- **Panel Dark** (`#0f1011`): Sidebar and panel backgrounds. One step up from the marketing black.
|
||||
- **Level 3 Surface** (`#191a1b`): Elevated surface areas, card backgrounds, dropdowns.
|
||||
- **Secondary Surface** (`#28282c`): The lightest dark surface — used for hover states and slightly elevated components.
|
||||
|
||||
### Text & Content
|
||||
- **Primary Text** (`#f7f8f8`): Near-white with a barely-warm cast. The default text color — not pure white, preventing eye strain on dark backgrounds.
|
||||
- **Secondary Text** (`#d0d6e0`): Cool silver-gray for body text, descriptions, and secondary content.
|
||||
- **Tertiary Text** (`#8a8f98`): Muted gray for placeholders, metadata, and de-emphasized content.
|
||||
- **Quaternary Text** (`#62666d`): The most subdued text — timestamps, disabled states, subtle labels.
|
||||
|
||||
### Brand & Accent
|
||||
- **Brand Indigo** (`#5e6ad2`): Primary brand color — used for CTA button backgrounds, brand marks, and key interactive surfaces.
|
||||
- **Accent Violet** (`#7170ff`): Brighter variant for interactive elements — links, active states, selected items.
|
||||
- **Accent Hover** (`#828fff`): Lighter, more saturated variant for hover states on accent elements.
|
||||
- **Security Lavender** (`#7a7fad`): Muted indigo used specifically for security-related UI elements.
|
||||
|
||||
### Status Colors
|
||||
- **Green** (`#27a644`): Primary success/active status. Used for "in progress" indicators.
|
||||
- **Emerald** (`#10b981`): Secondary success — pill badges, completion states.
|
||||
|
||||
### Border & Divider
|
||||
- **Border Primary** (`#23252a`): Solid dark border for prominent separations.
|
||||
- **Border Secondary** (`#34343a`): Slightly lighter solid border.
|
||||
- **Border Tertiary** (`#3e3e44`): Lightest solid border variant.
|
||||
- **Border Subtle** (`rgba(255,255,255,0.05)`): Ultra-subtle semi-transparent border — the default.
|
||||
- **Border Standard** (`rgba(255,255,255,0.08)`): Standard semi-transparent border for cards, inputs, code blocks.
|
||||
- **Line Tint** (`#141516`): Nearly invisible line for the subtlest divisions.
|
||||
- **Line Tertiary** (`#18191a`): Slightly more visible divider line.
|
||||
|
||||
### Light Mode Neutrals (for light theme contexts)
|
||||
- **Light Background** (`#f7f8f8`): Page background in light mode.
|
||||
- **Light Surface** (`#f3f4f5` / `#f5f6f7`): Subtle surface tinting.
|
||||
- **Light Border** (`#d0d6e0`): Visible border in light contexts.
|
||||
- **Light Border Alt** (`#e6e6e6`): Alternative lighter border.
|
||||
- **Pure White** (`#ffffff`): Card surfaces, highlights.
|
||||
|
||||
### Overlay
|
||||
- **Overlay Primary** (`rgba(0,0,0,0.85)`): Modal/dialog backdrop — extremely dark for focus isolation.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Primary**: `Inter Variable`, with fallbacks: `SF Pro Display, -apple-system, system-ui, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Open Sans, Helvetica Neue`
|
||||
- **Monospace**: `Berkeley Mono`, with fallbacks: `ui-monospace, SF Mono, Menlo`
|
||||
- **OpenType Features**: `"cv01", "ss03"` enabled globally — cv01 provides an alternate lowercase 'a' (single-story), ss03 adjusts specific letterforms for a cleaner geometric appearance.
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display XL | Inter Variable | 72px (4.50rem) | 510 | 1.00 (tight) | -1.584px | Hero headlines, maximum impact |
|
||||
| Display Large | Inter Variable | 64px (4.00rem) | 510 | 1.00 (tight) | -1.408px | Secondary hero text |
|
||||
| Display | Inter Variable | 48px (3.00rem) | 510 | 1.00 (tight) | -1.056px | Section headlines |
|
||||
| Heading 1 | Inter Variable | 32px (2.00rem) | 400 | 1.13 (tight) | -0.704px | Major section titles |
|
||||
| Heading 2 | Inter Variable | 24px (1.50rem) | 400 | 1.33 | -0.288px | Sub-section headings |
|
||||
| Heading 3 | Inter Variable | 20px (1.25rem) | 590 | 1.33 | -0.24px | Feature titles, card headers |
|
||||
| Body Large | Inter Variable | 18px (1.13rem) | 400 | 1.60 (relaxed) | -0.165px | Introduction text, feature descriptions |
|
||||
| Body Emphasis | Inter Variable | 17px (1.06rem) | 590 | 1.60 (relaxed) | normal | Emphasized body, sub-headings in content |
|
||||
| Body | Inter Variable | 16px (1.00rem) | 400 | 1.50 | normal | Standard reading text |
|
||||
| Body Medium | Inter Variable | 16px (1.00rem) | 510 | 1.50 | normal | Navigation, labels |
|
||||
| Body Semibold | Inter Variable | 16px (1.00rem) | 590 | 1.50 | normal | Strong emphasis |
|
||||
| Small | Inter Variable | 15px (0.94rem) | 400 | 1.60 (relaxed) | -0.165px | Secondary body text |
|
||||
| Small Medium | Inter Variable | 15px (0.94rem) | 510 | 1.60 (relaxed) | -0.165px | Emphasized small text |
|
||||
| Small Semibold | Inter Variable | 15px (0.94rem) | 590 | 1.60 (relaxed) | -0.165px | Strong small text |
|
||||
| Small Light | Inter Variable | 15px (0.94rem) | 300 | 1.47 | -0.165px | De-emphasized body |
|
||||
| Caption Large | Inter Variable | 14px (0.88rem) | 510–590 | 1.50 | -0.182px | Sub-labels, category headers |
|
||||
| Caption | Inter Variable | 13px (0.81rem) | 400–510 | 1.50 | -0.13px | Metadata, timestamps |
|
||||
| Label | Inter Variable | 12px (0.75rem) | 400–590 | 1.40 | normal | Button text, small labels |
|
||||
| Micro | Inter Variable | 11px (0.69rem) | 510 | 1.40 | normal | Tiny labels |
|
||||
| Tiny | Inter Variable | 10px (0.63rem) | 400–510 | 1.50 | -0.15px | Overline text, sometimes uppercase |
|
||||
| Link Large | Inter Variable | 16px (1.00rem) | 400 | 1.50 | normal | Standard links |
|
||||
| Link Medium | Inter Variable | 15px (0.94rem) | 510 | 2.67 | normal | Spaced navigation links |
|
||||
| Link Small | Inter Variable | 14px (0.88rem) | 510 | 1.50 | normal | Compact links |
|
||||
| Link Caption | Inter Variable | 13px (0.81rem) | 400–510 | 1.50 | -0.13px | Footer, metadata links |
|
||||
| Mono Body | Berkeley Mono | 14px (0.88rem) | 400 | 1.50 | normal | Code blocks |
|
||||
| Mono Caption | Berkeley Mono | 13px (0.81rem) | 400 | 1.50 | normal | Code labels |
|
||||
| Mono Label | Berkeley Mono | 12px (0.75rem) | 400 | 1.40 | normal | Code metadata, sometimes uppercase |
|
||||
|
||||
### Principles
|
||||
- **510 is the signature weight**: Linear uses Inter Variable's 510 weight (between regular 400 and medium 500) as its default emphasis weight. This creates a subtly bolded feel without the heaviness of traditional medium or semibold.
|
||||
- **Compression at scale**: Display sizes use progressively tighter letter-spacing — -1.584px at 72px, -1.408px at 64px, -1.056px at 48px, -0.704px at 32px. Below 24px, spacing relaxes toward normal.
|
||||
- **OpenType as identity**: `"cv01", "ss03"` aren't decorative — they transform Inter into Linear's distinctive typeface, giving it a more geometric, purposeful character.
|
||||
- **Three-tier weight system**: 400 (reading), 510 (emphasis/UI), 590 (strong emphasis). The 300 weight appears only in deliberately de-emphasized contexts.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Ghost Button (Default)**
|
||||
- Background: `rgba(255,255,255,0.02)`
|
||||
- Text: `#e2e4e7` (near-white)
|
||||
- Padding: comfortable
|
||||
- Radius: 6px
|
||||
- Border: `1px solid rgb(36, 40, 44)`
|
||||
- Outline: none
|
||||
- Focus shadow: `rgba(0,0,0,0.1) 0px 4px 12px`
|
||||
- Use: Standard actions, secondary CTAs
|
||||
|
||||
**Subtle Button**
|
||||
- Background: `rgba(255,255,255,0.04)`
|
||||
- Text: `#d0d6e0` (silver-gray)
|
||||
- Padding: 0px 6px
|
||||
- Radius: 6px
|
||||
- Use: Toolbar actions, contextual buttons
|
||||
|
||||
**Primary Brand Button (Inferred)**
|
||||
- Background: `#5e6ad2` (brand indigo)
|
||||
- Text: `#ffffff`
|
||||
- Padding: 8px 16px
|
||||
- Radius: 6px
|
||||
- Hover: `#828fff` shift
|
||||
- Use: Primary CTAs ("Start building", "Sign up")
|
||||
|
||||
**Icon Button (Circle)**
|
||||
- Background: `rgba(255,255,255,0.03)` or `rgba(255,255,255,0.05)`
|
||||
- Text: `#f7f8f8` or `#ffffff`
|
||||
- Radius: 50%
|
||||
- Border: `1px solid rgba(255,255,255,0.08)`
|
||||
- Use: Close, menu toggle, icon-only actions
|
||||
|
||||
**Pill Button**
|
||||
- Background: transparent
|
||||
- Text: `#d0d6e0`
|
||||
- Padding: 0px 10px 0px 5px
|
||||
- Radius: 9999px
|
||||
- Border: `1px solid rgb(35, 37, 42)`
|
||||
- Use: Filter chips, tags, status indicators
|
||||
|
||||
**Small Toolbar Button**
|
||||
- Background: `rgba(255,255,255,0.05)`
|
||||
- Text: `#62666d` (muted)
|
||||
- Radius: 2px
|
||||
- Border: `1px solid rgba(255,255,255,0.05)`
|
||||
- Shadow: `rgba(0,0,0,0.03) 0px 1.2px 0px 0px`
|
||||
- Font: 12px weight 510
|
||||
- Use: Toolbar actions, quick-access controls
|
||||
|
||||
### Cards & Containers
|
||||
- Background: `rgba(255,255,255,0.02)` to `rgba(255,255,255,0.05)` (never solid — always translucent)
|
||||
- Border: `1px solid rgba(255,255,255,0.08)` (standard) or `1px solid rgba(255,255,255,0.05)` (subtle)
|
||||
- Radius: 8px (standard), 12px (featured), 22px (large panels)
|
||||
- Shadow: `rgba(0,0,0,0.2) 0px 0px 0px 1px` or layered multi-shadow stacks
|
||||
- Hover: subtle background opacity increase
|
||||
|
||||
### Inputs & Forms
|
||||
|
||||
**Text Area**
|
||||
- Background: `rgba(255,255,255,0.02)`
|
||||
- Text: `#d0d6e0`
|
||||
- Border: `1px solid rgba(255,255,255,0.08)`
|
||||
- Padding: 12px 14px
|
||||
- Radius: 6px
|
||||
|
||||
**Search Input**
|
||||
- Background: transparent
|
||||
- Text: `#f7f8f8`
|
||||
- Padding: 1px 32px (icon-aware)
|
||||
|
||||
**Button-style Input**
|
||||
- Text: `#8a8f98`
|
||||
- Padding: 1px 6px
|
||||
- Radius: 5px
|
||||
- Focus shadow: multi-layer stack
|
||||
|
||||
### Badges & Pills
|
||||
|
||||
**Success Pill**
|
||||
- Background: `#10b981`
|
||||
- Text: `#f7f8f8`
|
||||
- Radius: 50% (circular)
|
||||
- Font: 10px weight 510
|
||||
- Use: Status dots, completion indicators
|
||||
|
||||
**Neutral Pill**
|
||||
- Background: transparent
|
||||
- Text: `#d0d6e0`
|
||||
- Padding: 0px 10px 0px 5px
|
||||
- Radius: 9999px
|
||||
- Border: `1px solid rgb(35, 37, 42)`
|
||||
- Font: 12px weight 510
|
||||
- Use: Tags, filter chips, category labels
|
||||
|
||||
**Subtle Badge**
|
||||
- Background: `rgba(255,255,255,0.05)`
|
||||
- Text: `#f7f8f8`
|
||||
- Padding: 0px 8px 0px 2px
|
||||
- Radius: 2px
|
||||
- Border: `1px solid rgba(255,255,255,0.05)`
|
||||
- Font: 10px weight 510
|
||||
- Use: Inline labels, version tags
|
||||
|
||||
### Navigation
|
||||
- Dark sticky header on near-black background
|
||||
- Linear logomark left-aligned (SVG icon)
|
||||
- Links: Inter Variable 13–14px weight 510, `#d0d6e0` text
|
||||
- Active/hover: text lightens to `#f7f8f8`
|
||||
- CTA: Brand indigo button or ghost button
|
||||
- Mobile: hamburger collapse
|
||||
- Search: command palette trigger (`/` or `Cmd+K`)
|
||||
|
||||
### Image Treatment
|
||||
- Product screenshots on dark backgrounds with subtle border (`rgba(255,255,255,0.08)`)
|
||||
- Top-rounded images: `12px 12px 0px 0px` radius
|
||||
- Dashboard/issue previews dominate feature sections
|
||||
- Subtle shadow beneath screenshots: `rgba(0,0,0,0.4) 0px 2px 4px`
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 1px, 4px, 7px, 8px, 11px, 12px, 16px, 19px, 20px, 22px, 24px, 28px, 32px, 35px
|
||||
- The 7px and 11px values suggest micro-adjustments for optical alignment
|
||||
- Primary rhythm: 8px, 16px, 24px, 32px (standard 8px grid)
|
||||
|
||||
### Grid & Container
|
||||
- Max content width: approximately 1200px
|
||||
- Hero: centered single-column with generous vertical padding
|
||||
- Feature sections: 2–3 column grids for feature cards
|
||||
- Full-width dark sections with internal max-width constraints
|
||||
- Changelog: single-column timeline layout
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Darkness as space**: On Linear's dark canvas, empty space isn't white — it's absence. The near-black background IS the whitespace, and content emerges from it.
|
||||
- **Compressed headlines, expanded surroundings**: Display text at 72px with -1.584px tracking is dense and compressed, but sits within vast dark padding. The contrast between typographic density and spatial generosity creates tension.
|
||||
- **Section isolation**: Each feature section is separated by generous vertical padding (80px+) with no visible dividers — the dark background provides natural separation.
|
||||
|
||||
### Border Radius Scale
|
||||
- Micro (2px): Inline badges, toolbar buttons, subtle tags
|
||||
- Standard (4px): Small containers, list items
|
||||
- Comfortable (6px): Buttons, inputs, functional elements
|
||||
- Card (8px): Cards, dropdowns, popovers
|
||||
- Panel (12px): Panels, featured cards, section containers
|
||||
- Large (22px): Large panel elements
|
||||
- Full Pill (9999px): Chips, filter pills, status tags
|
||||
- Circle (50%): Icon buttons, avatars, status dots
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow, `#010102` bg | Page background, deepest canvas |
|
||||
| Subtle (Level 1) | `rgba(0,0,0,0.03) 0px 1.2px 0px` | Toolbar buttons, micro-elevation |
|
||||
| Surface (Level 2) | `rgba(255,255,255,0.05)` bg + `1px solid rgba(255,255,255,0.08)` border | Cards, input fields, containers |
|
||||
| Inset (Level 2b) | `rgba(0,0,0,0.2) 0px 0px 12px 0px inset` | Recessed panels, inner shadows |
|
||||
| Ring (Level 3) | `rgba(0,0,0,0.2) 0px 0px 0px 1px` | Border-as-shadow technique |
|
||||
| Elevated (Level 4) | `rgba(0,0,0,0.4) 0px 2px 4px` | Floating elements, dropdowns |
|
||||
| Dialog (Level 5) | Multi-layer stack: `rgba(0,0,0,0) 0px 8px 2px, rgba(0,0,0,0.01) 0px 5px 2px, rgba(0,0,0,0.04) 0px 3px 2px, rgba(0,0,0,0.07) 0px 1px 1px, rgba(0,0,0,0.08) 0px 0px 1px` | Popovers, command palette, modals |
|
||||
| Focus | `rgba(0,0,0,0.1) 0px 4px 12px` + additional layers | Keyboard focus on interactive elements |
|
||||
|
||||
**Shadow Philosophy**: On dark surfaces, traditional shadows (dark on dark) are nearly invisible. Linear solves this by using semi-transparent white borders as the primary depth indicator. Elevation isn't communicated through shadow darkness but through background luminance steps — each level slightly increases the white opacity of the surface background (`0.02` → `0.04` → `0.05`), creating a subtle stacking effect. The inset shadow technique (`rgba(0,0,0,0.2) 0px 0px 12px 0px inset`) creates a unique "sunken" effect for recessed panels, adding dimensional depth that traditional dark themes lack.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use Inter Variable with `"cv01", "ss03"` on ALL text — these features are fundamental to Linear's typeface identity
|
||||
- Use weight 510 as your default emphasis weight — it's Linear's signature between-weight
|
||||
- Apply aggressive negative letter-spacing at display sizes (-1.584px at 72px, -1.056px at 48px)
|
||||
- Build on near-black backgrounds: `#08090a` for marketing, `#0f1011` for panels, `#191a1b` for elevated surfaces
|
||||
- Use semi-transparent white borders (`rgba(255,255,255,0.05)` to `rgba(255,255,255,0.08)`) instead of solid dark borders
|
||||
- Keep button backgrounds nearly transparent: `rgba(255,255,255,0.02)` to `rgba(255,255,255,0.05)`
|
||||
- Reserve brand indigo (`#5e6ad2` / `#7170ff`) for primary CTAs and interactive accents only
|
||||
- Use `#f7f8f8` for primary text — not pure `#ffffff`, which would be too harsh
|
||||
- Apply the luminance stacking model: deeper = darker bg, elevated = slightly lighter bg
|
||||
|
||||
### Don't
|
||||
- Don't use pure white (`#ffffff`) as primary text — `#f7f8f8` prevents eye strain
|
||||
- Don't use solid colored backgrounds for buttons — transparency is the system (rgba white at 0.02–0.05)
|
||||
- Don't apply the brand indigo decoratively — it's reserved for interactive/CTA elements only
|
||||
- Don't use positive letter-spacing on display text — Inter at large sizes always runs negative
|
||||
- Don't use visible/opaque borders on dark backgrounds — borders should be whisper-thin semi-transparent white
|
||||
- Don't skip the OpenType features (`"cv01", "ss03"`) — without them, it's generic Inter, not Linear's Inter
|
||||
- Don't use weight 700 (bold) — Linear's maximum weight is 590, with 510 as the workhorse
|
||||
- Don't introduce warm colors into the UI chrome — the palette is cool gray with blue-violet accent only
|
||||
- Don't use drop shadows for elevation on dark surfaces — use background luminance stepping instead
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile Small | <600px | Single column, compact padding |
|
||||
| Mobile | 600–640px | Standard mobile layout |
|
||||
| Tablet | 640–768px | Two-column grids begin |
|
||||
| Desktop Small | 768–1024px | Full card grids, expanded padding |
|
||||
| Desktop | 1024–1280px | Standard desktop, full navigation |
|
||||
| Large Desktop | >1280px | Full layout, generous margins |
|
||||
|
||||
### Touch Targets
|
||||
- Buttons use comfortable padding with 6px radius minimum
|
||||
- Navigation links at 13–14px with adequate spacing
|
||||
- Pill tags have 10px horizontal padding for touch accessibility
|
||||
- Icon buttons at 50% radius ensure circular, easy-to-tap targets
|
||||
- Search trigger is prominently placed with generous hit area
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero: 72px → 48px → 32px display text, tracking adjusts proportionally
|
||||
- Navigation: horizontal links + CTAs → hamburger menu at 768px
|
||||
- Feature cards: 3-column → 2-column → single column stacked
|
||||
- Product screenshots: maintain aspect ratio, may reduce padding
|
||||
- Changelog: timeline maintains single-column through all sizes
|
||||
- Footer: multi-column → stacked single column
|
||||
- Section spacing: 80px+ → 48px on mobile
|
||||
|
||||
### Image Behavior
|
||||
- Dashboard screenshots maintain border treatment at all sizes
|
||||
- Hero visuals simplify on mobile (fewer floating UI elements)
|
||||
- Product screenshots use responsive sizing with consistent radius
|
||||
- Dark background ensures screenshots blend naturally at any viewport
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary CTA: Brand Indigo (`#5e6ad2`)
|
||||
- Page Background: Marketing Black (`#08090a`)
|
||||
- Panel Background: Panel Dark (`#0f1011`)
|
||||
- Surface: Level 3 (`#191a1b`)
|
||||
- Heading text: Primary White (`#f7f8f8`)
|
||||
- Body text: Silver Gray (`#d0d6e0`)
|
||||
- Muted text: Tertiary Gray (`#8a8f98`)
|
||||
- Subtle text: Quaternary Gray (`#62666d`)
|
||||
- Accent: Violet (`#7170ff`)
|
||||
- Accent Hover: Light Violet (`#828fff`)
|
||||
- Border (default): `rgba(255,255,255,0.08)`
|
||||
- Border (subtle): `rgba(255,255,255,0.05)`
|
||||
- Focus ring: Multi-layer shadow stack
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on `#08090a` background. Headline at 48px Inter Variable weight 510, line-height 1.00, letter-spacing -1.056px, color `#f7f8f8`, font-feature-settings `'cv01', 'ss03'`. Subtitle at 18px weight 400, line-height 1.60, color `#8a8f98`. Brand CTA button (`#5e6ad2`, 6px radius, 8px 16px padding) and ghost button (`rgba(255,255,255,0.02)` bg, `1px solid rgba(255,255,255,0.08)` border, 6px radius)."
|
||||
- "Design a card on dark background: `rgba(255,255,255,0.02)` background, `1px solid rgba(255,255,255,0.08)` border, 8px radius. Title at 20px Inter Variable weight 590, letter-spacing -0.24px, color `#f7f8f8`. Body at 15px weight 400, color `#8a8f98`, letter-spacing -0.165px."
|
||||
- "Build a pill badge: transparent background, `#d0d6e0` text, 9999px radius, 0px 10px padding, `1px solid #23252a` border, 12px Inter Variable weight 510."
|
||||
- "Create navigation: dark sticky header on `#0f1011`. Inter Variable 13px weight 510 for links, `#d0d6e0` text. Brand indigo CTA `#5e6ad2` right-aligned with 6px radius. Bottom border: `1px solid rgba(255,255,255,0.05)`."
|
||||
- "Design a command palette: `#191a1b` background, `1px solid rgba(255,255,255,0.08)` border, 12px radius, multi-layer shadow stack. Input at 16px Inter Variable weight 400, `#f7f8f8` text. Results list with 13px weight 510 labels in `#d0d6e0` and 12px metadata in `#62666d`."
|
||||
|
||||
### Iteration Guide
|
||||
1. Always set font-feature-settings `"cv01", "ss03"` on all Inter text — this is non-negotiable for Linear's look
|
||||
2. Letter-spacing scales with font size: -1.584px at 72px, -1.056px at 48px, -0.704px at 32px, normal below 16px
|
||||
3. Three weights: 400 (read), 510 (emphasize/navigate), 590 (announce)
|
||||
4. Surface elevation via background opacity: `rgba(255,255,255, 0.02 → 0.04 → 0.05)` — never solid backgrounds on dark
|
||||
5. Brand indigo (`#5e6ad2` / `#7170ff`) is the only chromatic color — everything else is grayscale
|
||||
6. Borders are always semi-transparent white, never solid dark colors on dark backgrounds
|
||||
7. Berkeley Mono for any code or technical content, Inter Variable for everything else
|
||||
311
skills/creative/popular-web-designs/templates/lovable.md
Normal file
311
skills/creative/popular-web-designs/templates/lovable.md
Normal file
@@ -0,0 +1,311 @@
|
||||
# Design System: Lovable
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `DM Sans` | **Mono:** `system monospace stack`
|
||||
> - **Font stack (CSS):** `font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Lovable's website radiates warmth through restraint. The entire page sits on a creamy, parchment-toned background (`#f7f4ed`) that immediately separates it from the cold-white conventions of most developer tool sites. This isn't minimalism for minimalism's sake — it's a deliberate choice to feel approachable, almost analog, like a well-crafted notebook. The near-black text (`#1c1c1c`) against this warm cream creates a contrast ratio that's easy on the eyes while maintaining sharp readability.
|
||||
|
||||
The custom Camera Plain Variable typeface is the system's secret weapon. Unlike geometric sans-serifs that signal "tech company," Camera Plain has a humanist warmth — slightly rounded terminals, organic curves, and a comfortable reading rhythm. At display sizes (48px–60px), weight 600 with aggressive negative letter-spacing (-0.9px to -1.5px) compresses headlines into confident, editorial statements. The font uses `ui-sans-serif, system-ui` as fallbacks, acknowledging that the custom typeface carries the brand personality.
|
||||
|
||||
What makes Lovable's visual system distinctive is its opacity-driven depth model. Rather than using a traditional gray scale, the system modulates `#1c1c1c` at varying opacities (0.03, 0.04, 0.4, 0.82–0.83) to create a unified tonal range. Every shade of gray on the page is technically the same hue — just more or less transparent. This creates a visual coherence that's nearly impossible to achieve with arbitrary hex values. The border system follows suit: `1px solid #eceae4` for light divisions and `1px solid rgba(28, 28, 28, 0.4)` for stronger interactive boundaries.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Warm parchment background (`#f7f4ed`) — not white, not beige, a deliberate cream that feels hand-selected
|
||||
- Camera Plain Variable typeface with humanist warmth and editorial letter-spacing at display sizes
|
||||
- Opacity-driven color system: all grays derived from `#1c1c1c` at varying transparency levels
|
||||
- Inset shadow technique on buttons: `rgba(255,255,255,0.2) 0px 0.5px 0px 0px inset, rgba(0,0,0,0.2) 0px 0px 0px 0.5px inset`
|
||||
- Warm neutral border palette: `#eceae4` for subtle, `rgba(28,28,28,0.4)` for interactive elements
|
||||
- Full-pill radius (`9999px`) used extensively for action buttons and icon containers
|
||||
- Focus state uses `rgba(0,0,0,0.1) 0px 4px 12px` shadow for soft, warm emphasis
|
||||
- shadcn/ui + Radix UI component primitives with Tailwind CSS utility styling
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Cream** (`#f7f4ed`): Page background, card surfaces, button surfaces. The foundation — warm, paper-like, human.
|
||||
- **Charcoal** (`#1c1c1c`): Primary text, headings, dark button backgrounds. Not pure black — organic warmth.
|
||||
- **Off-White** (`#fcfbf8`): Button text on dark backgrounds, subtle highlight. Barely distinguishable from pure white.
|
||||
|
||||
### Neutral Scale (Opacity-Based)
|
||||
- **Charcoal 100%** (`#1c1c1c`): Primary text, headings, dark surfaces.
|
||||
- **Charcoal 83%** (`rgba(28,28,28,0.83)`): Strong secondary text.
|
||||
- **Charcoal 82%** (`rgba(28,28,28,0.82)`): Body copy.
|
||||
- **Muted Gray** (`#5f5f5d`): Secondary text, descriptions, captions.
|
||||
- **Charcoal 40%** (`rgba(28,28,28,0.4)`): Interactive borders, button outlines.
|
||||
- **Charcoal 4%** (`rgba(28,28,28,0.04)`): Subtle hover backgrounds, micro-tints.
|
||||
- **Charcoal 3%** (`rgba(28,28,28,0.03)`): Barely-visible overlays, background depth.
|
||||
|
||||
### Surface & Border
|
||||
- **Light Cream** (`#eceae4`): Card borders, dividers, image outlines. The warm divider line.
|
||||
- **Cream Surface** (`#f7f4ed`): Card backgrounds, section fills — same as page background for seamless integration.
|
||||
|
||||
### Interactive
|
||||
- **Ring Blue** (`#3b82f6` at 50% opacity): `--tw-ring-color`, Tailwind focus ring.
|
||||
- **Focus Shadow** (`rgba(0,0,0,0.1) 0px 4px 12px`): Focus and active state shadow — soft, warm, diffused.
|
||||
|
||||
### Inset Shadows
|
||||
- **Button Inset** (`rgba(255,255,255,0.2) 0px 0.5px 0px 0px inset, rgba(0,0,0,0.2) 0px 0px 0px 0.5px inset, rgba(0,0,0,0.05) 0px 1px 2px 0px`): The signature multi-layer inset shadow on dark buttons.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Primary**: `Camera Plain Variable`, with fallbacks: `ui-sans-serif, system-ui`
|
||||
- **Weight range**: 400 (body/reading), 480 (special display), 600 (headings/emphasis)
|
||||
- **Feature**: Variable font with continuous weight axis — allows fine-tuned intermediary weights like 480.
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | Camera Plain Variable | 60px (3.75rem) | 600 | 1.00–1.10 (tight) | -1.5px | Maximum impact, editorial |
|
||||
| Display Alt | Camera Plain Variable | 60px (3.75rem) | 480 | 1.00 (tight) | normal | Lighter hero variant |
|
||||
| Section Heading | Camera Plain Variable | 48px (3.00rem) | 600 | 1.00 (tight) | -1.2px | Feature section titles |
|
||||
| Sub-heading | Camera Plain Variable | 36px (2.25rem) | 600 | 1.10 (tight) | -0.9px | Sub-sections |
|
||||
| Card Title | Camera Plain Variable | 20px (1.25rem) | 400 | 1.25 (tight) | normal | Card headings |
|
||||
| Body Large | Camera Plain Variable | 18px (1.13rem) | 400 | 1.38 | normal | Introductions |
|
||||
| Body | Camera Plain Variable | 16px (1.00rem) | 400 | 1.50 | normal | Standard reading text |
|
||||
| Button | Camera Plain Variable | 16px (1.00rem) | 400 | 1.50 | normal | Button labels |
|
||||
| Button Small | Camera Plain Variable | 14px (0.88rem) | 400 | 1.50 | normal | Compact buttons |
|
||||
| Link | Camera Plain Variable | 16px (1.00rem) | 400 | 1.50 | normal | Underline decoration |
|
||||
| Link Small | Camera Plain Variable | 14px (0.88rem) | 400 | 1.50 | normal | Footer links |
|
||||
| Caption | Camera Plain Variable | 14px (0.88rem) | 400 | 1.50 | normal | Metadata, small text |
|
||||
|
||||
### Principles
|
||||
- **Warm humanist voice**: Camera Plain Variable gives Lovable its approachable personality. The slightly rounded terminals and organic curves contrast with the sharp geometric sans-serifs used by most developer tools.
|
||||
- **Variable weight as design tool**: The font supports continuous weight values (e.g., 480), enabling nuanced hierarchy beyond standard weight stops. Weight 480 at 60px creates a display style that feels lighter than semibold but stronger than regular.
|
||||
- **Compression at scale**: Headlines use negative letter-spacing (-0.9px to -1.5px) for editorial impact. Body text stays at normal tracking for comfortable reading.
|
||||
- **Two weights, clear roles**: 400 (body/UI/links/buttons) and 600 (headings/emphasis). The narrow weight range creates hierarchy through size and spacing, not weight variation.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary Dark (Inset Shadow)**
|
||||
- Background: `#1c1c1c`
|
||||
- Text: `#fcfbf8`
|
||||
- Padding: 8px 16px
|
||||
- Radius: 6px
|
||||
- Shadow: `rgba(0,0,0,0) 0px 0px 0px 0px, rgba(0,0,0,0) 0px 0px 0px 0px, rgba(255,255,255,0.2) 0px 0.5px 0px 0px inset, rgba(0,0,0,0.2) 0px 0px 0px 0.5px inset, rgba(0,0,0,0.05) 0px 1px 2px 0px`
|
||||
- Active: opacity 0.8
|
||||
- Focus: `rgba(0,0,0,0.1) 0px 4px 12px` shadow
|
||||
- Use: Primary CTA ("Start Building", "Get Started")
|
||||
|
||||
**Ghost / Outline**
|
||||
- Background: transparent
|
||||
- Text: `#1c1c1c`
|
||||
- Padding: 8px 16px
|
||||
- Radius: 6px
|
||||
- Border: `1px solid rgba(28,28,28,0.4)`
|
||||
- Active: opacity 0.8
|
||||
- Focus: `rgba(0,0,0,0.1) 0px 4px 12px` shadow
|
||||
- Use: Secondary actions ("Log In", "Documentation")
|
||||
|
||||
**Cream Surface**
|
||||
- Background: `#f7f4ed`
|
||||
- Text: `#1c1c1c`
|
||||
- Padding: 8px 16px
|
||||
- Radius: 6px
|
||||
- No border
|
||||
- Active: opacity 0.8
|
||||
- Use: Tertiary actions, toolbar buttons
|
||||
|
||||
**Pill / Icon Button**
|
||||
- Background: `#f7f4ed`
|
||||
- Text: `#1c1c1c`
|
||||
- Radius: 9999px (full pill)
|
||||
- Shadow: same inset pattern as primary dark
|
||||
- Opacity: 0.5 (default), 0.8 (active)
|
||||
- Use: Additional actions, plan mode toggle, voice recording
|
||||
|
||||
### Cards & Containers
|
||||
- Background: `#f7f4ed` (matches page)
|
||||
- Border: `1px solid #eceae4`
|
||||
- Radius: 12px (standard), 16px (featured), 8px (compact)
|
||||
- No box-shadow by default — borders define boundaries
|
||||
- Image cards: `1px solid #eceae4` with 12px radius
|
||||
|
||||
### Inputs & Forms
|
||||
- Background: `#f7f4ed`
|
||||
- Text: `#1c1c1c`
|
||||
- Border: `1px solid #eceae4`
|
||||
- Radius: 6px
|
||||
- Focus: ring blue (`rgba(59,130,246,0.5)`) outline
|
||||
- Placeholder: `#5f5f5d`
|
||||
|
||||
### Navigation
|
||||
- Clean horizontal nav on cream background, fixed
|
||||
- Logo/wordmark left-aligned (128.75 x 22px)
|
||||
- Links: Camera Plain 14–16px weight 400, `#1c1c1c` text
|
||||
- CTA: dark button with inset shadow, 6px radius
|
||||
- Mobile: hamburger menu with 6px radius button
|
||||
- Subtle border or no border on scroll
|
||||
|
||||
### Links
|
||||
- Color: `#1c1c1c`
|
||||
- Decoration: underline (default)
|
||||
- Hover: primary accent (via CSS variable `hsl(var(--primary))`)
|
||||
- No color change on hover — decoration carries the interactive signal
|
||||
|
||||
### Image Treatment
|
||||
- Showcase/portfolio images with `1px solid #eceae4` border
|
||||
- Consistent 12px border radius on all image containers
|
||||
- Soft gradient backgrounds behind hero content (warm multi-color wash)
|
||||
- Gallery-style presentation for template/project showcases
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**AI Chat Input**
|
||||
- Large prompt input area with soft borders
|
||||
- Suggestion pills with `#eceae4` borders
|
||||
- Voice recording / plan mode toggle buttons as pill shapes (9999px)
|
||||
- Warm, inviting input area — not clinical
|
||||
|
||||
**Template Gallery**
|
||||
- Card grid showing project templates
|
||||
- Each card: image + title, `1px solid #eceae4` border, 12px radius
|
||||
- Hover: subtle shadow or border darkening
|
||||
- Category labels as text links
|
||||
|
||||
**Stats Bar**
|
||||
- Large metrics: "0M+" pattern in 48px+ weight 600
|
||||
- Descriptive text below in muted gray
|
||||
- Horizontal layout with generous spacing
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 8px, 10px, 12px, 16px, 24px, 32px, 40px, 56px, 80px, 96px, 128px, 176px, 192px, 208px
|
||||
- The scale expands generously at the top end — sections use 80px–208px vertical spacing for editorial breathing room
|
||||
|
||||
### Grid & Container
|
||||
- Max content width: approximately 1200px (centered)
|
||||
- Hero: centered single-column with massive vertical padding (96px+)
|
||||
- Feature sections: 2–3 column grids
|
||||
- Full-width footer with multi-column link layout
|
||||
- Showcase sections with centered card grids
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Editorial generosity**: Lovable's spacing is lavish at section boundaries (80px–208px). The warm cream background makes these expanses feel cozy rather than empty.
|
||||
- **Content-driven rhythm**: Tight internal spacing within cards (12–24px) contrasts with wide section gaps, creating a reading rhythm that alternates between focused content and visual rest.
|
||||
- **Section separation**: Footer uses `1px solid #eceae4` border and 16px radius container. Sections defined by generous spacing rather than border lines.
|
||||
|
||||
### Border Radius Scale
|
||||
- Micro (4px): Small buttons, interactive elements
|
||||
- Standard (6px): Buttons, inputs, navigation menu
|
||||
- Comfortable (8px): Compact cards, divs
|
||||
- Card (12px): Standard cards, image containers, templates
|
||||
- Container (16px): Large containers, footer sections
|
||||
- Full Pill (9999px): Action pills, icon buttons, toggles
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow, cream background | Page surface, most content |
|
||||
| Bordered (Level 1) | `1px solid #eceae4` | Cards, images, dividers |
|
||||
| Inset (Level 2) | `rgba(255,255,255,0.2) 0px 0.5px 0px inset, rgba(0,0,0,0.2) 0px 0px 0px 0.5px inset, rgba(0,0,0,0.05) 0px 1px 2px` | Dark buttons, primary actions |
|
||||
| Focus (Level 3) | `rgba(0,0,0,0.1) 0px 4px 12px` | Active/focus states |
|
||||
| Ring (Accessibility) | `rgba(59,130,246,0.5)` 2px ring | Keyboard focus on inputs |
|
||||
|
||||
**Shadow Philosophy**: Lovable's depth system is intentionally shallow. Instead of floating cards with dramatic drop-shadows, the system relies on warm borders (`#eceae4`) against the cream surface to create gentle containment. The only notable shadow pattern is the inset shadow on dark buttons — a subtle multi-layer technique where a white highlight line sits at the top edge while a dark ring and soft drop handle the bottom. This creates a tactile, pressed-into-surface feeling rather than a hovering-above-surface feeling. The warm focus shadow (`rgba(0,0,0,0.1) 0px 4px 12px`) is deliberately diffused and large, creating a soft glow rather than a sharp outline.
|
||||
|
||||
### Decorative Depth
|
||||
- Hero: soft, warm multi-color gradient wash (pinks, oranges, blues) behind hero — atmospheric, barely visible
|
||||
- Footer: gradient background with warm tones transitioning to the bottom
|
||||
- No harsh section dividers — spacing and background warmth handle transitions
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use the warm cream background (`#f7f4ed`) as the page foundation — it's the brand's signature warmth
|
||||
- Use Camera Plain Variable at display sizes with negative letter-spacing (-0.9px to -1.5px)
|
||||
- Derive all grays from `#1c1c1c` at varying opacity levels for tonal unity
|
||||
- Use the inset shadow technique on dark buttons for tactile depth
|
||||
- Use `#eceae4` borders instead of shadows for card containment
|
||||
- Keep the weight system narrow: 400 for body/UI, 600 for headings
|
||||
- Use full-pill radius (9999px) only for action pills and icon buttons
|
||||
- Apply opacity 0.8 on active states for responsive tactile feedback
|
||||
|
||||
### Don't
|
||||
- Don't use pure white (`#ffffff`) as a page background — the cream is intentional
|
||||
- Don't use heavy box-shadows for cards — borders are the containment mechanism
|
||||
- Don't introduce saturated accent colors — the palette is intentionally warm-neutral
|
||||
- Don't use weight 700 (bold) — 600 is the maximum weight in the system
|
||||
- Don't apply 9999px radius on rectangular buttons — pills are for icon/action toggles
|
||||
- Don't use sharp focus outlines — the system uses soft shadow-based focus indicators
|
||||
- Don't mix border styles — `#eceae4` for passive, `rgba(28,28,28,0.4)` for interactive
|
||||
- Don't increase letter-spacing on headings — Camera Plain is designed to run tight at scale
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile Small | <600px | Tight single column, reduced padding |
|
||||
| Mobile | 600–640px | Standard mobile layout |
|
||||
| Tablet Small | 640–700px | 2-column grids begin |
|
||||
| Tablet | 700–768px | Card grids expand |
|
||||
| Desktop Small | 768–1024px | Multi-column layouts |
|
||||
| Desktop | 1024–1280px | Full feature layout |
|
||||
| Large Desktop | 1280–1536px | Maximum content width, generous margins |
|
||||
|
||||
### Touch Targets
|
||||
- Buttons: 8px 16px padding (comfortable touch)
|
||||
- Navigation: adequate spacing between items
|
||||
- Pill buttons: 9999px radius creates large tap-friendly targets
|
||||
- Menu toggle: 6px radius button with adequate sizing
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero: 60px → 48px → 36px headline scaling with proportional letter-spacing
|
||||
- Navigation: horizontal links → hamburger menu at 768px
|
||||
- Feature cards: 3-column → 2-column → single column stacked
|
||||
- Template gallery: grid → stacked vertical cards
|
||||
- Stats bar: horizontal → stacked vertical
|
||||
- Footer: multi-column → stacked single column
|
||||
- Section spacing: 128px+ → 64px on mobile
|
||||
|
||||
### Image Behavior
|
||||
- Template screenshots maintain `1px solid #eceae4` border at all sizes
|
||||
- 12px border radius preserved across breakpoints
|
||||
- Gallery images responsive with consistent aspect ratios
|
||||
- Hero gradient softens/simplifies on mobile
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary CTA: Charcoal (`#1c1c1c`)
|
||||
- Background: Cream (`#f7f4ed`)
|
||||
- Heading text: Charcoal (`#1c1c1c`)
|
||||
- Body text: Muted Gray (`#5f5f5d`)
|
||||
- Border: `#eceae4` (passive), `rgba(28,28,28,0.4)` (interactive)
|
||||
- Focus: `rgba(0,0,0,0.1) 0px 4px 12px`
|
||||
- Button text on dark: `#fcfbf8`
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on cream background (#f7f4ed). Headline at 60px Camera Plain Variable weight 600, line-height 1.10, letter-spacing -1.5px, color #1c1c1c. Subtitle at 18px weight 400, line-height 1.38, color #5f5f5d. Dark CTA button (#1c1c1c bg, #fcfbf8 text, 6px radius, 8px 16px padding, inset shadow) and ghost button (transparent bg, 1px solid rgba(28,28,28,0.4) border, 6px radius)."
|
||||
- "Design a card on cream (#f7f4ed) background. Border: 1px solid #eceae4. Radius 12px. No box-shadow. Title at 20px Camera Plain Variable weight 400, line-height 1.25, color #1c1c1c. Body at 14px weight 400, color #5f5f5d."
|
||||
- "Build a template gallery: grid of cards with 12px radius, 1px solid #eceae4 border, cream backgrounds. Each card: image with 12px top radius, title below. Hover: subtle border darkening."
|
||||
- "Create navigation: sticky on cream (#f7f4ed). Camera Plain 16px weight 400 for links, #1c1c1c text. Dark CTA button right-aligned with inset shadow. Mobile: hamburger menu with 6px radius."
|
||||
- "Design a stats section: large numbers at 48px Camera Plain weight 600, letter-spacing -1.2px, #1c1c1c. Labels below at 16px weight 400, #5f5f5d. Horizontal layout with 32px gap."
|
||||
|
||||
### Iteration Guide
|
||||
1. Always use cream (`#f7f4ed`) as the base — never pure white
|
||||
2. Derive grays from `#1c1c1c` at opacity levels rather than using distinct hex values
|
||||
3. Use `#eceae4` borders for containment, not shadows
|
||||
4. Letter-spacing scales with size: -1.5px at 60px, -1.2px at 48px, -0.9px at 36px, normal at 16px
|
||||
5. Two weights: 400 (everything except headings) and 600 (headings)
|
||||
6. The inset shadow on dark buttons is the signature detail — don't skip it
|
||||
7. Camera Plain Variable at weight 480 is for special display moments only
|
||||
270
skills/creative/popular-web-designs/templates/minimax.md
Normal file
270
skills/creative/popular-web-designs/templates/minimax.md
Normal file
@@ -0,0 +1,270 @@
|
||||
# Design System: MiniMax
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
MiniMax's website is a clean, product-showcase platform for a Chinese AI technology company that bridges consumer-friendly appeal with technical credibility. The design language is predominantly white-space-driven with a light, airy feel — pure white backgrounds (`#ffffff`) dominate, letting colorful product cards and AI model illustrations serve as the visual anchors. The overall aesthetic sits at the intersection of Apple's product marketing clarity and a playful, rounded design language that makes AI technology feel approachable.
|
||||
|
||||
The typography system is notably multi-font: DM Sans serves as the primary UI workhorse, Outfit handles display headings with geometric elegance, Poppins appears for mid-tier headings, and Roboto handles data-heavy contexts. This variety reflects a brand in rapid growth — each font serves a distinct communicative purpose rather than competing for attention. The hero heading at 80px weight 500 in both DM Sans and Outfit with a tight 1.10 line-height creates a bold but not aggressive opening statement.
|
||||
|
||||
What makes MiniMax distinctive is its pill-button geometry (9999px radius) for navigation and primary actions, combined with softer 8px–24px radiused cards for product showcases. The product cards themselves are richly colorful — vibrant gradients in pink, purple, orange, and blue — creating a "gallery of AI capabilities" feel. Against the white canvas, these colorful cards pop like app icons on a phone home screen, making each AI model/product feel like a self-contained creative tool.
|
||||
|
||||
**Key Characteristics:**
|
||||
- White-dominant layout with colorful product card accents
|
||||
- Multi-font system: DM Sans (UI), Outfit (display), Poppins (mid-tier), Roboto (data)
|
||||
- Pill buttons (9999px radius) for primary navigation and CTAs
|
||||
- Generous rounded cards (20px–24px radius) for product showcases
|
||||
- Brand blue spectrum: from `#1456f0` (brand-6) through `#3b82f6` (primary-500) to `#60a5fa` (light)
|
||||
- Brand pink (`#ea5ec1`) as secondary accent
|
||||
- Near-black text (`#222222`, `#18181b`) on white backgrounds
|
||||
- Purple-tinted shadows (`rgba(44, 30, 116, 0.16)`) creating subtle brand-colored depth
|
||||
- Dark footer section (`#181e25`) with product/company links
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Brand Primary
|
||||
- **Brand Blue** (`#1456f0`): `--brand-6`, primary brand identity color
|
||||
- **Sky Blue** (`#3daeff`): `--col-brand00`, lighter brand variant for accents
|
||||
- **Brand Pink** (`#ea5ec1`): `--col-brand02`, secondary brand accent
|
||||
|
||||
### Blue Scale (Primary)
|
||||
- **Primary 200** (`#bfdbfe`): `--color-primary-200`, light blue backgrounds
|
||||
- **Primary Light** (`#60a5fa`): `--color-primary-light`, active states, highlights
|
||||
- **Primary 500** (`#3b82f6`): `--color-primary-500`, standard blue actions
|
||||
- **Primary 600** (`#2563eb`): `--color-primary-600`, hover states
|
||||
- **Primary 700** (`#1d4ed8`): `--color-primary-700`, pressed/active states
|
||||
- **Brand Deep** (`#17437d`): `--brand-3`, deep blue for emphasis
|
||||
|
||||
### Text Colors
|
||||
- **Near Black** (`#222222`): `--col-text00`, primary text
|
||||
- **Dark** (`#18181b`): Button text, headings
|
||||
- **Charcoal** (`#181e25`): Dark surface text, footer background
|
||||
- **Dark Gray** (`#45515e`): `--col-text04`, secondary text
|
||||
- **Mid Gray** (`#8e8e93`): Tertiary text, muted labels
|
||||
- **Light Gray** (`#5f5f5f`): `--brand-2`, helper text
|
||||
|
||||
### Surface & Background
|
||||
- **Pure White** (`#ffffff`): `--col-bg13`, primary background
|
||||
- **Light Gray** (`#f0f0f0`): Secondary button backgrounds
|
||||
- **Glass White** (`hsla(0, 0%, 100%, 0.4)`): `--fill-bg-white`, frosted glass overlay
|
||||
- **Border Light** (`#f2f3f5`): Subtle section dividers
|
||||
- **Border Gray** (`#e5e7eb`): Component borders
|
||||
|
||||
### Semantic
|
||||
- **Success Background** (`#e8ffea`): `--success-bg`, positive state backgrounds
|
||||
|
||||
### Shadows
|
||||
- **Standard** (`rgba(0, 0, 0, 0.08) 0px 4px 6px`): Default card shadow
|
||||
- **Soft Glow** (`rgba(0, 0, 0, 0.08) 0px 0px 22.576px`): Ambient soft shadow
|
||||
- **Brand Purple** (`rgba(44, 30, 116, 0.16) 0px 0px 15px`): Brand-tinted glow
|
||||
- **Brand Purple Offset** (`rgba(44, 30, 116, 0.11) 6.5px 2px 17.5px`): Directional brand glow
|
||||
- **Card Elevation** (`rgba(36, 36, 36, 0.08) 0px 12px 16px -4px`): Lifted card shadow
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Families
|
||||
- **Primary UI**: `DM Sans`, with fallbacks: `Helvetica Neue, Helvetica, Arial`
|
||||
- **Display**: `Outfit`, with fallbacks: `Helvetica Neue, Helvetica, Arial`
|
||||
- **Mid-tier**: `Poppins`
|
||||
- **Data/Technical**: `Roboto`, with fallbacks: `Helvetica Neue, Helvetica, Arial`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Notes |
|
||||
|------|------|------|--------|-------------|-------|
|
||||
| Display Hero | DM Sans / Outfit | 80px (5.00rem) | 500 | 1.10 (tight) | Hero headlines |
|
||||
| Section Heading | Outfit | 31px (1.94rem) | 600 | 1.50 | Feature section titles |
|
||||
| Section Heading Alt | Roboto / DM Sans | 32px (2.00rem) | 600 | 0.88 (tight) | Compact headers |
|
||||
| Card Title | Outfit | 28px (1.75rem) | 500–600 | 1.71 (relaxed) | Product card headings |
|
||||
| Sub-heading | Poppins | 24px (1.50rem) | 500 | 1.50 | Mid-tier headings |
|
||||
| Feature Label | Poppins | 18px (1.13rem) | 500 | 1.50 | Feature names |
|
||||
| Body Large | DM Sans | 20px (1.25rem) | 500 | 1.50 | Emphasized body |
|
||||
| Body | DM Sans | 16px (1.00rem) | 400–500 | 1.50 | Standard body text |
|
||||
| Body Bold | DM Sans | 16px (1.00rem) | 700 | 1.50 | Strong emphasis |
|
||||
| Nav/Link | DM Sans | 14px (0.88rem) | 400–500 | 1.50 | Navigation, links |
|
||||
| Button Small | DM Sans | 13px (0.81rem) | 600 | 1.50 | Compact buttons |
|
||||
| Caption | DM Sans / Poppins | 13px (0.81rem) | 400 | 1.70 (relaxed) | Metadata |
|
||||
| Small Label | DM Sans | 12px (0.75rem) | 500–600 | 1.25–1.50 | Tags, badges |
|
||||
| Micro | DM Sans / Outfit | 10px (0.63rem) | 400–500 | 1.50–1.80 | Tiny annotations |
|
||||
|
||||
### Principles
|
||||
- **Multi-font purpose**: DM Sans = UI workhorse (body, nav, buttons); Outfit = geometric display (headings, product names); Poppins = friendly mid-tier (sub-headings, features); Roboto = technical/data contexts.
|
||||
- **Universal 1.50 line-height**: The overwhelming majority of text uses 1.50 line-height, creating a consistent reading rhythm regardless of font or size. Exceptions: display (1.10 tight) and some captions (1.70 relaxed).
|
||||
- **Weight 500 as default emphasis**: Most headings use 500 (medium) rather than bold, creating a modern, approachable tone. 600 for section titles, 700 reserved for strong emphasis.
|
||||
- **Compact hierarchy**: The size scale jumps from 80px display straight to 28–32px section, then 16–20px body — a deliberate compression that keeps the visual hierarchy feeling efficient.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Pill Primary Dark**
|
||||
- Background: `#181e25`
|
||||
- Text: `#ffffff`
|
||||
- Padding: 11px 20px
|
||||
- Radius: 8px
|
||||
- Use: Primary CTA ("Get Started", "Learn More")
|
||||
|
||||
**Pill Nav**
|
||||
- Background: `rgba(0, 0, 0, 0.05)` (subtle tint)
|
||||
- Text: `#18181b`
|
||||
- Radius: 9999px (full pill)
|
||||
- Use: Navigation tabs, filter toggles
|
||||
|
||||
**Pill White**
|
||||
- Background: `#ffffff`
|
||||
- Text: `rgba(24, 30, 37, 0.8)`
|
||||
- Radius: 9999px
|
||||
- Opacity: 0.5 (default state)
|
||||
- Use: Secondary nav, inactive tabs
|
||||
|
||||
**Secondary Light**
|
||||
- Background: `#f0f0f0`
|
||||
- Text: `#333333`
|
||||
- Padding: 11px 20px
|
||||
- Radius: 8px
|
||||
- Use: Secondary actions
|
||||
|
||||
### Product Cards
|
||||
- Background: Vibrant gradients (pink/purple/orange/blue)
|
||||
- Radius: 20px–24px (generous rounding)
|
||||
- Shadow: `rgba(44, 30, 116, 0.16) 0px 0px 15px` (brand purple glow)
|
||||
- Content: Product name, model version, descriptive text
|
||||
- Each card has its own color palette matching the product identity
|
||||
|
||||
### AI Product Cards (Matrix)
|
||||
- Background: white with subtle shadow
|
||||
- Radius: 13px–16px
|
||||
- Shadow: `rgba(0, 0, 0, 0.08) 0px 4px 6px`
|
||||
- Icon/illustration centered above product name
|
||||
- Product name in DM Sans 14–16px weight 500
|
||||
|
||||
### Links
|
||||
- **Primary**: `#18181b` or `#181e25`, underline on dark text
|
||||
- **Secondary**: `#8e8e93`, muted for less emphasis
|
||||
- **On Dark**: `rgba(255, 255, 255, 0.8)` for footer and dark sections
|
||||
|
||||
### Navigation
|
||||
- Clean horizontal nav on white background
|
||||
- MiniMax logo left-aligned (red accent in logo)
|
||||
- DM Sans 14px weight 500 for nav items
|
||||
- Pill-shaped active indicators (9999px radius)
|
||||
- "Login" text link, minimal right-side actions
|
||||
- Sticky header behavior
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 1px, 2px, 4px, 6px, 8px, 10px, 11px, 14px, 16px, 24px, 32px, 40px, 50px, 64px, 80px
|
||||
|
||||
### Grid & Container
|
||||
- Max content width centered on page
|
||||
- Product card grids: horizontal scroll or 3–4 column layout
|
||||
- Full-width white sections with contained content
|
||||
- Dark footer at full-width
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <768px | Single column, stacked cards |
|
||||
| Tablet | 768–1024px | 2-column grids |
|
||||
| Desktop | >1024px | Full layout, horizontal card scrolls |
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Gallery spacing**: Products are presented like gallery items with generous white space between cards, letting each AI model breathe as its own showcase.
|
||||
- **Section rhythm**: Large vertical gaps (64px–80px) between major sections create distinct "chapters" of content.
|
||||
- **Card breathing**: Product cards use internal padding of 16px–24px with ample whitespace around text.
|
||||
|
||||
### Border Radius Scale
|
||||
- Minimal (4px): Small tags, micro badges
|
||||
- Standard (8px): Buttons, small cards
|
||||
- Comfortable (11px–13px): Medium cards, panels
|
||||
- Generous (16px–20px): Large product cards
|
||||
- Large (22px–24px): Hero product cards, major containers
|
||||
- Pill (30px–32px): Badge pills, rounded panels
|
||||
- Full (9999px): Buttons, nav tabs
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow | White background, text blocks |
|
||||
| Subtle (Level 1) | `rgba(0, 0, 0, 0.08) 0px 4px 6px` | Standard cards, containers |
|
||||
| Ambient (Level 2) | `rgba(0, 0, 0, 0.08) 0px 0px 22.576px` | Soft glow around elements |
|
||||
| Brand Glow (Level 3) | `rgba(44, 30, 116, 0.16) 0px 0px 15px` | Featured product cards |
|
||||
| Elevated (Level 4) | `rgba(36, 36, 36, 0.08) 0px 12px 16px -4px` | Lifted cards, hover states |
|
||||
|
||||
**Shadow Philosophy**: MiniMax uses a distinctive purple-tinted shadow (`rgba(44, 30, 116, ...)`) for featured elements, creating a subtle brand-color glow that connects the shadow system to the blue brand identity. Standard shadows use neutral black but at low opacity (0.08), keeping everything feeling light and airy. The directional shadow variant (6.5px offset) adds dimensional interest to hero product cards.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use white as the dominant background — let product cards provide the color
|
||||
- Apply pill radius (9999px) for navigation tabs and toggle buttons
|
||||
- Use generous border radius (20px–24px) for product showcase cards
|
||||
- Employ the purple-tinted shadow for featured/hero product cards
|
||||
- Keep body text at DM Sans weight 400–500 — heavier weights for buttons only
|
||||
- Use Outfit for display headings, DM Sans for everything functional
|
||||
- Maintain the universal 1.50 line-height across body text
|
||||
- Let colorful product illustrations/gradients serve as the primary visual interest
|
||||
|
||||
### Don't
|
||||
- Don't add colored backgrounds to main content sections — white is structural
|
||||
- Don't use sharp corners (0–4px radius) on product cards — the rounded aesthetic is core
|
||||
- Don't apply the brand pink (`#ea5ec1`) to text or buttons — it's for logo and decorative accents only
|
||||
- Don't mix more than one display font per section (Outfit OR Poppins, not both)
|
||||
- Don't use weight 700 for headings — 500–600 is the range, 700 is reserved for strong emphasis in body text
|
||||
- Don't darken shadows beyond 0.16 opacity — the light, airy feel requires restraint
|
||||
- Don't use Roboto for headings — it's the data/technical context font only
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <768px | Single column, stacked product cards, hamburger nav |
|
||||
| Tablet | 768–1024px | 2-column product grids, condensed spacing |
|
||||
| Desktop | >1024px | Full horizontal card layouts, expanded spacing |
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero: 80px → responsive scaling to ~40px on mobile
|
||||
- Product card grid: horizontal scroll → 2-column → single column stacked
|
||||
- Navigation: horizontal → hamburger menu
|
||||
- Footer: multi-column → stacked sections
|
||||
- Spacing: 64–80px gaps → 32–40px on mobile
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Background: `#ffffff` (primary), `#181e25` (dark/footer)
|
||||
- Text: `#222222` (primary), `#45515e` (secondary), `#8e8e93` (muted)
|
||||
- Brand Blue: `#1456f0` (brand), `#3b82f6` (primary-500), `#2563eb` (hover)
|
||||
- Brand Pink: `#ea5ec1` (accent only)
|
||||
- Borders: `#e5e7eb`, `#f2f3f5`
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on white background. Headline at 80px Outfit weight 500, line-height 1.10, near-black (#222222) text. Sub-text at 16px DM Sans weight 400, line-height 1.50, #45515e. Dark CTA button (#181e25, 8px radius, 11px 20px padding, white text)."
|
||||
- "Design a product card grid: white cards with 20px border-radius, shadow rgba(44,30,116,0.16) 0px 0px 15px. Product name at 28px Outfit weight 600. Internal gradient background for the product illustration area."
|
||||
- "Build navigation bar: white background, DM Sans 14px weight 500 for links, #18181b text. Pill-shaped active tab (9999px radius, rgba(0,0,0,0.05) background). MiniMax logo left-aligned."
|
||||
- "Create an AI product matrix: 4-column grid of cards with 13px radius, subtle shadow rgba(0,0,0,0.08) 0px 4px 6px. Centered icon above product name in DM Sans 16px weight 500."
|
||||
- "Design footer on dark (#181e25) background. Product links in DM Sans 14px, rgba(255,255,255,0.8). Multi-column layout."
|
||||
|
||||
### Iteration Guide
|
||||
1. Start with white — color comes from product cards and illustrations only
|
||||
2. Pill buttons (9999px) for nav/tabs, standard radius (8px) for CTA buttons
|
||||
3. Purple-tinted shadows for featured cards, neutral shadows for everything else
|
||||
4. DM Sans handles 70% of text — Outfit is display-only, Poppins is mid-tier only
|
||||
5. Keep weights moderate (500–600 for headings) — the brand tone is confident but approachable
|
||||
6. Large radius cards (20–24px) for products, smaller radius (8–13px) for UI elements
|
||||
339
skills/creative/popular-web-designs/templates/mintlify.md
Normal file
339
skills/creative/popular-web-designs/templates/mintlify.md
Normal file
@@ -0,0 +1,339 @@
|
||||
# Design System: Mintlify
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `Geist Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Mintlify's website is a study in documentation-as-product design — a white, airy, information-rich surface that treats clarity as its highest aesthetic value. The page opens with a luminous white (`#ffffff`) background, near-black (`#0d0d0d`) text, and a signature green brand accent (`#18E299`) that signals freshness and intelligence without dominating the palette. The overall mood is calm, confident, and engineered for legibility — a design system that whispers "we care about your developer experience" in every pixel.
|
||||
|
||||
The Inter font family carries the entire typographic load. At display sizes (40–64px), it uses tight negative letter-spacing (-0.8px to -1.28px) and semibold weight (600), creating headlines that feel focused and compressed like well-written documentation headers. Body text at 16–18px with 150% line-height provides generous reading comfort. Geist Mono appears exclusively for code and technical labels — uppercase, tracked-out, small — the voice of the terminal inside the marketing page.
|
||||
|
||||
What distinguishes Mintlify from other documentation platforms is its atmospheric gradient hero. A soft, cloud-like green-to-white gradient wash behind the hero content creates a sense of ethereal intelligence — documentation that floats above the noise. Below the hero, the page settles into a disciplined alternation of white sections separated by subtle 5% opacity borders. Cards use generous padding (24px+) with large radii (16px–24px) and whisper-thin borders, creating containers that feel open rather than boxed.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Inter with tight negative tracking at display sizes (-0.8px to -1.28px) — compressed yet readable
|
||||
- Geist Mono for code labels: uppercase, 12px, tracked-out, the terminal voice
|
||||
- Brand green (`#18E299`) used sparingly — CTAs, hover states, focus rings, and accent touches
|
||||
- Atmospheric gradient hero with cloud-like green-white wash
|
||||
- Ultra-round corners: 16px for containers, 24px for featured cards, full-round (9999px) for buttons and pills
|
||||
- Subtle 5% opacity borders (`rgba(0,0,0,0.05)`) creating barely-there separation
|
||||
- 8px base spacing system with generous section padding (48px–96px)
|
||||
- Clean white canvas — no gray backgrounds, no color sections, depth through borders and whitespace alone
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Near Black** (`#0d0d0d`): Primary text, headings, dark surfaces. Not pure black — the micro-softness improves reading comfort.
|
||||
- **Pure White** (`#ffffff`): Page background, card surfaces, input backgrounds.
|
||||
- **Brand Green** (`#18E299`): The signature accent — CTAs, links on hover, focus rings, brand identity.
|
||||
|
||||
### Secondary Accents
|
||||
- **Brand Green Light** (`#d4fae8`): Tinted green surface for badges, hover states, subtle backgrounds.
|
||||
- **Brand Green Deep** (`#0fa76e`): Darker green for text on light-green badges, hover states on brand elements.
|
||||
- **Warm Amber** (`#c37d0d`): Warning states, caution badges — `--twoslash-warn-bg`.
|
||||
- **Soft Blue** (`#3772cf`): Tag backgrounds, informational annotations — `--twoslash-tag-bg`.
|
||||
- **Error Red** (`#d45656`): Error states, destructive actions — `--twoslash-error-bg`.
|
||||
|
||||
### Neutral Scale
|
||||
- **Gray 900** (`#0d0d0d`): Primary heading text, nav links.
|
||||
- **Gray 700** (`#333333`): Secondary text, descriptions, body copy.
|
||||
- **Gray 500** (`#666666`): Tertiary text, muted labels.
|
||||
- **Gray 400** (`#888888`): Placeholder text, disabled states, code annotations.
|
||||
- **Gray 200** (`#e5e5e5`): Borders, dividers, card outlines.
|
||||
- **Gray 100** (`#f5f5f5`): Subtle surface backgrounds, hover states.
|
||||
- **Gray 50** (`#fafafa`): Near-white surface tint.
|
||||
|
||||
### Interactive
|
||||
- **Link Default** (`#0d0d0d`): Links match text color, relying on underline/context.
|
||||
- **Link Hover** (`#18E299`): Brand green on hover — `var(--color-brand)`.
|
||||
- **Focus Ring** (`#18E299`): Brand green focus outline for inputs and interactive elements.
|
||||
|
||||
### Surface & Overlay
|
||||
- **Card Background** (`#ffffff`): White cards on white background, separated by borders.
|
||||
- **Border Subtle** (`rgba(0,0,0,0.05)`): 5% black opacity borders — the primary separation mechanism.
|
||||
- **Border Medium** (`rgba(0,0,0,0.08)`): Slightly stronger borders for interactive elements.
|
||||
- **Input Border Focus** (`var(--color-brand)`): Green ring on focused inputs.
|
||||
|
||||
### Shadows & Depth
|
||||
- **Card Shadow** (`rgba(0,0,0,0.03) 0px 2px 4px`): Barely-there ambient shadow for subtle lift.
|
||||
- **Button Shadow** (`rgba(0,0,0,0.06) 0px 1px 2px`): Micro-shadow for button depth.
|
||||
- **No heavy shadows**: Mintlify relies on borders, not shadows, for depth.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Primary**: `Inter`, with fallback: `Inter Fallback, system-ui, -apple-system, sans-serif`
|
||||
- **Monospace**: `Geist Mono`, with fallback: `Geist Mono Fallback, ui-monospace, SFMono-Regular, monospace`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | Inter | 64px (4.00rem) | 600 | 1.15 (tight) | -1.28px | Maximum impact, hero headlines |
|
||||
| Section Heading | Inter | 40px (2.50rem) | 600 | 1.10 (tight) | -0.8px | Feature section titles |
|
||||
| Sub-heading | Inter | 24px (1.50rem) | 500 | 1.30 (tight) | -0.24px | Card headings, sub-sections |
|
||||
| Card Title | Inter | 20px (1.25rem) | 600 | 1.30 (tight) | -0.2px | Feature card titles |
|
||||
| Card Title Light | Inter | 20px (1.25rem) | 500 | 1.30 (tight) | -0.2px | Secondary card headings |
|
||||
| Body Large | Inter | 18px (1.13rem) | 400 | 1.50 | normal | Hero descriptions, introductions |
|
||||
| Body | Inter | 16px (1.00rem) | 400 | 1.50 | normal | Standard reading text |
|
||||
| Body Medium | Inter | 16px (1.00rem) | 500 | 1.50 | normal | Navigation, emphasized text |
|
||||
| Button | Inter | 15px (0.94rem) | 500 | 1.50 | normal | Button labels |
|
||||
| Link | Inter | 14px (0.88rem) | 500 | 1.50 | normal | Navigation links, small CTAs |
|
||||
| Caption | Inter | 14px (0.88rem) | 400–500 | 1.50–1.71 | normal | Metadata, descriptions |
|
||||
| Label Uppercase | Inter | 13px (0.81rem) | 500 | 1.50 | 0.65px | `text-transform: uppercase`, section labels |
|
||||
| Small | Inter | 13px (0.81rem) | 400–500 | 1.50 | -0.26px | Small body text |
|
||||
| Mono Code | Geist Mono | 12px (0.75rem) | 500 | 1.50 | 0.6px | `text-transform: uppercase`, technical labels |
|
||||
| Mono Badge | Geist Mono | 12px (0.75rem) | 600 | 1.50 | 0.6px | `text-transform: uppercase`, status badges |
|
||||
| Mono Micro | Geist Mono | 10px (0.63rem) | 500 | 1.50 | normal | `text-transform: uppercase`, tiny labels |
|
||||
|
||||
### Principles
|
||||
- **Tight tracking at display sizes**: Inter at 40–64px uses -0.8px to -1.28px letter-spacing. This compression creates headlines that feel deliberate and space-efficient — documentation headings, not billboard copy.
|
||||
- **Relaxed reading at body sizes**: 16–18px body text uses normal tracking with 150% line-height, creating generous reading lanes. Documentation demands comfort.
|
||||
- **Two-font system**: Inter for all human-readable content, Geist Mono exclusively for technical/code contexts. The boundary is strict — no mixing.
|
||||
- **Uppercase as hierarchy signal**: Section labels and technical tags use uppercase + positive tracking (0.6px–0.65px) as a clear visual delimiter between content types.
|
||||
- **Three weights**: 400 (body/reading), 500 (UI/navigation/emphasis), 600 (headings/titles). No bold (700) in the system.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary Brand (Full-round)**
|
||||
- Background: `#0d0d0d` (near-black)
|
||||
- Text: `#ffffff`
|
||||
- Padding: 8px 24px
|
||||
- Radius: 9999px (full pill)
|
||||
- Font: Inter 15px weight 500
|
||||
- Shadow: `rgba(0,0,0,0.06) 0px 1px 2px`
|
||||
- Hover: opacity 0.9
|
||||
- Use: Primary CTA ("Get Started", "Start Building")
|
||||
|
||||
**Secondary / Ghost (Full-round)**
|
||||
- Background: `#ffffff`
|
||||
- Text: `#0d0d0d`
|
||||
- Padding: 4.5px 12px
|
||||
- Radius: 9999px (full pill)
|
||||
- Border: `1px solid rgba(0,0,0,0.08)`
|
||||
- Font: Inter 15px weight 500
|
||||
- Hover: opacity 0.9
|
||||
- Use: Secondary actions ("Request Demo", "View Docs")
|
||||
|
||||
**Transparent / Nav Button**
|
||||
- Background: transparent
|
||||
- Text: `#0d0d0d`
|
||||
- Padding: 5px 6px
|
||||
- Radius: 8px
|
||||
- Border: none or `1px solid rgba(0,0,0,0.05)`
|
||||
- Use: Navigation items, icon buttons
|
||||
|
||||
**Brand Accent Button**
|
||||
- Background: `#18E299`
|
||||
- Text: `#0d0d0d`
|
||||
- Padding: 8px 24px
|
||||
- Radius: 9999px
|
||||
- Use: Special promotional CTAs
|
||||
|
||||
### Cards & Containers
|
||||
|
||||
**Standard Card**
|
||||
- Background: `#ffffff`
|
||||
- Border: `1px solid rgba(0,0,0,0.05)`
|
||||
- Radius: 16px
|
||||
- Padding: 24px
|
||||
- Shadow: `rgba(0,0,0,0.03) 0px 2px 4px`
|
||||
- Hover: subtle border darkening to `rgba(0,0,0,0.08)`
|
||||
|
||||
**Featured Card**
|
||||
- Background: `#ffffff`
|
||||
- Border: `1px solid rgba(0,0,0,0.05)`
|
||||
- Radius: 24px
|
||||
- Padding: 32px
|
||||
- Inner content areas may have their own 16px radius containers
|
||||
|
||||
**Logo/Trust Card**
|
||||
- Background: `#fafafa` or `#ffffff`
|
||||
- Border: `1px solid rgba(0,0,0,0.05)`
|
||||
- Radius: 16px
|
||||
- Centered logo/icon with consistent sizing
|
||||
|
||||
### Inputs & Forms
|
||||
|
||||
**Email Input**
|
||||
- Background: transparent or `#ffffff`
|
||||
- Text: `#0d0d0d`
|
||||
- Padding: 0px 12px (height controlled by line-height)
|
||||
- Border: `1px solid rgba(0,0,0,0.08)`
|
||||
- Radius: 9999px (full pill, matching buttons)
|
||||
- Focus: `1px solid var(--color-brand)` + `outline: 1px solid var(--color-brand)`
|
||||
- Placeholder: `#888888`
|
||||
|
||||
### Navigation
|
||||
- Clean horizontal nav on white, sticky with backdrop blur
|
||||
- Brand logotype left-aligned
|
||||
- Links: Inter 14–15px weight 500, `#0d0d0d` text
|
||||
- Hover: color shifts to brand green `var(--color-brand)`
|
||||
- CTA: dark pill button right-aligned ("Get Started")
|
||||
- Mobile: hamburger menu collapse at 768px
|
||||
|
||||
### Image Treatment
|
||||
- Product screenshots with subtle 1px borders
|
||||
- Rounded containers: 16px–24px radius
|
||||
- Atmospheric gradient backgrounds behind hero images
|
||||
- Cloud/sky imagery with soft green tinting
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Atmospheric Hero**
|
||||
- Full-width gradient wash: soft green-to-white cloud-like gradient
|
||||
- Centered headline with tight tracking
|
||||
- Subtitle in muted gray
|
||||
- Dual CTA buttons (dark primary + ghost secondary)
|
||||
- The gradient creates a sense of elevation and intelligence
|
||||
|
||||
**Trust Bar / Logo Grid**
|
||||
- "Loved by your favorite companies" section
|
||||
- Company logos in muted grayscale
|
||||
- Grid or horizontal layout with consistent sizing
|
||||
- Subtle border separation between logos
|
||||
|
||||
**Feature Cards with Icons**
|
||||
- Icon or illustration at top
|
||||
- Title at 20px weight 600
|
||||
- Description at 14–16px in gray
|
||||
- Consistent padding and border treatment
|
||||
- Grid layout: 2–3 columns on desktop
|
||||
|
||||
**CTA Footer Section**
|
||||
- Dark or gradient background
|
||||
- Large headline: "Make documentation your winning advantage"
|
||||
- Email input with pill styling
|
||||
- Brand green accent on CTAs
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 2px, 4px, 5px, 6px, 7px, 8px, 10px, 12px, 16px, 24px, 32px, 48px, 64px
|
||||
- Section padding: 48px–96px vertical
|
||||
- Card padding: 24px–32px
|
||||
- Component gaps: 8px–16px
|
||||
|
||||
### Grid & Container
|
||||
- Max content width: approximately 1200px
|
||||
- Hero: centered single-column with generous top padding (96px+)
|
||||
- Feature sections: 2–3 column CSS Grid for cards
|
||||
- Full-width sections with contained content
|
||||
- Consistent horizontal padding: 24px (mobile) to 32px (desktop)
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Documentation-grade breathing room**: Every element has generous surrounding whitespace. Mintlify sells documentation, so the marketing page itself demonstrates reading comfort.
|
||||
- **Sections as chapters**: Each feature section is a self-contained unit with 48px–96px vertical padding, creating clear "chapter breaks."
|
||||
- **Content density is low**: Unlike developer tools that pack the page, Mintlify uses 1–2 key messages per section with supporting imagery.
|
||||
|
||||
### Border Radius Scale
|
||||
- Small (4px): Inline code, small tags, tooltips
|
||||
- Medium (8px): Nav buttons, transparent buttons, small containers
|
||||
- Standard (16px): Cards, content containers, image wrappers
|
||||
- Large (24px): Featured cards, hero containers, section panels
|
||||
- Full Pill (9999px): Buttons, inputs, badges, pills — the signature shape
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow, no border | Page background, text blocks |
|
||||
| Subtle Border (Level 1) | `1px solid rgba(0,0,0,0.05)` | Standard card borders, dividers |
|
||||
| Medium Border (Level 1b) | `1px solid rgba(0,0,0,0.08)` | Interactive elements, input borders |
|
||||
| Ambient Shadow (Level 2) | `rgba(0,0,0,0.03) 0px 2px 4px` | Cards with subtle lift |
|
||||
| Button Shadow (Level 2b) | `rgba(0,0,0,0.06) 0px 1px 2px` | Button micro-depth |
|
||||
| Focus Ring (Accessibility) | `1px solid #18E299` outline | Focused inputs, active interactive elements |
|
||||
|
||||
**Shadow Philosophy**: Mintlify barely uses shadows. The depth system is almost entirely border-driven — ultra-subtle 5% opacity borders create separation without visual weight. When shadows appear, they're atmospheric whispers (`0.03 opacity, 2px blur, 4px spread`) that add the barest sense of lift. This restraint keeps the page feeling flat and paper-like — appropriate for a documentation company whose product is about clarity and readability.
|
||||
|
||||
### Decorative Depth
|
||||
- Hero gradient: atmospheric green-white cloud gradient behind hero content
|
||||
- No background color alternation — white on white throughout
|
||||
- Depth comes from border opacity variation (5% → 8%) and whitespace
|
||||
|
||||
## 7. Dark Mode
|
||||
|
||||
### Color Inversions
|
||||
- **Background**: `#0d0d0d` (near-black)
|
||||
- **Text Primary**: `#ededed` (near-white)
|
||||
- **Text Secondary**: `#a0a0a0` (muted gray)
|
||||
- **Brand Green**: `#18E299` (unchanged — the green works on both backgrounds)
|
||||
- **Border**: `rgba(255,255,255,0.08)` (white at 8% opacity)
|
||||
- **Card Background**: `#141414` (slightly lighter than page)
|
||||
- **Shadow**: `rgba(0,0,0,0.4) 0px 2px 4px` (stronger shadow for contrast)
|
||||
|
||||
### Key Adjustments
|
||||
- Buttons invert: white background dark text becomes dark background light text
|
||||
- Badge backgrounds shift to deeper tones with lighter text
|
||||
- Focus ring remains brand green
|
||||
- Hero gradient shifts to dark-tinted green atmospheric wash
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <768px | Single column, stacked layout, hamburger nav |
|
||||
| Tablet | 768–1024px | Two-column grids begin, expanded padding |
|
||||
| Desktop | >1024px | Full layout, 3-column grids, maximum content width |
|
||||
|
||||
### Touch Targets
|
||||
- Buttons with full-pill shape have comfortable 8px+ vertical padding
|
||||
- Navigation links spaced with adequate 16px+ gaps
|
||||
- Mobile menu provides full-width tap targets
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero: 64px → 40px headline, maintains tight tracking proportionally
|
||||
- Navigation: horizontal links + CTA → hamburger menu at 768px
|
||||
- Feature cards: 3-column → 2-column → single column stacked
|
||||
- Section spacing: 96px → 48px on mobile
|
||||
- Footer: multi-column → stacked single column
|
||||
- Trust bar: grid → horizontal scroll or stacked
|
||||
|
||||
### Image Behavior
|
||||
- Product screenshots maintain aspect ratio with responsive containers
|
||||
- Hero gradient simplifies on mobile
|
||||
- Full-width sections maintain edge-to-edge treatment
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary CTA: Near Black (`#0d0d0d`)
|
||||
- Background: Pure White (`#ffffff`)
|
||||
- Heading text: Near Black (`#0d0d0d`)
|
||||
- Body text: Gray 700 (`#333333`)
|
||||
- Border: `rgba(0,0,0,0.05)` (5% opacity)
|
||||
- Brand accent: Green (`#18E299`)
|
||||
- Link hover: Brand Green (`#18E299`)
|
||||
- Focus ring: Brand Green (`#18E299`)
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on white background with atmospheric green-white gradient wash. Headline at 64px Inter weight 600, line-height 1.15, letter-spacing -1.28px, color #0d0d0d. Subtitle at 18px Inter weight 400, line-height 1.50, color #666666. Dark pill CTA (#0d0d0d, 9999px radius, 8px 24px padding) and ghost pill button (white, 1px solid rgba(0,0,0,0.08), 9999px radius)."
|
||||
- "Design a card: white background, 1px solid rgba(0,0,0,0.05) border, 16px radius, 24px padding, shadow rgba(0,0,0,0.03) 0px 2px 4px. Title at 20px Inter weight 600, letter-spacing -0.2px. Body at 14px weight 400, #666666."
|
||||
- "Build a pill badge: #d4fae8 background, #0fa76e text, 9999px radius, 4px 12px padding, 13px Inter weight 500, uppercase."
|
||||
- "Create navigation: white sticky header with backdrop-filter blur(12px). Inter 15px weight 500 for links, #0d0d0d text. Dark pill CTA 'Get Started' right-aligned, 9999px radius. Bottom border: 1px solid rgba(0,0,0,0.05)."
|
||||
- "Design a trust section showing company logos in muted gray. Grid layout with 16px radius containers, 1px border at 5% opacity. Label above: 'Loved by your favorite companies' at 13px Inter weight 500, uppercase, tracking 0.65px."
|
||||
|
||||
### Iteration Guide
|
||||
1. Always use full-pill radius (9999px) for buttons and inputs — this is Mintlify's signature shape
|
||||
2. Keep borders at 5% opacity (`rgba(0,0,0,0.05)`) — stronger borders break the airy feeling
|
||||
3. Letter-spacing scales with font size: -1.28px at 64px, -0.8px at 40px, -0.24px at 24px, normal at 16px
|
||||
4. Three weights only: 400 (read), 500 (interact), 600 (announce)
|
||||
5. Brand green (`#18E299`) is used sparingly — CTAs and hover states only, never for decorative fills
|
||||
6. Geist Mono uppercase for technical labels, Inter for everything else
|
||||
7. Section padding is generous: 64px–96px on desktop, 48px on mobile
|
||||
8. No gray background sections — white throughout, separation through borders and whitespace
|
||||
121
skills/creative/popular-web-designs/templates/miro.md
Normal file
121
skills/creative/popular-web-designs/templates/miro.md
Normal file
@@ -0,0 +1,121 @@
|
||||
# Design System: Miro
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `system monospace stack`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Miro's website is a clean, collaborative-tool-forward platform that communicates "visual thinking" through generous whitespace, pastel accent colors, and a confident geometric font. The design uses a predominantly white canvas with near-black text (`#1c1c1e`) and a distinctive pastel color palette — coral, rose, teal, orange, yellow, moss — each representing different collaboration contexts.
|
||||
|
||||
The typography uses Roobert PRO Medium as the primary display font with OpenType character variants (`"blwf", "cv03", "cv04", "cv09", "cv11"`) and negative letter-spacing (-1.68px at 56px). Noto Sans handles body text with its own stylistic set (`"liga" 0, "ss01", "ss04", "ss05"`). The design is built with Framer, giving it smooth animations and modern component patterns.
|
||||
|
||||
**Key Characteristics:**
|
||||
- White canvas with near-black (`#1c1c1e`) text
|
||||
- Roobert PRO Medium with multiple OpenType character variants
|
||||
- Pastel accent palette: coral, rose, teal, orange, yellow, moss (light + dark pairs)
|
||||
- Blue 450 (`#5b76fe`) as primary interactive color
|
||||
- Success green (`#00b473`) for positive states
|
||||
- Generous border-radius: 8px–50px range
|
||||
- Framer-built with smooth motion patterns
|
||||
- Ring shadow border: `rgb(224,226,232) 0px 0px 0px 1px`
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Near Black** (`#1c1c1e`): Primary text
|
||||
- **White** (`#ffffff`): `--tw-color-white`, primary surface
|
||||
- **Blue 450** (`#5b76fe`): `--tw-color-blue-450`, primary interactive
|
||||
- **Actionable Pressed** (`#2a41b6`): `--tw-color-actionable-pressed`
|
||||
|
||||
### Pastel Accents (Light/Dark pairs)
|
||||
- **Coral**: Light `#ffc6c6` / Dark `#600000`
|
||||
- **Rose**: Light `#ffd8f4` / Dark (implied)
|
||||
- **Teal**: Light `#c3faf5` / Dark `#187574`
|
||||
- **Orange**: Light `#ffe6cd`
|
||||
- **Yellow**: Dark `#746019`
|
||||
- **Moss**: Dark `#187574`
|
||||
- **Pink** (`#fde0f0`): Soft pink surface
|
||||
- **Red** (`#fbd4d4`): Light red surface
|
||||
- **Dark Red** (`#e3c5c5`): Muted red
|
||||
|
||||
### Semantic
|
||||
- **Success** (`#00b473`): `--tw-color-success-accent`
|
||||
|
||||
### Neutral
|
||||
- **Slate** (`#555a6a`): Secondary text
|
||||
- **Input Placeholder** (`#a5a8b5`): `--tw-color-input-placeholder`
|
||||
- **Border** (`#c7cad5`): Button borders
|
||||
- **Ring** (`rgb(224,226,232)`): Shadow-as-border
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Families
|
||||
- **Display**: `Roobert PRO Medium`, fallback: Placeholder — `"blwf", "cv03", "cv04", "cv09", "cv11"`
|
||||
- **Display Variants**: `Roobert PRO SemiBold`, `Roobert PRO SemiBold Italic`, `Roobert PRO`
|
||||
- **Body**: `Noto Sans` — `"liga" 0, "ss01", "ss04", "ss05"`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing |
|
||||
|------|------|------|--------|-------------|----------------|
|
||||
| Display Hero | Roobert PRO Medium | 56px | 400 | 1.15 | -1.68px |
|
||||
| Section Heading | Roobert PRO Medium | 48px | 400 | 1.15 | -1.44px |
|
||||
| Card Title | Roobert PRO Medium | 24px | 400 | 1.15 | -0.72px |
|
||||
| Sub-heading | Noto Sans | 22px | 400 | 1.35 | -0.44px |
|
||||
| Feature | Roobert PRO Medium | 18px | 600 | 1.35 | normal |
|
||||
| Body | Noto Sans | 18px | 400 | 1.45 | normal |
|
||||
| Body Standard | Noto Sans | 16px | 400–600 | 1.50 | -0.16px |
|
||||
| Button | Roobert PRO Medium | 17.5px | 700 | 1.29 | 0.175px |
|
||||
| Caption | Roobert PRO Medium | 14px | 400 | 1.71 | normal |
|
||||
| Small | Roobert PRO Medium | 12px | 400 | 1.15 | -0.36px |
|
||||
| Micro Uppercase | Roobert PRO | 10.5px | 400 | 0.90 | uppercase |
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
- Outlined: transparent bg, `1px solid #c7cad5`, 8px radius, 7px 12px padding
|
||||
- White circle: 50% radius, white bg with shadow
|
||||
- Blue primary (implied from interactive color)
|
||||
|
||||
### Cards: 12px–24px radius, pastel backgrounds
|
||||
### Inputs: white bg, `1px solid #e9eaef`, 8px radius, 16px padding
|
||||
|
||||
## 5. Layout Principles
|
||||
- Spacing: 1–24px base scale
|
||||
- Radius: 8px (buttons), 10px–12px (cards), 20px–24px (panels), 40px–50px (large containers)
|
||||
- Ring shadow: `rgb(224,226,232) 0px 0px 0px 1px`
|
||||
|
||||
## 6. Depth & Elevation
|
||||
Minimal — ring shadow + pastel surface contrast
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
### Do
|
||||
- Use pastel light/dark pairs for feature sections
|
||||
- Apply Roobert PRO with OpenType character variants
|
||||
- Use Blue 450 (#5b76fe) for interactive elements
|
||||
### Don't
|
||||
- Don't use heavy shadows
|
||||
- Don't mix more than 2 pastel accents per section
|
||||
|
||||
## 8. Responsive Behavior
|
||||
Breakpoints: 425px, 576px, 768px, 896px, 1024px, 1200px, 1280px, 1366px, 1700px, 1920px
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
### Quick Color Reference
|
||||
- Text: Near Black (`#1c1c1e`)
|
||||
- Background: White (`#ffffff`)
|
||||
- Interactive: Blue 450 (`#5b76fe`)
|
||||
- Success: `#00b473`
|
||||
- Border: `#c7cad5`
|
||||
### Example Component Prompts
|
||||
- "Create hero: white background. Roobert PRO Medium 56px, line-height 1.15, letter-spacing -1.68px. Blue CTA (#5b76fe). Outlined secondary (1px solid #c7cad5, 8px radius)."
|
||||
274
skills/creative/popular-web-designs/templates/mistral.ai.md
Normal file
274
skills/creative/popular-web-designs/templates/mistral.ai.md
Normal file
@@ -0,0 +1,274 @@
|
||||
# Design System: Mistral AI
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Mistral AI's interface is a sun-drenched landscape rendered in code — a warm, bold, unapologetically European design that trades the typical blue-screen AI aesthetic for golden amber, burnt orange, and the feeling of late-afternoon light in southern France. Every surface glows with warmth: backgrounds fade from pale cream to deep amber, shadows carry golden undertones (`rgba(127, 99, 21, ...)`), and the brand's signature orange (`#fa520f`) burns through the page like a signal fire.
|
||||
|
||||
The design language is maximalist in its warmth but minimalist in its structure. Huge display headlines (82px) crash into the viewport with aggressive negative tracking (-2.05px), creating text blocks that feel like billboards or protest posters — declarations rather than descriptions. The typography uses Arial (likely a custom font with Arial as fallback) at extreme sizes, creating a raw, unadorned voice that says "we build frontier AI" with no decoration needed.
|
||||
|
||||
What makes Mistral distinctive is the complete commitment to a warm color temperature. The signature "block" identity — a gradient system flowing from bright yellow (`#ffd900`) through amber (`#ffa110`) to burnt orange (`#fa520f`) — creates a visual identity that's immediately recognizable. Even the shadows are warm, using amber-tinted blacks instead of cool grays. Combined with dramatic landscape photography in golden tones, the design feels less like a tech company and more like a European luxury brand that happens to build language models.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Golden-amber color universe: every tone from pale cream (#fffaeb) to burnt orange (#fa520f)
|
||||
- Massive display typography (82px) with aggressive negative letter-spacing (-2.05px)
|
||||
- Warm golden shadow system using amber-tinted rgba values
|
||||
- The Mistral "M" block identity — a gradient from yellow to orange
|
||||
- Dramatic landscape photography in warm golden tones
|
||||
- Uppercase typography used strategically for section labels and CTAs
|
||||
- Near-zero border-radius — sharp, architectural geometry
|
||||
- French-European confidence: bold, warm, declarative
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Mistral Orange** (`#fa520f`): The core brand color — a vivid, saturated orange-red that anchors the entire identity. Used for primary emphasis, the brand block, and the highest-signal moments.
|
||||
- **Mistral Flame** (`#fb6424`): A slightly warmer, lighter variant of the brand orange used for secondary brand moments and hover states.
|
||||
- **Block Orange** (`#ff8105`): A pure orange used in the gradient block system — warmer and less red than Mistral Orange.
|
||||
|
||||
### Secondary & Accent
|
||||
- **Sunshine 900** (`#ff8a00`): Deep golden amber — the darkest sunshine tone, used for strong accent moments.
|
||||
- **Sunshine 700** (`#ffa110`): Warm amber-gold — the core sunshine accent for backgrounds and interactive elements.
|
||||
- **Sunshine 500** (`#ffb83e`): Medium golden — balanced warmth for mid-level emphasis.
|
||||
- **Sunshine 300** (`#ffd06a`): Light golden — for subtle warm tints and secondary backgrounds.
|
||||
- **Block Gold** (`#ffe295`): Pale gold — soft background accents and gentle warmth.
|
||||
- **Bright Yellow** (`#ffd900`): The brightest tone in the gradient — used at the "top" of the block identity.
|
||||
|
||||
### Surface & Background
|
||||
- **Warm Ivory** (`#fffaeb`): The lightest page background — barely tinted with warmth, the foundation canvas.
|
||||
- **Cream** (`#fff0c2`): The primary warm surface and secondary button background — noticeably golden.
|
||||
- **Pure White** (`#ffffff`): Used for maximum contrast elements and popover surfaces.
|
||||
- **Mistral Black** (`#1f1f1f`): The primary dark surface for buttons, text, and dark sections.
|
||||
- **Accent Orange** (defined as `hsl(17, 96%, 52%)`): The functional accent color for interactive states.
|
||||
|
||||
### Neutrals & Text
|
||||
- **Mistral Black** (`#1f1f1f`): Primary text color and dark button backgrounds — a near-black that's warmer than pure #000.
|
||||
- **Black Tint** (defined as `hsl(0, 0%, 24%)`): A medium dark gray for secondary text on light backgrounds.
|
||||
- **Pure White** (`#ffffff`): Text on dark surfaces and CTA labels.
|
||||
|
||||
### Semantic & Accent
|
||||
- **Input Border** (defined as `hsl(240, 5.9%, 90%)`): A cool-tinted light gray for form borders — one of the few cool tones in the system.
|
||||
- **White Overlay** (`oklab(1, 0, 0 / 0.088–0.1)`): Semi-transparent white for frosted glass effects and button overlays.
|
||||
|
||||
### Gradient System
|
||||
- **Mistral Block Gradient**: The signature identity — a multi-step gradient flowing through Yellow (`#ffd900`) → Gold (`#ffe295`) → Amber (`#ffa110`) → Orange (`#ff8105`) → Flame (`#fb6424`) → Mistral Orange (`#fa520f`). This gradient appears in the logo blocks, section backgrounds, and decorative elements.
|
||||
- **Golden Landscape Wash**: Photography and backgrounds use warm amber overlays creating a consistent golden temperature across the page.
|
||||
- **Warm Shadow Cascade**: Multi-layered golden shadows that build depth with amber-tinted transparency rather than gray.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Primary**: Likely a custom font (Font Source detected) with `Arial` as fallback, and extended stack: `ui-sans-serif, system-ui, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display / Hero | Arial (custom) | 82px (5.13rem) | 400 | 1.00 (tight) | -2.05px | Maximum impact, billboard scale |
|
||||
| Section Heading | Arial (custom) | 56px (3.5rem) | 400 | 0.95 (ultra-tight) | normal | Feature section anchors |
|
||||
| Sub-heading Large | Arial (custom) | 48px (3rem) | 400 | 0.95 (ultra-tight) | normal | Secondary section titles |
|
||||
| Sub-heading | Arial (custom) | 32px (2rem) | 400 | 1.15 (tight) | normal | Card headings, feature names |
|
||||
| Card Title | Arial (custom) | 30px (1.88rem) | 400 | 1.20 (tight) | normal | Mid-level headings |
|
||||
| Feature Title | Arial (custom) | 24px (1.5rem) | 400 | 1.33 | normal | Small headings |
|
||||
| Body / Button | Arial (custom) | 16px (1rem) | 400 | 1.50 | normal | Standard body, button text |
|
||||
| Button Uppercase | Arial (custom) | 16px (1rem) | 400 | 1.50 | normal | Uppercase CTA labels |
|
||||
| Caption / Link | Arial (custom) | 14px (0.88rem) | 400 | 1.43 | normal | Metadata, secondary links |
|
||||
|
||||
### Principles
|
||||
- **Single weight, maximum impact**: The entire system uses weight 400 (regular) — even at 82px. This creates a surprisingly elegant effect where the size alone carries authority without needing bold weight.
|
||||
- **Ultra-tight at scale**: Line-heights of 0.95–1.00 at display sizes create text blocks where ascenders nearly touch descenders from the line above — creating dense, poster-like composition.
|
||||
- **Aggressive tracking on display**: -2.05px letter-spacing at 82px compresses the hero text into a monolithic block.
|
||||
- **Uppercase as emphasis**: Strategic `text-transform: uppercase` on button labels and section markers creates a formal, European signage quality.
|
||||
- **No weight variation**: Unlike most systems that use 300–700 weight range, Mistral uses 400 everywhere. Hierarchy comes from size and color, never weight.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Cream Surface**
|
||||
- Background: Cream (`#fff0c2`)
|
||||
- Text: Mistral Black (`#1f1f1f`)
|
||||
- No visible border
|
||||
- The warm, inviting secondary CTA
|
||||
|
||||
**Dark Solid**
|
||||
- Background: Mistral Black (`#1f1f1f`)
|
||||
- Text: Pure White (`#ffffff`)
|
||||
- Padding: 12px (all sides)
|
||||
- No visible border
|
||||
- The primary action button — dark on warm
|
||||
|
||||
**Ghost / Transparent**
|
||||
- Background: transparent with slight dark overlay (`oklab(0, 0, 0 / 0.1)`)
|
||||
- Text: Mistral Black (`#1f1f1f`)
|
||||
- Opacity: 0.4
|
||||
- For secondary/de-emphasized actions
|
||||
|
||||
**Text / Underline**
|
||||
- Background: transparent
|
||||
- Text: Mistral Black (`#1f1f1f`)
|
||||
- Padding: 8px 0px 0px (top-only)
|
||||
- Minimal styling — text link as button
|
||||
- For tertiary navigation actions
|
||||
|
||||
### Cards & Containers
|
||||
- Background: Warm Ivory (`#fffaeb`), Cream (`#fff0c2`), or Pure White
|
||||
- Border: minimal to none — containers defined by background color
|
||||
- Radius: near-zero — sharp, architectural corners
|
||||
- Shadow: warm golden multi-layer (`rgba(127, 99, 21, 0.12) -8px 16px 39px, rgba(127, 99, 21, 0.1) -33px 64px 72px, rgba(127, 99, 21, 0.06) -73px 144px 97px, ...`) — a dramatic, cascading warm shadow
|
||||
- Distinctive: the golden shadow creates a "golden hour" lighting effect
|
||||
|
||||
### Inputs & Forms
|
||||
- Border: `hsl(240, 5.9%, 90%)` — the sole cool-toned element
|
||||
- Focus: accent color ring
|
||||
- Minimal styling consistent with sparse aesthetic
|
||||
|
||||
### Navigation
|
||||
- Transparent nav overlaying the warm hero
|
||||
- Logo: Mistral "M" wordmark
|
||||
- Links: Dark text (white on dark sections)
|
||||
- CTA: Dark solid button or cream surface button
|
||||
- Minimal, wide-spaced layout
|
||||
|
||||
### Image Treatment
|
||||
- Dramatic landscape photography in warm golden tones
|
||||
- The winding road through golden hills — a recurring visual motif
|
||||
- The Mistral "M" rendered at large scale on golden backgrounds
|
||||
- Warm color grading on all photography
|
||||
- Full-bleed sections with photography
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Mistral Block Identity**
|
||||
- A row of colored blocks forming the gradient: yellow → amber → orange → burnt orange
|
||||
- Each block gets progressively more orange/red
|
||||
- The visual DNA of the brand — recognizable at any size
|
||||
|
||||
**Golden Shadow Cards**
|
||||
- Cards elevated with warm amber multi-layered shadows
|
||||
- 5 layers of shadow from 16px to 400px offset
|
||||
- Creates a "floating in golden light" effect unique to Mistral
|
||||
|
||||
**Dark Footer Gradient**
|
||||
- Footer transitions from warm amber to dark through a dramatic gradient
|
||||
- Creates a "sunset" effect as the page ends
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 2px, 4px, 8px, 10px, 12px, 16px, 20px, 24px, 32px, 40px, 48px, 64px, 80px, 98px, 100px
|
||||
- Button padding: 12px or 8px 0px (compact)
|
||||
- Section vertical spacing: very generous (80px–100px)
|
||||
|
||||
### Grid & Container
|
||||
- Max container width: approximately 1280px, centered
|
||||
- Hero: full-width with massive typography overlaying warm backgrounds
|
||||
- Feature sections: wide-format layouts with dramatic imagery
|
||||
- Card grids: 2–3 column layouts
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Bold declarations**: Huge headlines surrounded by generous whitespace create billboard-like impact — each statement gets its own breathing space.
|
||||
- **Warm void**: Empty space itself feels warm because the backgrounds are tinted ivory/cream rather than pure white.
|
||||
- **Photography as space-filler**: Large landscape images serve double duty as content and decorative whitespace.
|
||||
|
||||
### Border Radius Scale
|
||||
- Near-zero: The dominant radius — sharp, architectural corners on most elements
|
||||
- This extreme sharpness contrasts with the warmth of the colors, creating a tension between soft color and hard geometry.
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow | Page backgrounds, text blocks |
|
||||
| Golden Float (Level 1) | Multi-layer warm shadow (5 layers, 12%→0% opacity, amber-tinted) | Feature cards, product showcases, elevated content |
|
||||
|
||||
**Shadow Philosophy**: Mistral uses a single but extraordinarily complex shadow — **five cascading layers** of amber-tinted shadow (`rgba(127, 99, 21, ...)`) that build from a close 16px offset to a distant 400px offset. The result is a rich, warm, "golden hour" lighting effect that makes elevated elements look like they're bathed in afternoon sunlight. This is the most distinctive shadow system in any major AI brand.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use the warm color spectrum exclusively: ivory, cream, amber, gold, orange
|
||||
- Keep display typography at 82px+ with -2.05px letter-spacing for hero sections
|
||||
- Use the Mistral block gradient (yellow → amber → orange) for brand moments
|
||||
- Apply warm golden shadows (amber-tinted rgba) for elevated elements
|
||||
- Use Mistral Black (#1f1f1f) for text — never pure #000000
|
||||
- Keep font weight at 400 throughout — let size and color carry hierarchy
|
||||
- Use sharp, architectural corners — near-zero border-radius
|
||||
- Apply uppercase on button labels and section markers for European formality
|
||||
- Use warm landscape photography with golden color grading
|
||||
|
||||
### Don't
|
||||
- Don't introduce cool colors (blue, green, purple) — the palette is exclusively warm
|
||||
- Don't use bold (700+) weight — 400 is the only weight
|
||||
- Don't round corners — the sharp geometry is intentional
|
||||
- Don't use cool-toned shadows — shadows must carry amber warmth
|
||||
- Don't use pure white as a page background — always warm-tinted (#fffaeb minimum)
|
||||
- Don't reduce hero text below 48px on desktop — the billboard scale is core
|
||||
- Don't use more than 2 font weights — size variation replaces weight variation
|
||||
- Don't add gradients outside the warm spectrum — no blue-to-purple, no cool transitions
|
||||
- Don't use generic gray for text — even neutrals should be warm-tinted
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <640px | Single column, stacked everything, hero text reduces to ~32px |
|
||||
| Tablet | 640–768px | Minor layout adjustments |
|
||||
| Small Desktop | 768–1024px | 2-column layouts begin |
|
||||
| Desktop | 1024–1280px | Full layout with maximum typography scale |
|
||||
|
||||
### Touch Targets
|
||||
- Buttons use generous padding (12px minimum)
|
||||
- Navigation elements adequately spaced
|
||||
- Cards serve as large touch targets
|
||||
|
||||
### Collapsing Strategy
|
||||
- **Navigation**: Collapses to hamburger on mobile
|
||||
- **Hero text**: 82px → 56px → 48px → 32px progressive scaling
|
||||
- **Feature sections**: Multi-column → stacked
|
||||
- **Photography**: Scales proportionally, may crop on mobile
|
||||
- **Block identity**: Scales down proportionally
|
||||
|
||||
### Image Behavior
|
||||
- Landscape photography scales proportionally
|
||||
- Warm color grading maintained at all sizes
|
||||
- Block gradient elements resize fluidly
|
||||
- No art direction changes — same warm composition at all sizes
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Brand Orange: "Mistral Orange (#fa520f)"
|
||||
- Page Background: "Warm Ivory (#fffaeb)"
|
||||
- Warm Surface: "Cream (#fff0c2)"
|
||||
- Primary Text: "Mistral Black (#1f1f1f)"
|
||||
- Sunshine Amber: "Sunshine 700 (#ffa110)"
|
||||
- Bright Gold: "Bright Yellow (#ffd900)"
|
||||
- Text on Dark: "Pure White (#ffffff)"
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on Warm Ivory (#fffaeb) with a massive headline at 82px Arial weight 400, line-height 1.0, letter-spacing -2.05px. Mistral Black (#1f1f1f) text. Add a dark solid CTA button (#1f1f1f bg, white text, 12px padding, sharp corners) and a cream secondary button (#fff0c2 bg)."
|
||||
- "Design a feature card on Cream (#fff0c2) with sharp corners (no border-radius). Apply the golden shadow system: rgba(127, 99, 21, 0.12) -8px 16px 39px as the primary layer. Title at 32px weight 400, body at 16px."
|
||||
- "Build the Mistral block identity: a row of colored blocks from Bright Yellow (#ffd900) through Sunshine 700 (#ffa110) to Mistral Orange (#fa520f). Sharp corners, no gaps."
|
||||
- "Create a dark footer section on Mistral Black (#1f1f1f) with Pure White (#ffffff) text. Footer links at 14px. Add a warm gradient from Sunshine 700 (#ffa110) at the top fading to Mistral Black."
|
||||
|
||||
### Iteration Guide
|
||||
1. Keep the warm temperature — "shift toward amber" not "shift toward gray"
|
||||
2. Use size for hierarchy — 82px → 56px → 48px → 32px → 24px → 16px
|
||||
3. Never add border-radius — sharp corners only
|
||||
4. Shadows are always warm: "golden shadow with amber tones"
|
||||
5. Font weight is always 400 — describe emphasis through size and color
|
||||
279
skills/creative/popular-web-designs/templates/mongodb.md
Normal file
279
skills/creative/popular-web-designs/templates/mongodb.md
Normal file
@@ -0,0 +1,279 @@
|
||||
# Design System: MongoDB
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `Source Code Pro`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Source+Code+Pro:wght@400;500;600&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
MongoDB's website is a deep-forest-meets-terminal experience — a design system rooted in the darkest teal-black (`#001e2b`) that evokes both the density of a database and the depth of a forest canopy. Against this near-black canvas, a striking neon green (`#00ed64`) pulses as the brand accent — bright enough to feel electric, organic enough to feel alive. This isn't the cold neon of cyberpunk; it's the bioluminescent green of something growing in the dark.
|
||||
|
||||
The typography system is architecturally ambitious: MongoDB Value Serif for massive hero headlines (96px) creates an editorial, authoritative presence — serif type at database-company scale is a bold choice that says "we're not just another tech company." Euclid Circular A handles the heavy lifting of body and UI text with an unusually wide weight range (300–700), while Source Code Pro serves as the code and label font with distinctive uppercase treatments featuring very wide letter-spacing (1px–3px). This three-font system creates a hierarchy that spans editorial elegance → geometric professionalism → engineering precision.
|
||||
|
||||
What makes MongoDB distinctive is its dual-mode design: a dark hero/feature section world (`#001e2b` with neon green accents) and a light content world (white with teal-gray borders `#b8c4c2`). The transition between these modes creates dramatic contrast. The shadow system uses teal-tinted dark shadows (`rgba(0, 30, 43, 0.12)`) that maintain the forest-dark atmosphere even on light surfaces. Buttons use pill shapes (100px–999px radius) with MongoDB Green borders (`#00684a`), and the entire component system references the LeafyGreen design system.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Deep teal-black backgrounds (`#001e2b`) — forest-dark, not space-dark
|
||||
- Neon MongoDB Green (`#00ed64`) as the singular brand accent — electric and organic
|
||||
- MongoDB Value Serif for hero headlines — editorial authority at tech scale
|
||||
- Euclid Circular A for body with weight 300 (light) as a distinctive body weight
|
||||
- Source Code Pro with wide uppercase letter-spacing (1px–3px) for technical labels
|
||||
- Teal-tinted shadows: `rgba(0, 30, 43, 0.12)` — shadows carry the forest color
|
||||
- Dual-mode: dark teal hero sections + light white content sections
|
||||
- Pill buttons (100px radius) with green borders (`#00684a`)
|
||||
- Link Blue (`#006cfa`) and hover transition to `#3860be`
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary Brand
|
||||
- **Forest Black** (`#001e2b`): Primary dark background — the deepest teal-black
|
||||
- **MongoDB Green** (`#00ed64`): Primary brand accent — neon green for highlights, underlines, gradients
|
||||
- **Dark Green** (`#00684a`): Button borders, link text on light — muted green for functional use
|
||||
|
||||
### Interactive
|
||||
- **Action Blue** (`#006cfa`): Secondary accent — links, interactive highlights
|
||||
- **Hover Blue** (`#3860be`): All link hover states transition to this blue
|
||||
- **Teal Active** (`#1eaedb`): Button hover background — bright teal
|
||||
|
||||
### Neutral Scale
|
||||
- **Deep Teal** (`#1c2d38`): Dark button backgrounds, secondary dark surfaces
|
||||
- **Teal Gray** (`#3d4f58`): Dark borders on dark surfaces
|
||||
- **Dark Slate** (`#21313c`): Dark link text variant
|
||||
- **Cool Gray** (`#5c6c75`): Muted text on dark, secondary button text
|
||||
- **Silver Teal** (`#b8c4c2`): Borders on light surfaces, dividers
|
||||
- **Light Input** (`#e8edeb`): Input text on dark surfaces
|
||||
- **Pure White** (`#ffffff`): Light section background, button text on dark
|
||||
- **Black** (`#000000`): Text on light surfaces, darkest elements
|
||||
|
||||
### Shadows
|
||||
- **Forest Shadow** (`rgba(0, 30, 43, 0.12) 0px 26px 44px, rgba(0, 0, 0, 0.13) 0px 7px 13px`): Primary card elevation — teal-tinted
|
||||
- **Standard Shadow** (`rgba(0, 0, 0, 0.15) 0px 3px 20px`): General elevation
|
||||
- **Subtle Shadow** (`rgba(0, 0, 0, 0.1) 0px 2px 4px`): Light card lift
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Families
|
||||
- **Display Serif**: `MongoDB Value Serif` — editorial hero headlines
|
||||
- **Body / UI**: `Euclid Circular A` — geometric sans-serif workhorse
|
||||
- **Code / Labels**: `Source Code Pro` — monospace with uppercase label treatments
|
||||
- **Fallbacks**: `Akzidenz-Grotesk Std` (with CJK: Noto Sans KR/SC/JP), `Times`, `Arial`, `system-ui`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | MongoDB Value Serif | 96px (6.00rem) | 400 | 1.20 (tight) | normal | Serif authority |
|
||||
| Display Secondary | MongoDB Value Serif | 64px (4.00rem) | 400 | 1.00 (tight) | normal | Serif sub-hero |
|
||||
| Section Heading | Euclid Circular A | 36px (2.25rem) | 500 | 1.33 | normal | Geometric precision |
|
||||
| Sub-heading | Euclid Circular A | 24px (1.50rem) | 500 | 1.33 | normal | Feature titles |
|
||||
| Body Large | Euclid Circular A | 20px (1.25rem) | 400 | 1.60 (relaxed) | normal | Introductions |
|
||||
| Body | Euclid Circular A | 18px (1.13rem) | 400 | 1.33 | normal | Standard body |
|
||||
| Body Light | Euclid Circular A | 16px (1.00rem) | 300 | 1.50–2.00 | normal | Light-weight reading text |
|
||||
| Nav / UI | Euclid Circular A | 16px (1.00rem) | 500 | 1.00–1.88 | 0.16px | Navigation, emphasized |
|
||||
| Body Bold | Euclid Circular A | 15px (0.94rem) | 700 | 1.50 | normal | Strong emphasis |
|
||||
| Button | Euclid Circular A | 13.5px–16px | 500–700 | 1.00 | 0.135px–0.9px | CTA labels |
|
||||
| Caption | Euclid Circular A | 14px (0.88rem) | 400 | 1.71 (relaxed) | normal | Metadata |
|
||||
| Small | Euclid Circular A | 11px (0.69rem) | 600 | 1.82 (relaxed) | 0.2px | Tags, annotations |
|
||||
| Code Heading | Source Code Pro | 40px (2.50rem) | 400 | 1.60 (relaxed) | normal | Code showcase titles |
|
||||
| Code Body | Source Code Pro | 16px (1.00rem) | 400 | 1.50 | normal | Code blocks |
|
||||
| Code Label | Source Code Pro | 14px (0.88rem) | 400–500 | 1.14 (tight) | 1px–2px | `text-transform: uppercase` |
|
||||
| Code Micro | Source Code Pro | 9px (0.56rem) | 600 | 2.67 (relaxed) | 2.5px | `text-transform: uppercase` |
|
||||
|
||||
### Principles
|
||||
- **Serif for authority**: MongoDB Value Serif at hero scale creates an editorial presence unusual in tech — it communicates that MongoDB is an institution, not a startup.
|
||||
- **Weight 300 as body default**: Euclid Circular A uses light (300) for body text, creating an airy reading experience that contrasts with the dense, dark backgrounds.
|
||||
- **Wide-tracked monospace labels**: Source Code Pro uppercase at 1px–3px letter-spacing creates technical signposts that feel like database field labels — systematic, structured, classified.
|
||||
- **Four-weight range**: 300 (light body) → 400 (standard) → 500 (UI/nav) → 700 (bold CTA) — a wider range than most systems, enabling fine-grained hierarchy.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary Green (Dark Surface)**
|
||||
- Background: `#00684a` (muted MongoDB green)
|
||||
- Text: `#000000`
|
||||
- Radius: 50% (circular) or 100px (pill)
|
||||
- Border: `1px solid #00684a`
|
||||
- Shadow: `rgba(0,0,0,0.06) 0px 1px 6px`
|
||||
- Hover: scale 1.1
|
||||
- Active: scale 0.85
|
||||
|
||||
**Dark Teal Button**
|
||||
- Background: `#1c2d38`
|
||||
- Text: `#5c6c75`
|
||||
- Radius: 100px (pill)
|
||||
- Border: `1px solid #3d4f58`
|
||||
- Hover: background `#1eaedb`, text white, translateX(5px)
|
||||
|
||||
**Outlined Button (Light Surface)**
|
||||
- Background: transparent
|
||||
- Text: `#001e2b`
|
||||
- Border: `1px solid #b8c4c2`
|
||||
- Radius: 4px–8px
|
||||
- Hover: background tint
|
||||
|
||||
### Cards & Containers
|
||||
- Light mode: white background with `1px solid #b8c4c2` border
|
||||
- Dark mode: `#001e2b` or `#1c2d38` background with `1px solid #3d4f58`
|
||||
- Radius: 16px (standard), 24px (medium), 48px (large/hero)
|
||||
- Shadow: `rgba(0,30,43,0.12) 0px 26px 44px` (forest-tinted)
|
||||
- Image containers: 30px–32px radius
|
||||
|
||||
### Inputs & Forms
|
||||
- Textarea: text `#e8edeb`, padding 12px 12px 12px 8px
|
||||
- Borders: `1px solid #b8c4c2` on light, `1px solid #3d4f58` on dark
|
||||
- Input radius: 4px
|
||||
|
||||
### Navigation
|
||||
- Dark header on forest-black background
|
||||
- Euclid Circular A 16px weight 500 for nav links
|
||||
- MongoDB logo (leaf icon + wordmark) left-aligned
|
||||
- Green CTA pill buttons right-aligned
|
||||
- Mega-menu dropdowns with product categories
|
||||
|
||||
### Image Treatment
|
||||
- Dashboard screenshots on dark backgrounds
|
||||
- Green-accented UI elements in screenshots
|
||||
- 30px–32px radius on image containers
|
||||
- Full-width dark sections for product showcases
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Neon Green Accent Underlines**
|
||||
- `0px 2px 2px 0px solid #00ed64` — bottom + right border creating accent underlines
|
||||
- Used on feature headings and highlighted text
|
||||
- Also appears as `#006cfa` (blue) variant
|
||||
|
||||
**Source Code Label System**
|
||||
- 14px uppercase Source Code Pro with 1px–2px letter-spacing
|
||||
- Used as section category markers above headings
|
||||
- Creates a "database field label" aesthetic
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 1px, 4px, 7px, 8px, 10px, 12px, 14px, 15px, 16px, 18px, 20px, 24px, 32px
|
||||
|
||||
### Grid & Container
|
||||
- Max content width centered
|
||||
- Dark hero section with contained content
|
||||
- Light content sections below
|
||||
- Card grids: 2–3 columns
|
||||
- Full-width dark footer
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Dramatic mode transitions**: The shift from dark teal sections to white content creates built-in visual breathing through contrast, not just space.
|
||||
- **Generous dark sections**: Dark hero and feature areas use extra vertical padding (80px+) to let the forest-dark background breathe.
|
||||
- **Compact light sections**: White content areas are denser, with tighter card grids and less vertical spacing.
|
||||
|
||||
### Border Radius Scale
|
||||
- Minimal (1px–2px): Small spans, badges
|
||||
- Subtle (4px): Inputs, small buttons
|
||||
- Standard (8px): Cards, links
|
||||
- Card (16px): Standard cards, containers
|
||||
- Toggle (20px): Switch elements
|
||||
- Large (24px): Large panels
|
||||
- Image (30px–32px): Image containers
|
||||
- Hero (48px): Hero cards
|
||||
- Pill (100px–999px): Buttons, navigation pills
|
||||
- Full (9999px): Maximum pill
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow | Default surfaces |
|
||||
| Subtle (Level 1) | `rgba(0,0,0,0.1) 0px 2px 4px` | Light card lift |
|
||||
| Standard (Level 2) | `rgba(0,0,0,0.15) 0px 3px 9px` | Standard cards |
|
||||
| Prominent (Level 3) | `rgba(0,0,0,0.15) 0px 3px 20px` | Elevated panels |
|
||||
| Forest (Level 4) | `rgba(0,30,43,0.12) 0px 26px 44px, rgba(0,0,0,0.13) 0px 7px 13px` | Hero cards — teal-tinted |
|
||||
|
||||
**Shadow Philosophy**: MongoDB's shadow system is unique in that the primary elevation shadow uses `rgba(0, 30, 43, 0.12)` — a teal-tinted shadow that carries the forest-dark brand color into the depth system. This means even on white surfaces, shadows feel like they belong to the MongoDB color world rather than being generic neutral black.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use `#001e2b` (forest-black) for dark sections — not pure black
|
||||
- Apply MongoDB Green (`#00ed64`) sparingly for maximum electric impact
|
||||
- Use MongoDB Value Serif ONLY for hero/display headings — Euclid Circular A for everything else
|
||||
- Apply Source Code Pro uppercase with wide tracking (1px–3px) for technical labels
|
||||
- Use teal-tinted shadows (`rgba(0,30,43,0.12)`) for primary card elevation
|
||||
- Maintain the dark/light section duality — dramatic contrast between modes
|
||||
- Use weight 300 for body text — the light weight is the readable voice
|
||||
- Apply pill radius (100px) to primary action buttons
|
||||
|
||||
### Don't
|
||||
- Don't use pure black (`#000000`) for dark backgrounds — always use teal-black (`#001e2b`)
|
||||
- Don't use MongoDB Green (`#00ed64`) on backgrounds — it's an accent for text, underlines, and small highlights
|
||||
- Don't use standard gray shadows — always use teal-tinted (`rgba(0,30,43,...)`)
|
||||
- Don't apply serif font to body text — MongoDB Value Serif is hero-only
|
||||
- Don't use narrow letter-spacing on Source Code Pro labels — the wide tracking IS the identity
|
||||
- Don't mix dark and light section treatments within the same section
|
||||
- Don't use warm colors — the palette is strictly cool (teal, green, blue)
|
||||
- Don't forget the green accent underlines — they're the signature decorative element
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile Small | <425px | Tight single column |
|
||||
| Mobile | 425–768px | Standard mobile |
|
||||
| Tablet | 768–1024px | 2-column grids begin |
|
||||
| Desktop | 1024–1280px | Standard layout |
|
||||
| Large Desktop | 1280–1440px | Expanded layout |
|
||||
| Ultra-wide | >1440px | Maximum width, generous margins |
|
||||
|
||||
### Touch Targets
|
||||
- Pill buttons with generous padding
|
||||
- Navigation links at 16px with adequate spacing
|
||||
- Card surfaces as full-area touch targets
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero: MongoDB Value Serif 96px → 64px → scales further
|
||||
- Navigation: horizontal mega-menu → hamburger
|
||||
- Feature cards: multi-column → stacked
|
||||
- Dark/light sections maintain their mode at all sizes
|
||||
- Source Code Pro labels maintain uppercase treatment
|
||||
|
||||
### Image Behavior
|
||||
- Dashboard screenshots scale proportionally
|
||||
- Dark section backgrounds maintained full-width
|
||||
- Image radius maintained across breakpoints
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Dark background: Forest Black (`#001e2b`)
|
||||
- Brand accent: MongoDB Green (`#00ed64`)
|
||||
- Functional green: Dark Green (`#00684a`)
|
||||
- Link blue: Action Blue (`#006cfa`)
|
||||
- Text on light: Black (`#000000`)
|
||||
- Text on dark: White (`#ffffff`) or Light Input (`#e8edeb`)
|
||||
- Border light: Silver Teal (`#b8c4c2`)
|
||||
- Border dark: Teal Gray (`#3d4f58`)
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero on forest-black (#001e2b) background. Headline at 96px MongoDB Value Serif weight 400, line-height 1.20, white text with 'potential' highlighted in MongoDB Green (#00ed64). Subtitle at 18px Euclid Circular A weight 400. Green pill CTA (#00684a, 100px radius). Neon green gradient glow behind product screenshot."
|
||||
- "Design a card on white background: 1px solid #b8c4c2 border, 16px radius, shadow rgba(0,30,43,0.12) 0px 26px 44px. Title at 24px Euclid Circular A weight 500. Body at 16px weight 300. Source Code Pro 14px uppercase label above title with 2px letter-spacing."
|
||||
- "Build a dark section: #001e2b background, 1px solid #3d4f58 border on cards. White text. MongoDB Green (#00ed64) accent underlines on headings using bottom-border 2px solid."
|
||||
- "Create technical label: Source Code Pro 14px, text-transform uppercase, letter-spacing 2px, weight 500, #00ed64 color on dark background."
|
||||
- "Design a pill button: #1c2d38 background, 1px solid #3d4f58 border, 100px radius, #5c6c75 text. Hover: #1eaedb background, white text, translateX(5px)."
|
||||
|
||||
### Iteration Guide
|
||||
1. Start with the mode decision: dark (#001e2b) for hero/features, white for content
|
||||
2. MongoDB Green (#00ed64) is electric — use once per section for maximum impact
|
||||
3. Serif headlines (MongoDB Value Serif) create the editorial authority — never use for body
|
||||
4. Weight 300 body text creates the airy reading experience — don't default to 400
|
||||
5. Source Code Pro uppercase with wide tracking for technical labels — the database voice
|
||||
6. Teal-tinted shadows keep everything in the MongoDB color world
|
||||
322
skills/creative/popular-web-designs/templates/notion.md
Normal file
322
skills/creative/popular-web-designs/templates/notion.md
Normal file
@@ -0,0 +1,322 @@
|
||||
# Design System: Notion
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `system monospace stack`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Notion's website embodies the philosophy of the tool itself: a blank canvas that gets out of your way. The design system is built on warm neutrals rather than cold grays, creating a distinctly approachable minimalism that feels like quality paper rather than sterile glass. The page canvas is pure white (`#ffffff`) but the text isn't pure black -- it's a warm near-black (`rgba(0,0,0,0.95)`) that softens the reading experience imperceptibly. The warm gray scale (`#f6f5f4`, `#31302e`, `#615d59`, `#a39e98`) carries subtle yellow-brown undertones, giving the interface a tactile, almost analog warmth.
|
||||
|
||||
The custom NotionInter font (a modified Inter) is the backbone of the system. At display sizes (64px), it uses aggressive negative letter-spacing (-2.125px), creating headlines that feel compressed and precise. The weight range is broader than typical systems: 400 for body, 500 for UI elements, 600 for semi-bold labels, and 700 for display headings. OpenType features `"lnum"` (lining numerals) and `"locl"` (localized forms) are enabled on larger text, adding typographic sophistication that rewards close reading.
|
||||
|
||||
What makes Notion's visual language distinctive is its border philosophy. Rather than heavy borders or shadows, Notion uses ultra-thin `1px solid rgba(0,0,0,0.1)` borders -- borders that exist as whispers, barely perceptible division lines that create structure without weight. The shadow system is equally restrained: multi-layer stacks with cumulative opacity never exceeding 0.05, creating depth that's felt rather than seen.
|
||||
|
||||
**Key Characteristics:**
|
||||
- NotionInter (modified Inter) with negative letter-spacing at display sizes (-2.125px at 64px)
|
||||
- Warm neutral palette: grays carry yellow-brown undertones (`#f6f5f4` warm white, `#31302e` warm dark)
|
||||
- Near-black text via `rgba(0,0,0,0.95)` -- not pure black, creating micro-warmth
|
||||
- Ultra-thin borders: `1px solid rgba(0,0,0,0.1)` throughout -- whisper-weight division
|
||||
- Multi-layer shadow stacks with sub-0.05 opacity for barely-there depth
|
||||
- Notion Blue (`#0075de`) as the singular accent color for CTAs and interactive elements
|
||||
- Pill badges (9999px radius) with tinted blue backgrounds for status indicators
|
||||
- 8px base spacing unit with an organic, non-rigid scale
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Notion Black** (`rgba(0,0,0,0.95)` / `#000000f2`): Primary text, headings, body copy. The 95% opacity softens pure black without sacrificing readability.
|
||||
- **Pure White** (`#ffffff`): Page background, card surfaces, button text on blue.
|
||||
- **Notion Blue** (`#0075de`): Primary CTA, link color, interactive accent -- the only saturated color in the core UI chrome.
|
||||
|
||||
### Brand Secondary
|
||||
- **Deep Navy** (`#213183`): Secondary brand color, used sparingly for emphasis and dark feature sections.
|
||||
- **Active Blue** (`#005bab`): Button active/pressed state -- darker variant of Notion Blue.
|
||||
|
||||
### Warm Neutral Scale
|
||||
- **Warm White** (`#f6f5f4`): Background surface tint, section alternation, subtle card fill. The yellow undertone is key.
|
||||
- **Warm Dark** (`#31302e`): Dark surface background, dark section text. Warmer than standard grays.
|
||||
- **Warm Gray 500** (`#615d59`): Secondary text, descriptions, muted labels.
|
||||
- **Warm Gray 300** (`#a39e98`): Placeholder text, disabled states, caption text.
|
||||
|
||||
### Semantic Accent Colors
|
||||
- **Teal** (`#2a9d99`): Success states, positive indicators.
|
||||
- **Green** (`#1aae39`): Confirmation, completion badges.
|
||||
- **Orange** (`#dd5b00`): Warning states, attention indicators.
|
||||
- **Pink** (`#ff64c8`): Decorative accent, feature highlights.
|
||||
- **Purple** (`#391c57`): Premium features, deep accents.
|
||||
- **Brown** (`#523410`): Earthy accent, warm feature sections.
|
||||
|
||||
### Interactive
|
||||
- **Link Blue** (`#0075de`): Primary link color with underline-on-hover.
|
||||
- **Link Light Blue** (`#62aef0`): Lighter link variant for dark backgrounds.
|
||||
- **Focus Blue** (`#097fe8`): Focus ring on interactive elements.
|
||||
- **Badge Blue Bg** (`#f2f9ff`): Pill badge background, tinted blue surface.
|
||||
- **Badge Blue Text** (`#097fe8`): Pill badge text, darker blue for readability.
|
||||
|
||||
### Shadows & Depth
|
||||
- **Card Shadow** (`rgba(0,0,0,0.04) 0px 4px 18px, rgba(0,0,0,0.027) 0px 2.025px 7.84688px, rgba(0,0,0,0.02) 0px 0.8px 2.925px, rgba(0,0,0,0.01) 0px 0.175px 1.04062px`): Multi-layer card elevation.
|
||||
- **Deep Shadow** (`rgba(0,0,0,0.01) 0px 1px 3px, rgba(0,0,0,0.02) 0px 3px 7px, rgba(0,0,0,0.02) 0px 7px 15px, rgba(0,0,0,0.04) 0px 14px 28px, rgba(0,0,0,0.05) 0px 23px 52px`): Five-layer deep elevation for modals and featured content.
|
||||
- **Whisper Border** (`1px solid rgba(0,0,0,0.1)`): Standard division border -- cards, dividers, sections.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Primary**: `NotionInter`, with fallbacks: `Inter, -apple-system, system-ui, Segoe UI, Helvetica, Apple Color Emoji, Arial, Segoe UI Emoji, Segoe UI Symbol`
|
||||
- **OpenType Features**: `"lnum"` (lining numerals) and `"locl"` (localized forms) enabled on display and heading text.
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | NotionInter | 64px (4.00rem) | 700 | 1.00 (tight) | -2.125px | Maximum compression, billboard headlines |
|
||||
| Display Secondary | NotionInter | 54px (3.38rem) | 700 | 1.04 (tight) | -1.875px | Secondary hero, feature headlines |
|
||||
| Section Heading | NotionInter | 48px (3.00rem) | 700 | 1.00 (tight) | -1.5px | Feature section titles, with `"lnum"` |
|
||||
| Sub-heading Large | NotionInter | 40px (2.50rem) | 700 | 1.50 | normal | Card headings, feature sub-sections |
|
||||
| Sub-heading | NotionInter | 26px (1.63rem) | 700 | 1.23 (tight) | -0.625px | Section sub-titles, content headers |
|
||||
| Card Title | NotionInter | 22px (1.38rem) | 700 | 1.27 (tight) | -0.25px | Feature cards, list titles |
|
||||
| Body Large | NotionInter | 20px (1.25rem) | 600 | 1.40 | -0.125px | Introductions, feature descriptions |
|
||||
| Body | NotionInter | 16px (1.00rem) | 400 | 1.50 | normal | Standard reading text |
|
||||
| Body Medium | NotionInter | 16px (1.00rem) | 500 | 1.50 | normal | Navigation, emphasized UI text |
|
||||
| Body Semibold | NotionInter | 16px (1.00rem) | 600 | 1.50 | normal | Strong labels, active states |
|
||||
| Body Bold | NotionInter | 16px (1.00rem) | 700 | 1.50 | normal | Headlines at body size |
|
||||
| Nav / Button | NotionInter | 15px (0.94rem) | 600 | 1.33 | normal | Navigation links, button text |
|
||||
| Caption | NotionInter | 14px (0.88rem) | 500 | 1.43 | normal | Metadata, secondary labels |
|
||||
| Caption Light | NotionInter | 14px (0.88rem) | 400 | 1.43 | normal | Body captions, descriptions |
|
||||
| Badge | NotionInter | 12px (0.75rem) | 600 | 1.33 | 0.125px | Pill badges, tags, status labels |
|
||||
| Micro Label | NotionInter | 12px (0.75rem) | 400 | 1.33 | 0.125px | Small metadata, timestamps |
|
||||
|
||||
### Principles
|
||||
- **Compression at scale**: NotionInter at display sizes uses -2.125px letter-spacing at 64px, progressively relaxing to -0.625px at 26px and normal at 16px. The compression creates density at headlines while maintaining readability at body sizes.
|
||||
- **Four-weight system**: 400 (body/reading), 500 (UI/interactive), 600 (emphasis/navigation), 700 (headings/display). The broader weight range compared to most systems allows nuanced hierarchy.
|
||||
- **Warm scaling**: Line height tightens as size increases -- 1.50 at body (16px), 1.23-1.27 at sub-headings, 1.00-1.04 at display. This creates denser, more impactful headlines.
|
||||
- **Badge micro-tracking**: The 12px badge text uses positive letter-spacing (0.125px) -- the only positive tracking in the system, creating wider, more legible small text.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary Blue**
|
||||
- Background: `#0075de` (Notion Blue)
|
||||
- Text: `#ffffff`
|
||||
- Padding: 8px 16px
|
||||
- Radius: 4px (subtle)
|
||||
- Border: `1px solid transparent`
|
||||
- Hover: background darkens to `#005bab`
|
||||
- Active: scale(0.9) transform
|
||||
- Focus: `2px solid` focus outline, `var(--shadow-level-200)` shadow
|
||||
- Use: Primary CTA ("Get Notion free", "Try it")
|
||||
|
||||
**Secondary / Tertiary**
|
||||
- Background: `rgba(0,0,0,0.05)` (translucent warm gray)
|
||||
- Text: `#000000` (near-black)
|
||||
- Padding: 8px 16px
|
||||
- Radius: 4px
|
||||
- Hover: text color shifts, scale(1.05)
|
||||
- Active: scale(0.9) transform
|
||||
- Use: Secondary actions, form submissions
|
||||
|
||||
**Ghost / Link Button**
|
||||
- Background: transparent
|
||||
- Text: `rgba(0,0,0,0.95)`
|
||||
- Decoration: underline on hover
|
||||
- Use: Tertiary actions, inline links
|
||||
|
||||
**Pill Badge Button**
|
||||
- Background: `#f2f9ff` (tinted blue)
|
||||
- Text: `#097fe8`
|
||||
- Padding: 4px 8px
|
||||
- Radius: 9999px (full pill)
|
||||
- Font: 12px weight 600
|
||||
- Use: Status badges, feature labels, "New" tags
|
||||
|
||||
### Cards & Containers
|
||||
- Background: `#ffffff`
|
||||
- Border: `1px solid rgba(0,0,0,0.1)` (whisper border)
|
||||
- Radius: 12px (standard cards), 16px (featured/hero cards)
|
||||
- Shadow: `rgba(0,0,0,0.04) 0px 4px 18px, rgba(0,0,0,0.027) 0px 2.025px 7.84688px, rgba(0,0,0,0.02) 0px 0.8px 2.925px, rgba(0,0,0,0.01) 0px 0.175px 1.04062px`
|
||||
- Hover: subtle shadow intensification
|
||||
- Image cards: 12px top radius, image fills top half
|
||||
|
||||
### Inputs & Forms
|
||||
- Background: `#ffffff`
|
||||
- Text: `rgba(0,0,0,0.9)`
|
||||
- Border: `1px solid #dddddd`
|
||||
- Padding: 6px
|
||||
- Radius: 4px
|
||||
- Focus: blue outline ring
|
||||
- Placeholder: warm gray `#a39e98`
|
||||
|
||||
### Navigation
|
||||
- Clean horizontal nav on white, not sticky
|
||||
- Brand logo left-aligned (33x34px icon + wordmark)
|
||||
- Links: NotionInter 15px weight 500-600, near-black text
|
||||
- Hover: color shift to `var(--color-link-primary-text-hover)`
|
||||
- CTA: blue pill button ("Get Notion free") right-aligned
|
||||
- Mobile: hamburger menu collapse
|
||||
- Product dropdowns with multi-level categorized menus
|
||||
|
||||
### Image Treatment
|
||||
- Product screenshots with `1px solid rgba(0,0,0,0.1)` border
|
||||
- Top-rounded images: `12px 12px 0px 0px` radius
|
||||
- Dashboard/workspace preview screenshots dominate feature sections
|
||||
- Warm gradient backgrounds behind hero illustrations (decorative character illustrations)
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Feature Cards with Illustrations**
|
||||
- Large illustrative headers (The Great Wave, product UI screenshots)
|
||||
- 12px radius card with whisper border
|
||||
- Title at 22px weight 700, description at 16px weight 400
|
||||
- Warm white (`#f6f5f4`) background variant for alternating sections
|
||||
|
||||
**Trust Bar / Logo Grid**
|
||||
- Company logos (trusted teams section) in their brand colors
|
||||
- Horizontal scroll or grid layout with team counts
|
||||
- Metric display: large number + description pattern
|
||||
|
||||
**Metric Cards**
|
||||
- Large number display (e.g., "$4,200 ROI")
|
||||
- NotionInter 40px+ weight 700 for the metric
|
||||
- Description below in warm gray body text
|
||||
- Whisper-bordered card container
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 2px, 3px, 4px, 5px, 6px, 7px, 8px, 11px, 12px, 14px, 16px, 24px, 32px
|
||||
- Non-rigid organic scale with fractional values (5.6px, 6.4px) for micro-adjustments
|
||||
|
||||
### Grid & Container
|
||||
- Max content width: approximately 1200px
|
||||
- Hero: centered single-column with generous top padding (80-120px)
|
||||
- Feature sections: 2-3 column grids for cards
|
||||
- Full-width warm white (`#f6f5f4`) section backgrounds for alternation
|
||||
- Code/dashboard screenshots as contained with whisper border
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Generous vertical rhythm**: 64-120px between major sections. Notion lets content breathe with vast vertical padding.
|
||||
- **Warm alternation**: White sections alternate with warm white (`#f6f5f4`) sections, creating gentle visual rhythm without harsh color breaks.
|
||||
- **Content-first density**: Body text blocks are compact (line-height 1.50) but surrounded by ample margin, creating islands of readable content in a sea of white space.
|
||||
|
||||
### Border Radius Scale
|
||||
- Micro (4px): Buttons, inputs, functional interactive elements
|
||||
- Subtle (5px): Links, list items, menu items
|
||||
- Standard (8px): Small cards, containers, inline elements
|
||||
- Comfortable (12px): Standard cards, feature containers, image tops
|
||||
- Large (16px): Hero cards, featured content, promotional blocks
|
||||
- Full Pill (9999px): Badges, pills, status indicators
|
||||
- Circle (100%): Tab indicators, avatars
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow, no border | Page background, text blocks |
|
||||
| Whisper (Level 1) | `1px solid rgba(0,0,0,0.1)` | Standard borders, card outlines, dividers |
|
||||
| Soft Card (Level 2) | 4-layer shadow stack (max opacity 0.04) | Content cards, feature blocks |
|
||||
| Deep Card (Level 3) | 5-layer shadow stack (max opacity 0.05, 52px blur) | Modals, featured panels, hero elements |
|
||||
| Focus (Accessibility) | `2px solid var(--focus-color)` outline | Keyboard focus on all interactive elements |
|
||||
|
||||
**Shadow Philosophy**: Notion's shadow system uses multiple layers with extremely low individual opacity (0.01 to 0.05) that accumulate into soft, natural-looking elevation. The 4-layer card shadow spans from 1.04px to 18px blur, creating a gradient of depth rather than a single hard shadow. The 5-layer deep shadow extends to 52px blur at 0.05 opacity, producing ambient occlusion that feels like natural light rather than computer-generated depth. This layered approach makes elements feel embedded in the page rather than floating above it.
|
||||
|
||||
### Decorative Depth
|
||||
- Hero section: decorative character illustrations (playful, hand-drawn style)
|
||||
- Section alternation: white to warm white (`#f6f5f4`) background shifts
|
||||
- No hard section borders -- separation comes from background color changes and spacing
|
||||
|
||||
## 7. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile Small | <400px | Tight single column, minimal padding |
|
||||
| Mobile | 400-600px | Standard mobile, stacked layout |
|
||||
| Tablet Small | 600-768px | 2-column grids begin |
|
||||
| Tablet | 768-1080px | Full card grids, expanded padding |
|
||||
| Desktop Small | 1080-1200px | Standard desktop layout |
|
||||
| Desktop | 1200-1440px | Full layout, maximum content width |
|
||||
| Large Desktop | >1440px | Centered, generous margins |
|
||||
|
||||
### Touch Targets
|
||||
- Buttons use comfortable padding (8px-16px vertical)
|
||||
- Navigation links at 15px with adequate spacing
|
||||
- Pill badges have 8px horizontal padding for tap targets
|
||||
- Mobile menu toggle uses standard hamburger button
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero: 64px display -> scales to 40px -> 26px on mobile, maintains proportional letter-spacing
|
||||
- Navigation: horizontal links + blue CTA -> hamburger menu
|
||||
- Feature cards: 3-column -> 2-column -> single column stacked
|
||||
- Product screenshots: maintain aspect ratio with responsive images
|
||||
- Trust bar logos: grid -> horizontal scroll on mobile
|
||||
- Footer: multi-column -> stacked single column
|
||||
- Section spacing: 80px+ -> 48px on mobile
|
||||
|
||||
### Image Behavior
|
||||
- Workspace screenshots maintain whisper border at all sizes
|
||||
- Hero illustrations scale proportionally
|
||||
- Product screenshots use responsive images with consistent border radius
|
||||
- Full-width warm white sections maintain edge-to-edge treatment
|
||||
|
||||
## 8. Accessibility & States
|
||||
|
||||
### Focus System
|
||||
- All interactive elements receive visible focus indicators
|
||||
- Focus outline: `2px solid` with focus color + shadow level 200
|
||||
- Tab navigation supported throughout all interactive components
|
||||
- High contrast text: near-black on white exceeds WCAG AAA (>14:1 ratio)
|
||||
|
||||
### Interactive States
|
||||
- **Default**: Standard appearance with whisper borders
|
||||
- **Hover**: Color shift on text, scale(1.05) on buttons, underline on links
|
||||
- **Active/Pressed**: scale(0.9) transform, darker background variant
|
||||
- **Focus**: Blue outline ring with shadow reinforcement
|
||||
- **Disabled**: Warm gray (`#a39e98`) text, reduced opacity
|
||||
|
||||
### Color Contrast
|
||||
- Primary text (rgba(0,0,0,0.95)) on white: ~18:1 ratio
|
||||
- Secondary text (#615d59) on white: ~5.5:1 ratio (WCAG AA)
|
||||
- Blue CTA (#0075de) on white: ~4.6:1 ratio (WCAG AA for large text)
|
||||
- Badge text (#097fe8) on badge bg (#f2f9ff): ~4.5:1 ratio (WCAG AA for large text)
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary CTA: Notion Blue (`#0075de`)
|
||||
- Background: Pure White (`#ffffff`)
|
||||
- Alt Background: Warm White (`#f6f5f4`)
|
||||
- Heading text: Near-Black (`rgba(0,0,0,0.95)`)
|
||||
- Body text: Near-Black (`rgba(0,0,0,0.95)`)
|
||||
- Secondary text: Warm Gray 500 (`#615d59`)
|
||||
- Muted text: Warm Gray 300 (`#a39e98`)
|
||||
- Border: `1px solid rgba(0,0,0,0.1)`
|
||||
- Link: Notion Blue (`#0075de`)
|
||||
- Focus ring: Focus Blue (`#097fe8`)
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on white background. Headline at 64px NotionInter weight 700, line-height 1.00, letter-spacing -2.125px, color rgba(0,0,0,0.95). Subtitle at 20px weight 600, line-height 1.40, color #615d59. Blue CTA button (#0075de, 4px radius, 8px 16px padding, white text) and ghost button (transparent bg, near-black text, underline on hover)."
|
||||
- "Design a card: white background, 1px solid rgba(0,0,0,0.1) border, 12px radius. Use shadow stack: rgba(0,0,0,0.04) 0px 4px 18px, rgba(0,0,0,0.027) 0px 2.025px 7.85px, rgba(0,0,0,0.02) 0px 0.8px 2.93px, rgba(0,0,0,0.01) 0px 0.175px 1.04px. Title at 22px NotionInter weight 700, letter-spacing -0.25px. Body at 16px weight 400, color #615d59."
|
||||
- "Build a pill badge: #f2f9ff background, #097fe8 text, 9999px radius, 4px 8px padding, 12px NotionInter weight 600, letter-spacing 0.125px."
|
||||
- "Create navigation: white header. NotionInter 15px weight 600 for links, near-black text. Blue pill CTA 'Get Notion free' right-aligned (#0075de bg, white text, 4px radius)."
|
||||
- "Design an alternating section layout: white sections alternate with warm white (#f6f5f4) sections. Each section has 64-80px vertical padding, max-width 1200px centered. Section heading at 48px weight 700, line-height 1.00, letter-spacing -1.5px."
|
||||
|
||||
### Iteration Guide
|
||||
1. Always use warm neutrals -- Notion's grays have yellow-brown undertones (#f6f5f4, #31302e, #615d59, #a39e98), never blue-gray
|
||||
2. Letter-spacing scales with font size: -2.125px at 64px, -1.875px at 54px, -0.625px at 26px, normal at 16px
|
||||
3. Four weights: 400 (read), 500 (interact), 600 (emphasize), 700 (announce)
|
||||
4. Borders are whispers: 1px solid rgba(0,0,0,0.1) -- never heavier
|
||||
5. Shadows use 4-5 layers with individual opacity never exceeding 0.05
|
||||
6. The warm white (#f6f5f4) section background is essential for visual rhythm
|
||||
7. Pill badges (9999px) for status/tags, 4px radius for buttons and inputs
|
||||
8. Notion Blue (#0075de) is the only saturated color in core UI -- use it sparingly for CTAs and links
|
||||
306
skills/creative/popular-web-designs/templates/nvidia.md
Normal file
306
skills/creative/popular-web-designs/templates/nvidia.md
Normal file
@@ -0,0 +1,306 @@
|
||||
# Design System: NVIDIA
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `system monospace stack`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
NVIDIA's website is a high-contrast, technology-forward experience that communicates raw computational power through design restraint. The page is built on a stark black (`#000000`) and white (`#ffffff`) foundation, punctuated by NVIDIA's signature green (`#76b900`) -- a color so specific it functions as a brand fingerprint. This is not the lush green of nature; it's the electric, lime-shifted green of GPU-rendered light, a color that sits between chartreuse and kelly green and immediately signals "NVIDIA" to anyone in technology.
|
||||
|
||||
The custom NVIDIA-EMEA font family (with Arial and Helvetica fallbacks) creates a clean, industrial typographic voice. Headings at 36px bold with tight 1.25 line-height create dense, authoritative blocks of text. The font lacks the geometric playfulness of Silicon Valley sans-serifs -- it's European, pragmatic, and engineering-focused. Body text runs at 15-16px, comfortable for reading but not generous, maintaining the sense that screen real estate is optimized like GPU memory.
|
||||
|
||||
What distinguishes NVIDIA's design from other dark-background tech sites is the disciplined use of the green accent. The `#76b900` appears in borders (`2px solid #76b900`), link underlines (`underline 2px rgb(118, 185, 0)`), and CTAs -- but never as backgrounds or large surface areas on the main content. The green is a signal, not a surface. Combined with a deep shadow system (`rgba(0, 0, 0, 0.3) 0px 0px 5px`) and minimal border radius (1-2px), the overall effect is of precision engineering hardware rendered in pixels.
|
||||
|
||||
**Key Characteristics:**
|
||||
- NVIDIA Green (`#76b900`) as pure accent -- borders, underlines, and interactive highlights only
|
||||
- Black (`#000000`) dominant background with white (`#ffffff`) text on dark sections
|
||||
- NVIDIA-EMEA custom font with Arial/Helvetica fallback -- industrial, European, clean
|
||||
- Tight line-heights (1.25 for headings) creating dense, authoritative text blocks
|
||||
- Minimal border radius (1-2px) -- sharp, engineered corners throughout
|
||||
- Green-bordered buttons (`2px solid #76b900`) as primary interactive pattern
|
||||
- Font Awesome 6 Pro/Sharp icon system at weight 900 for sharp iconography
|
||||
- Multi-framework architecture (PrimeReact, Fluent UI, Element Plus) enabling rich interactive components
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary Brand
|
||||
- **NVIDIA Green** (`#76b900`): The signature -- borders, link underlines, CTA outlines, active indicators. Never used as large surface fills.
|
||||
- **True Black** (`#000000`): Primary page background, text on light surfaces, dominant tone.
|
||||
- **Pure White** (`#ffffff`): Text on dark backgrounds, light section backgrounds, card surfaces.
|
||||
|
||||
### Extended Brand Palette
|
||||
- **NVIDIA Green Light** (`#bff230`): Bright lime accent for highlights and hover states.
|
||||
- **Orange 400** (`#df6500`): Warm accent for alerts, featured badges, or energy-related contexts.
|
||||
- **Yellow 300** (`#ef9100`): Secondary warm accent, product category highlights.
|
||||
- **Yellow 050** (`#feeeb2`): Light warm surface for callout backgrounds.
|
||||
|
||||
### Status & Semantic
|
||||
- **Red 500** (`#e52020`): Error states, destructive actions, critical alerts.
|
||||
- **Red 800** (`#650b0b`): Deep red for severe warning backgrounds.
|
||||
- **Green 500** (`#3f8500`): Success states, positive indicators (darker than brand green).
|
||||
- **Blue 700** (`#0046a4`): Informational accents, link hover alternative.
|
||||
|
||||
### Decorative
|
||||
- **Purple 800** (`#4d1368`): Deep purple for gradient ends, premium/AI contexts.
|
||||
- **Purple 100** (`#f9d4ff`): Light purple surface tint.
|
||||
- **Fuchsia 700** (`#8c1c55`): Rich accent for special promotions or featured content.
|
||||
|
||||
### Neutral Scale
|
||||
- **Gray 300** (`#a7a7a7`): Muted text, disabled labels.
|
||||
- **Gray 400** (`#898989`): Secondary text, metadata.
|
||||
- **Gray 500** (`#757575`): Tertiary text, placeholders, footers.
|
||||
- **Gray Border** (`#5e5e5e`): Subtle borders, divider lines.
|
||||
- **Near Black** (`#1a1a1a`): Dark surfaces, card backgrounds on black pages.
|
||||
|
||||
### Interactive States
|
||||
- **Link Default (dark bg)** (`#ffffff`): White links on dark backgrounds.
|
||||
- **Link Default (light bg)** (`#000000`): Black links with green underline on light backgrounds.
|
||||
- **Link Hover** (`#3860be`): Blue shift on hover across all link variants.
|
||||
- **Button Hover** (`#1eaedb`): Teal highlight for button hover states.
|
||||
- **Button Active** (`#007fff`): Bright blue for active/pressed button states.
|
||||
- **Focus Ring** (`#000000 solid 2px`): Black outline for keyboard focus.
|
||||
|
||||
### Shadows & Depth
|
||||
- **Card Shadow** (`rgba(0, 0, 0, 0.3) 0px 0px 5px 0px`): Subtle ambient shadow for elevated cards.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Primary**: `NVIDIA-EMEA`, with fallbacks: `Arial, Helvetica, sans-serif`
|
||||
- **Icon Font**: `Font Awesome 6 Pro` (weight 900 for solid icons, 700 for regular)
|
||||
- **Icon Sharp**: `Font Awesome 6 Sharp` (weight 300 for light icons, 400 for regular)
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | NVIDIA-EMEA | 36px (2.25rem) | 700 | 1.25 (tight) | normal | Maximum impact headlines |
|
||||
| Section Heading | NVIDIA-EMEA | 24px (1.50rem) | 700 | 1.25 (tight) | normal | Section titles, card headings |
|
||||
| Sub-heading | NVIDIA-EMEA | 22px (1.38rem) | 400 | 1.75 (relaxed) | normal | Feature descriptions, subtitles |
|
||||
| Card Title | NVIDIA-EMEA | 20px (1.25rem) | 700 | 1.25 (tight) | normal | Card and module headings |
|
||||
| Body Large | NVIDIA-EMEA | 18px (1.13rem) | 700 | 1.67 (relaxed) | normal | Emphasized body, lead paragraphs |
|
||||
| Body | NVIDIA-EMEA | 16px (1.00rem) | 400 | 1.50 | normal | Standard reading text |
|
||||
| Body Bold | NVIDIA-EMEA | 16px (1.00rem) | 700 | 1.50 | normal | Strong labels, nav items |
|
||||
| Body Small | NVIDIA-EMEA | 15px (0.94rem) | 400 | 1.67 (relaxed) | normal | Secondary content, descriptions |
|
||||
| Body Small Bold | NVIDIA-EMEA | 15px (0.94rem) | 700 | 1.50 | normal | Emphasized secondary content |
|
||||
| Button Large | NVIDIA-EMEA | 18px (1.13rem) | 700 | 1.25 (tight) | normal | Primary CTA buttons |
|
||||
| Button | NVIDIA-EMEA | 16px (1.00rem) | 700 | 1.25 (tight) | normal | Standard buttons |
|
||||
| Button Compact | NVIDIA-EMEA | 14.4px (0.90rem) | 700 | 1.00 (tight) | 0.144px | Small/compact buttons |
|
||||
| Link | NVIDIA-EMEA | 14px (0.88rem) | 700 | 1.43 | normal | Navigation links |
|
||||
| Link Uppercase | NVIDIA-EMEA | 14px (0.88rem) | 700 | 1.43 | normal | `text-transform: uppercase`, nav labels |
|
||||
| Caption | NVIDIA-EMEA | 14px (0.88rem) | 600 | 1.50 | normal | Metadata, timestamps |
|
||||
| Caption Small | NVIDIA-EMEA | 12px (0.75rem) | 400 | 1.25 (tight) | normal | Fine print, legal |
|
||||
| Micro Label | NVIDIA-EMEA | 10px (0.63rem) | 700 | 1.50 | normal | `text-transform: uppercase`, tiny badges |
|
||||
| Micro | NVIDIA-EMEA | 11px (0.69rem) | 700 | 1.00 (tight) | normal | Smallest UI text |
|
||||
|
||||
### Principles
|
||||
- **Bold as the default voice**: NVIDIA leans heavily on weight 700 for headings, buttons, links, and labels. The 400 weight is reserved for body text and descriptions -- everything else is bold, projecting confidence and authority.
|
||||
- **Tight headings, relaxed body**: Heading line-height is consistently 1.25 (tight), while body text relaxes to 1.50-1.67. This contrast creates visual density at the top of content blocks and comfortable readability in paragraphs.
|
||||
- **Uppercase for navigation**: Link labels use `text-transform: uppercase` with weight 700, creating a navigation voice that reads like hardware specification labels.
|
||||
- **No decorative tracking**: Letter-spacing is normal throughout, except for compact buttons (0.144px). The font itself carries the industrial character without manipulation.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary (Green Border)**
|
||||
- Background: `transparent`
|
||||
- Text: `#000000`
|
||||
- Padding: 11px 13px
|
||||
- Border: `2px solid #76b900`
|
||||
- Radius: 2px
|
||||
- Font: 16px weight 700
|
||||
- Hover: background `#1eaedb`, text `#ffffff`
|
||||
- Active: background `#007fff`, text `#ffffff`, border `1px solid #003eff`, scale(1)
|
||||
- Focus: background `#1eaedb`, text `#ffffff`, outline `#000000 solid 2px`, opacity 0.9
|
||||
- Use: Primary CTA ("Learn More", "Explore Solutions")
|
||||
|
||||
**Secondary (Green Border Thin)**
|
||||
- Background: transparent
|
||||
- Border: `1px solid #76b900`
|
||||
- Radius: 2px
|
||||
- Use: Secondary actions, alternative CTAs
|
||||
|
||||
**Compact / Inline**
|
||||
- Font: 14.4px weight 700
|
||||
- Letter-spacing: 0.144px
|
||||
- Line-height: 1.00
|
||||
- Use: Inline CTAs, compact navigation
|
||||
|
||||
### Cards & Containers
|
||||
- Background: `#ffffff` (light) or `#1a1a1a` (dark sections)
|
||||
- Border: none (clean edges) or `1px solid #5e5e5e`
|
||||
- Radius: 2px
|
||||
- Shadow: `rgba(0, 0, 0, 0.3) 0px 0px 5px 0px` for elevated cards
|
||||
- Hover: shadow intensification
|
||||
- Padding: 16-24px internal
|
||||
|
||||
### Links
|
||||
- **On Dark Background**: `#ffffff`, no underline, hover shifts to `#3860be`
|
||||
- **On Light Background**: `#000000` or `#1a1a1a`, underline `2px solid #76b900`, hover shifts to `#3860be`, underline removed
|
||||
- **Green Links**: `#76b900`, hover shifts to `#3860be`
|
||||
- **Muted Links**: `#666666`, hover shifts to `#3860be`
|
||||
|
||||
### Navigation
|
||||
- Dark black background (`#000000`)
|
||||
- Logo left-aligned, prominent NVIDIA wordmark
|
||||
- Links: NVIDIA-EMEA 14px weight 700 uppercase, `#ffffff`
|
||||
- Hover: color shift, no underline change
|
||||
- Mega-menu dropdowns for product categories
|
||||
- Sticky on scroll with backdrop
|
||||
|
||||
### Image Treatment
|
||||
- Product/GPU renders as hero images, often full-width
|
||||
- Screenshot images with subtle shadow for depth
|
||||
- Green gradient overlays on dark hero sections
|
||||
- Circular avatar containers with 50% radius
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Product Cards**
|
||||
- Clean white or dark card with minimal radius (2px)
|
||||
- Green accent border or underline on title
|
||||
- Bold heading + lighter description pattern
|
||||
- CTA with green border at bottom
|
||||
|
||||
**Tech Spec Tables**
|
||||
- Industrial grid layouts
|
||||
- Alternating row backgrounds (subtle gray shift)
|
||||
- Bold labels, regular values
|
||||
- Green highlights for key metrics
|
||||
|
||||
**Cookie/Consent Banner**
|
||||
- Fixed bottom positioning
|
||||
- Rounded buttons (2px radius)
|
||||
- Gray border treatments
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 1px, 2px, 3px, 4px, 5px, 6px, 7px, 8px, 9px, 10px, 11px, 12px, 13px, 15px
|
||||
- Primary padding values: 8px, 11px, 13px, 16px, 24px, 32px
|
||||
- Section spacing: 48-80px vertical padding
|
||||
|
||||
### Grid & Container
|
||||
- Max content width: approximately 1200px (contained)
|
||||
- Full-width hero sections with contained text
|
||||
- Feature sections: 2-3 column grids for product cards
|
||||
- Single-column for article/blog content
|
||||
- Sidebar layouts for documentation
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Purposeful density**: NVIDIA uses tighter spacing than typical SaaS sites, reflecting the density of technical content. White space exists to separate concepts, not to create luxury emptiness.
|
||||
- **Section rhythm**: Dark sections alternate with white sections, using background color (not just spacing) to separate content blocks.
|
||||
- **Card density**: Product cards sit close together with 16-20px gaps, creating a catalog feel rather than a gallery feel.
|
||||
|
||||
### Border Radius Scale
|
||||
- Micro (1px): Inline spans, tiny elements
|
||||
- Standard (2px): Buttons, cards, containers, inputs -- the default for nearly everything
|
||||
- Circle (50%): Avatar images, circular tab indicators
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow | Page backgrounds, inline text |
|
||||
| Subtle (Level 1) | `rgba(0,0,0,0.3) 0px 0px 5px 0px` | Standard cards, modals |
|
||||
| Border (Level 1b) | `1px solid #5e5e5e` | Content dividers, section borders |
|
||||
| Green accent (Level 2) | `2px solid #76b900` | Active elements, CTAs, selected items |
|
||||
| Focus (Accessibility) | `2px solid #000000` outline | Keyboard focus ring |
|
||||
|
||||
**Shadow Philosophy**: NVIDIA's depth system is minimal and utilitarian. There is essentially one shadow value -- a 5px ambient blur at 30% opacity -- used sparingly for cards and modals. The primary depth signal is not shadow but _color contrast_: black backgrounds next to white sections, green borders on black surfaces. This creates hardware-like visual layering where depth comes from material difference, not simulated light.
|
||||
|
||||
### Decorative Depth
|
||||
- Green gradient washes behind hero content
|
||||
- Dark-to-darker gradients (black to near-black) for section transitions
|
||||
- No glassmorphism or blur effects -- clarity over atmosphere
|
||||
|
||||
## 7. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile Small | <375px | Compact single column, reduced padding |
|
||||
| Mobile | 375-425px | Standard mobile layout |
|
||||
| Mobile Large | 425-600px | Wider mobile, some 2-col hints |
|
||||
| Tablet Small | 600-768px | 2-column grids begin |
|
||||
| Tablet | 768-1024px | Full card grids, expanded nav |
|
||||
| Desktop | 1024-1350px | Standard desktop layout |
|
||||
| Large Desktop | >1350px | Maximum content width, generous margins |
|
||||
|
||||
### Touch Targets
|
||||
- Buttons use 11px 13px padding for comfortable tap targets
|
||||
- Navigation links at 14px uppercase with adequate spacing
|
||||
- Green-bordered buttons provide high-contrast touch targets on dark backgrounds
|
||||
- Mobile: hamburger menu collapse with full-screen overlay
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero: 36px heading scales down proportionally
|
||||
- Navigation: full horizontal nav collapses to hamburger menu at ~1024px
|
||||
- Product cards: 3-column to 2-column to single column stacked
|
||||
- Footer: multi-column grid collapses to single stacked column
|
||||
- Section spacing: 64-80px reduces to 32-48px on mobile
|
||||
- Images: maintain aspect ratio, scale to container width
|
||||
|
||||
### Image Behavior
|
||||
- GPU/product renders maintain high resolution at all sizes
|
||||
- Hero images scale proportionally with viewport
|
||||
- Card images use consistent aspect ratios
|
||||
- Full-bleed dark sections maintain edge-to-edge treatment
|
||||
|
||||
## 8. Responsive Behavior (Extended)
|
||||
|
||||
### Typography Scaling
|
||||
- Display 36px scales to ~24px on mobile
|
||||
- Section headings 24px scale to ~20px on mobile
|
||||
- Body text maintains 15-16px across all breakpoints
|
||||
- Button text maintains 16px for consistent tap targets
|
||||
|
||||
### Dark/Light Section Strategy
|
||||
- Dark sections (black bg, white text) alternate with light sections (white bg, black text)
|
||||
- The green accent remains consistent across both surface types
|
||||
- On dark: links are white, underlines are green
|
||||
- On light: links are black, underlines are green
|
||||
- This alternation creates natural scroll rhythm and content grouping
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary accent: NVIDIA Green (`#76b900`)
|
||||
- Background dark: True Black (`#000000`)
|
||||
- Background light: Pure White (`#ffffff`)
|
||||
- Heading text (dark bg): White (`#ffffff`)
|
||||
- Heading text (light bg): Black (`#000000`)
|
||||
- Body text (light bg): Black (`#000000`) or Near Black (`#1a1a1a`)
|
||||
- Body text (dark bg): White (`#ffffff`) or Gray 300 (`#a7a7a7`)
|
||||
- Link hover: Blue (`#3860be`)
|
||||
- Border accent: `2px solid #76b900`
|
||||
- Button hover: Teal (`#1eaedb`)
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on black background. Headline at 36px NVIDIA-EMEA weight 700, line-height 1.25, color #ffffff. Subtitle at 18px weight 400, line-height 1.67, color #a7a7a7. CTA button with transparent background, 2px solid #76b900 border, 2px radius, 11px 13px padding, text #ffffff. Hover: background #1eaedb, text white."
|
||||
- "Design a product card: white background, 2px border-radius, box-shadow rgba(0,0,0,0.3) 0px 0px 5px. Title at 20px NVIDIA-EMEA weight 700, line-height 1.25, color #000000. Body at 15px weight 400, line-height 1.67, color #757575. Green underline accent on title: border-bottom 2px solid #76b900."
|
||||
- "Build a navigation bar: #000000 background, sticky top. NVIDIA logo left-aligned. Links at 14px NVIDIA-EMEA weight 700 uppercase, color #ffffff. Hover: color #3860be. Green-bordered CTA button right-aligned."
|
||||
- "Create a dark feature section: #000000 background. Section label at 14px weight 700 uppercase, color #76b900. Heading at 24px weight 700, color #ffffff. Description at 16px weight 400, color #a7a7a7. Three product cards in a row with 20px gap."
|
||||
- "Design a footer: #000000 background. Multi-column layout with link groups. Links at 14px weight 400, color #a7a7a7. Hover: color #76b900. Bottom bar with legal text at 12px, color #757575."
|
||||
|
||||
### Iteration Guide
|
||||
1. Always use `#76b900` as accent, never as a background fill -- it's a signal color for borders, underlines, and highlights
|
||||
2. Buttons are transparent with green borders by default -- filled backgrounds appear only on hover/active states
|
||||
3. Weight 700 is the dominant voice for all interactive and heading elements; 400 is only for body paragraphs
|
||||
4. Border radius is 2px for everything -- this sharp, minimal rounding is core to the industrial aesthetic
|
||||
5. Dark sections use white text; light sections use black text -- green accent works identically on both
|
||||
6. Link hover is always `#3860be` (blue) regardless of the link's default color
|
||||
7. Line-height 1.25 for headings, 1.50-1.67 for body text -- maintain this contrast for visual hierarchy
|
||||
8. Navigation uses uppercase 14px bold -- this hardware-label typography is part of the brand voice
|
||||
280
skills/creative/popular-web-designs/templates/ollama.md
Normal file
280
skills/creative/popular-web-designs/templates/ollama.md
Normal file
@@ -0,0 +1,280 @@
|
||||
# Design System: Ollama
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Ollama's interface is radical minimalism taken to its logical conclusion — a pure-white void where content floats without decoration, shadow, or color. The design philosophy mirrors the product itself: strip away everything unnecessary until only the essential tool remains. This is the digital equivalent of a Dieter Rams object — every pixel earns its place, and the absence of design IS the design.
|
||||
|
||||
The entire page exists in pure grayscale. There is zero chromatic color in the interface — no brand blue, no accent green, no semantic red. The only colors that exist are shades between pure black (`#000000`) and pure white (`#ffffff`), creating a monochrome environment that lets the user's mental model of "open models" remain uncolored by brand opinion. The Ollama llama mascot, rendered in simple black line art, is the only illustration — and even it's monochrome.
|
||||
|
||||
What makes Ollama distinctive is the combination of SF Pro Rounded (Apple's rounded system font) with an exclusively pill-shaped geometry (9999px radius on everything interactive). The rounded letterforms + rounded buttons + rounded containers create a cohesive "softness language" that makes a developer CLI tool feel approachable and friendly rather than intimidating. This is minimalism with warmth — not cold Swiss-style grid minimalism, but the kind where the edges are literally softened.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Pure white canvas with zero chromatic color — completely grayscale
|
||||
- SF Pro Rounded headlines creating a distinctively Apple-like softness
|
||||
- Binary border-radius system: 12px (containers) or 9999px (everything interactive)
|
||||
- Zero shadows — depth comes exclusively from background color shifts and borders
|
||||
- Pill-shaped geometry on all interactive elements (buttons, tabs, inputs, tags)
|
||||
- The Ollama llama as the sole illustration — black line art, no color
|
||||
- Extreme content restraint — the homepage is short, focused, and uncluttered
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Pure Black** (`#000000`): Primary headlines, primary links, and the darkest text. The only "color" that demands attention.
|
||||
- **Near Black** (`#262626`): Button text on light surfaces, secondary headline weight.
|
||||
- **Darkest Surface** (`#090909`): The darkest possible surface — barely distinguishable from pure black, used for footer or dark containers.
|
||||
|
||||
### Surface & Background
|
||||
- **Pure White** (`#ffffff`): The primary page background — not off-white, not cream, pure white. Button surfaces for secondary actions.
|
||||
- **Snow** (`#fafafa`): The subtlest possible surface distinction from white — used for section backgrounds and barely-elevated containers.
|
||||
- **Light Gray** (`#e5e5e5`): Button backgrounds, borders, and the primary containment color. The workhorse neutral.
|
||||
|
||||
### Neutrals & Text
|
||||
- **Stone** (`#737373`): Secondary body text, footer links, and de-emphasized content. The primary "muted" tone.
|
||||
- **Mid Gray** (`#525252`): Emphasized secondary text, slightly darker than Stone.
|
||||
- **Silver** (`#a3a3a3`): Tertiary text, placeholders, and deeply de-emphasized metadata.
|
||||
- **Button Text Dark** (`#404040`): Specific to white-surface button text.
|
||||
|
||||
### Semantic & Accent
|
||||
- **Ring Blue** (`#3b82f6` at 50%): The ONLY non-gray color in the entire system — Tailwind's default focus ring, used exclusively for keyboard accessibility. Never visible in normal interaction flow.
|
||||
- **Border Light** (`#d4d4d4`): A slightly darker gray for white-surface button borders.
|
||||
|
||||
### Gradient System
|
||||
- **None.** Ollama uses absolutely no gradients. Visual separation comes from flat color blocks and single-pixel borders. This is a deliberate, almost philosophical design choice.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Display**: `SF Pro Rounded`, with fallbacks: `system-ui, -apple-system, system-ui`
|
||||
- **Body / UI**: `ui-sans-serif`, with fallbacks: `system-ui, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji`
|
||||
- **Monospace**: `ui-monospace`, with fallbacks: `SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New`
|
||||
|
||||
*Note: SF Pro Rounded is Apple's system font — it renders with rounded terminals on macOS/iOS and falls back to the system sans-serif on other platforms.*
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display / Hero | SF Pro Rounded | 48px (3rem) | 500 | 1.00 (tight) | normal | Maximum impact, rounded letterforms |
|
||||
| Section Heading | SF Pro Rounded | 36px (2.25rem) | 500 | 1.11 (tight) | normal | Feature section titles |
|
||||
| Sub-heading | SF Pro Rounded / ui-sans-serif | 30px (1.88rem) | 400–500 | 1.20 (tight) | normal | Card headings, feature names |
|
||||
| Card Title | ui-sans-serif | 24px (1.5rem) | 400 | 1.33 | normal | Medium emphasis headings |
|
||||
| Body Large | ui-sans-serif | 18px (1.13rem) | 400–500 | 1.56 | normal | Hero descriptions, button text |
|
||||
| Body / Link | ui-sans-serif | 16px (1rem) | 400–500 | 1.50 | normal | Standard body text, navigation |
|
||||
| Caption | ui-sans-serif | 14px (0.88rem) | 400 | 1.43 | normal | Metadata, descriptions |
|
||||
| Small | ui-sans-serif | 12px (0.75rem) | 400 | 1.33 | normal | Smallest sans-serif text |
|
||||
| Code Body | ui-monospace | 16px (1rem) | 400 | 1.50 | normal | Inline code, commands |
|
||||
| Code Caption | ui-monospace | 14px (0.88rem) | 400 | 1.43 | normal | Code snippets, secondary |
|
||||
| Code Small | ui-monospace | 12px (0.75rem) | 400–700 | 1.63 | normal | Tags, labels |
|
||||
|
||||
### Principles
|
||||
- **Rounded display, standard body**: SF Pro Rounded carries display headlines with its distinctive rounded terminals, while the standard system sans handles all body text. The rounded font IS the brand expression.
|
||||
- **Weight restraint**: Only two weights matter — 400 (regular) for body and 500 (medium) for headings. No bold, no light, no black weight. This extreme restraint reinforces the minimal philosophy.
|
||||
- **Tight display, comfortable body**: Headlines compress to 1.0 line-height, while body text relaxes to 1.43–1.56. The contrast creates clear hierarchy without needing weight contrast.
|
||||
- **Monospace for developer identity**: Code blocks and terminal commands appear throughout as primary content, using the system monospace stack.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Gray Pill (Primary)**
|
||||
- Background: Light Gray (`#e5e5e5`)
|
||||
- Text: Near Black (`#262626`)
|
||||
- Padding: 10px 24px
|
||||
- Border: thin solid Light Gray (`1px solid #e5e5e5`)
|
||||
- Radius: pill-shaped (9999px)
|
||||
- The primary action button — understated, grayscale, always pill-shaped
|
||||
|
||||
**White Pill (Secondary)**
|
||||
- Background: Pure White (`#ffffff`)
|
||||
- Text: Button Text Dark (`#404040`)
|
||||
- Padding: 10px 24px
|
||||
- Border: thin solid Border Light (`1px solid #d4d4d4`)
|
||||
- Radius: pill-shaped (9999px)
|
||||
- Secondary action — visually lighter than Gray Pill
|
||||
|
||||
**Black Pill (CTA)**
|
||||
- Background: Pure Black (`#000000`)
|
||||
- Text: Pure White (`#ffffff`)
|
||||
- Radius: pill-shaped (9999px)
|
||||
- Inferred from "Create account" and "Explore" buttons
|
||||
- Maximum emphasis — black on white
|
||||
|
||||
### Cards & Containers
|
||||
- Background: Pure White or Snow (`#fafafa`)
|
||||
- Border: thin solid Light Gray (`1px solid #e5e5e5`) when needed
|
||||
- Radius: comfortably rounded (12px) — the ONLY non-pill radius in the system
|
||||
- Shadow: **none** — zero shadows on any element
|
||||
- Hover: likely subtle background shift or border darkening
|
||||
|
||||
### Inputs & Forms
|
||||
- Background: Pure White
|
||||
- Border: `1px solid #e5e5e5`
|
||||
- Radius: pill-shaped (9999px) — search inputs and form fields are pill-shaped
|
||||
- Focus: Ring Blue (`#3b82f6` at 50%) ring
|
||||
- Placeholder: Silver (`#a3a3a3`)
|
||||
|
||||
### Navigation
|
||||
- Clean horizontal nav with minimal elements
|
||||
- Logo: Ollama llama icon + wordmark in black
|
||||
- Links: "Models", "Docs", "Pricing" in black at 16px, weight 400
|
||||
- Search bar: pill-shaped with placeholder text
|
||||
- Right side: "Sign in" link + "Download" black pill CTA
|
||||
- No borders, no background — transparent nav on white page
|
||||
|
||||
### Image Treatment
|
||||
- The Ollama llama mascot is the only illustration — black line art on white
|
||||
- Code screenshots/terminal outputs shown in bordered containers (12px radius)
|
||||
- Integration logos displayed as simple icons in a grid
|
||||
- No photographs, no gradients, no decorative imagery
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Tab Pills**
|
||||
- Pill-shaped tab selectors (e.g., "Coding" | "OpenClaw")
|
||||
- Active: Light Gray bg; Inactive: transparent
|
||||
- All pill-shaped (9999px)
|
||||
|
||||
**Model Tags**
|
||||
- Small pill-shaped tags (e.g., "ollama", "launch", "claude")
|
||||
- Light Gray background, dark text
|
||||
- The primary way to browse models
|
||||
|
||||
**Terminal Command Block**
|
||||
- Monospace code showing `ollama run` commands
|
||||
- Minimal styling — just a bordered 12px-radius container
|
||||
- Copy button integrated
|
||||
|
||||
**Integration Grid**
|
||||
- Grid of integration logos (Codex, Claude Code, OpenCode, LangChain, etc.)
|
||||
- Each in a bordered pill or card with icon + name
|
||||
- Tabbed by category (Coding, Documents & RAG, Automation, Chat)
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 4px, 6px, 8px, 9px, 10px, 12px, 14px, 16px, 20px, 24px, 32px, 40px, 48px, 88px, 112px
|
||||
- Button padding: 10px 24px (consistent across all buttons)
|
||||
- Card internal padding: approximately 24–32px
|
||||
- Section vertical spacing: very generous (88px–112px)
|
||||
|
||||
### Grid & Container
|
||||
- Max container width: approximately 1024–1280px, centered
|
||||
- Hero: centered single-column with llama illustration
|
||||
- Feature sections: 2-column layout (text left, code right)
|
||||
- Integration grid: responsive multi-column
|
||||
- Footer: clean single-row
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Emptiness as luxury**: The page is remarkably short and sparse — no feature section overstays its welcome. Each concept gets minimal but sufficient space.
|
||||
- **Content density is low by design**: Where other AI companies pack feature after feature, Ollama presents three ideas (run models, use with apps, integrations) and stops.
|
||||
- **The white space IS the brand**: Pure white space with zero decoration communicates "this tool gets out of your way."
|
||||
|
||||
### Border Radius Scale
|
||||
- Comfortably rounded (12px): The sole container radius — code blocks, cards, panels
|
||||
- Pill-shaped (9999px): Everything interactive — buttons, tabs, inputs, tags, badges
|
||||
|
||||
*This binary system is extreme and distinctive. There is no 4px, no 8px, no gradient of roundness. Elements are either containers (12px) or interactive (pill).*
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow, no border | Page background, most content |
|
||||
| Bordered (Level 1) | `1px solid #e5e5e5` | Cards, code blocks, buttons |
|
||||
|
||||
**Shadow Philosophy**: Ollama uses **zero shadows**. This is not an oversight — it's a deliberate design decision. Every other major AI product site uses at least subtle shadows. Ollama's flat, shadowless approach creates a paper-like experience where elements are distinguished purely by background color and single-pixel borders. Depth is communicated through **content hierarchy and typography weight**, not visual layering.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use pure white (`#ffffff`) as the page background — never off-white or cream
|
||||
- Use pill-shaped (9999px) radius on all interactive elements — buttons, tabs, inputs, tags
|
||||
- Use 12px radius on all non-interactive containers — code blocks, cards, panels
|
||||
- Keep the palette strictly grayscale — no chromatic colors except the blue focus ring
|
||||
- Use SF Pro Rounded at weight 500 for display headings — the rounded terminals are the brand expression
|
||||
- Maintain zero shadows — depth comes from borders and background shifts only
|
||||
- Keep content density low — each section should present one clear idea
|
||||
- Use monospace for terminal commands and code — it's primary content, not decoration
|
||||
- Keep all buttons at 10px 24px padding with pill shape — consistency is absolute
|
||||
|
||||
### Don't
|
||||
- Don't introduce any chromatic color — no brand blue, no accent green, no warm tones
|
||||
- Don't use border-radius between 12px and 9999px — the system is binary
|
||||
- Don't add shadows to any element — the flat aesthetic is intentional
|
||||
- Don't use font weights above 500 — no bold, no black weight
|
||||
- Don't add decorative illustrations beyond the llama mascot
|
||||
- Don't use gradients anywhere — flat blocks and borders only
|
||||
- Don't overcomplicate the layout — two columns maximum, no complex grids
|
||||
- Don't use borders heavier than 1px — containment is always the lightest possible touch
|
||||
- Don't add hover animations or transitions — interactions should feel instant and direct
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <640px | Single column, stacked everything, hamburger nav |
|
||||
| Small Tablet | 640–768px | Minor adjustments to spacing |
|
||||
| Tablet | 768–850px | 2-column layouts begin |
|
||||
| Desktop | 850–1024px | Standard layout, expanded features |
|
||||
| Large Desktop | 1024–1280px | Maximum content width |
|
||||
|
||||
### Touch Targets
|
||||
- All buttons are pill-shaped with generous padding (10px 24px)
|
||||
- Navigation links at comfortable 16px size
|
||||
- Minimum touch area easily exceeds 44x44px
|
||||
|
||||
### Collapsing Strategy
|
||||
- **Navigation**: Collapses to hamburger menu on mobile
|
||||
- **Feature sections**: 2-column → stacked single column
|
||||
- **Hero text**: 48px → 36px → 30px progressive scaling
|
||||
- **Integration grid**: Multi-column → 2-column → single column
|
||||
- **Code blocks**: Horizontal scroll maintained
|
||||
|
||||
### Image Behavior
|
||||
- Llama mascot scales proportionally
|
||||
- Code blocks maintain monospace formatting
|
||||
- Integration icons reflow to fewer columns
|
||||
- No art direction changes
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary Text: "Pure Black (#000000)"
|
||||
- Page Background: "Pure White (#ffffff)"
|
||||
- Secondary Text: "Stone (#737373)"
|
||||
- Button Background: "Light Gray (#e5e5e5)"
|
||||
- Borders: "Light Gray (#e5e5e5)"
|
||||
- Muted Text: "Silver (#a3a3a3)"
|
||||
- Dark Text: "Near Black (#262626)"
|
||||
- Subtle Surface: "Snow (#fafafa)"
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on pure white (#ffffff) with an illustration centered above a headline at 48px SF Pro Rounded weight 500, line-height 1.0. Use Pure Black (#000000) text. Below, add a black pill-shaped CTA button (9999px radius, 10px 24px padding) and a gray pill button."
|
||||
- "Design a code block with a 12px border-radius, 1px solid Light Gray (#e5e5e5) border on white background. Use ui-monospace at 16px for the terminal command. No shadow."
|
||||
- "Build a tab bar with pill-shaped tabs (9999px radius). Active tab: Light Gray (#e5e5e5) background, Near Black (#262626) text. Inactive: transparent background, Stone (#737373) text."
|
||||
- "Create an integration card grid. Each card is a bordered pill (9999px radius) or a 12px-radius card with 1px solid #e5e5e5 border. Icon + name inside. Grid of 4 columns on desktop."
|
||||
- "Design a navigation bar: transparent background, no border. Ollama logo on the left, 3 text links (Pure Black, 16px, weight 400), pill search input in the center, 'Sign in' text link and black pill 'Download' button on the right."
|
||||
|
||||
### Iteration Guide
|
||||
1. Focus on ONE component at a time
|
||||
2. Keep all values grayscale — "Stone (#737373)" not "use a light color"
|
||||
3. Always specify pill (9999px) or container (12px) radius — nothing in between
|
||||
4. Shadows are always zero — never add them
|
||||
5. Weight is always 400 or 500 — never bold
|
||||
6. If something feels too decorated, remove it — less is always more for Ollama
|
||||
294
skills/creative/popular-web-designs/templates/opencode.ai.md
Normal file
294
skills/creative/popular-web-designs/templates/opencode.ai.md
Normal file
@@ -0,0 +1,294 @@
|
||||
# Design System: OpenCode
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `JetBrains Mono` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'JetBrains Mono', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
OpenCode's website embodies a terminal-native, monospace-first aesthetic that reflects its identity as an open source AI coding agent. The entire visual system is built on a stark dark-on-light contrast using a near-black background (`#201d1d`) with warm off-white text (`#fdfcfc`). This isn't a generic dark theme -- it's a warm, slightly reddish-brown dark that feels like a sophisticated terminal emulator rather than a cold IDE. The warm undertone in both the darks and lights (notice the subtle red channel in `#201d1d` -- rgb(32, 29, 29)) creates a cohesive, lived-in quality.
|
||||
|
||||
Berkeley Mono is the sole typeface, establishing an unapologetic monospace identity. Every element -- headings, body text, buttons, navigation -- shares this single font family, creating a unified "everything is code" philosophy. The heading at 38px bold with 1.50 line-height is generous and readable, while body text at 16px with weight 500 provides a slightly heavier-than-normal reading weight that enhances legibility on screen. The monospace grid naturally enforces alignment and rhythm across the layout.
|
||||
|
||||
The color system is deliberately minimal. The primary palette consists of just three functional tones: the warm near-black (`#201d1d`), a medium warm gray (`#9a9898`), and a bright off-white (`#fdfcfc`). Semantic colors borrow from the Apple HIG palette -- blue accent (`#007aff`), red danger (`#ff3b30`), green success (`#30d158`), orange warning (`#ff9f0a`) -- giving the interface familiar, trustworthy signal colors without adding brand complexity. Borders use a subtle warm transparency (`rgba(15, 0, 0, 0.12)`) that ties into the warm undertone of the entire system.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Berkeley Mono as the sole typeface -- monospace everywhere, no sans-serif or serif voices
|
||||
- Warm near-black primary (`#201d1d`) with reddish-brown undertone, not pure black
|
||||
- Off-white text (`#fdfcfc`) with warm tint, not pure white
|
||||
- Minimal 4px border radius throughout -- sharp, utilitarian corners
|
||||
- 8px base spacing system scaling up to 96px
|
||||
- Apple HIG-inspired semantic colors (blue, red, green, orange)
|
||||
- Transparent warm borders using `rgba(15, 0, 0, 0.12)`
|
||||
- Email input with generous 20px padding and 6px radius -- the most generous component radius
|
||||
- Single button variant: dark background, light text, tight vertical padding (4px 20px)
|
||||
- Underlined links as default link style, reinforcing the text-centric identity
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **OpenCode Dark** (`#201d1d`): Primary background, button fills, link text. A warm near-black with subtle reddish-brown warmth -- rgb(32, 29, 29).
|
||||
- **OpenCode Light** (`#fdfcfc`): Primary text on dark surfaces, button text. A barely-warm off-white that avoids clinical pure white.
|
||||
- **Mid Gray** (`#9a9898`): Secondary text, muted links. A neutral warm gray that bridges dark and light.
|
||||
|
||||
### Secondary
|
||||
- **Dark Surface** (`#302c2c`): Slightly lighter than primary dark, used for elevated surfaces and subtle differentiation.
|
||||
- **Border Gray** (`#646262`): Stronger borders, outline rings on interactive elements.
|
||||
- **Light Surface** (`#f1eeee`): Light mode surface, subtle background variation.
|
||||
|
||||
### Accent
|
||||
- **Accent Blue** (`#007aff`): Primary accent, links, interactive highlights. Apple system blue.
|
||||
- **Accent Blue Hover** (`#0056b3`): Darker blue for hover states.
|
||||
- **Accent Blue Active** (`#004085`): Deepest blue for pressed/active states.
|
||||
|
||||
### Semantic
|
||||
- **Danger Red** (`#ff3b30`): Error states, destructive actions. Apple system red.
|
||||
- **Danger Hover** (`#d70015`): Darker red for hover on danger elements.
|
||||
- **Danger Active** (`#a50011`): Deepest red for pressed danger states.
|
||||
- **Success Green** (`#30d158`): Success states, positive feedback. Apple system green.
|
||||
- **Warning Orange** (`#ff9f0a`): Warning states, caution signals. Apple system orange.
|
||||
- **Warning Hover** (`#cc7f08`): Darker orange for hover on warning elements.
|
||||
- **Warning Active** (`#995f06`): Deepest orange for pressed warning states.
|
||||
|
||||
### Text Scale
|
||||
- **Text Muted** (`#6e6e73`): Muted labels, disabled text, placeholder content.
|
||||
- **Text Secondary** (`#424245`): Secondary text on light backgrounds, captions.
|
||||
|
||||
### Border
|
||||
- **Border Warm** (`rgba(15, 0, 0, 0.12)`): Primary border color, warm transparent black with red tint.
|
||||
- **Border Tab** (`#9a9898`): Tab underline border, 2px solid bottom.
|
||||
- **Border Outline** (`#646262`): 1px solid outline border for containers.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Universal**: `Berkeley Mono`, with fallbacks: `IBM Plex Mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Size | Weight | Line Height | Notes |
|
||||
|------|------|--------|-------------|-------|
|
||||
| Heading 1 | 38px (2.38rem) | 700 | 1.50 | Hero headlines, page titles |
|
||||
| Heading 2 | 16px (1.00rem) | 700 | 1.50 | Section titles, bold emphasis |
|
||||
| Body | 16px (1.00rem) | 400 | 1.50 | Standard body text, paragraphs |
|
||||
| Body Medium | 16px (1.00rem) | 500 | 1.50 | Links, button text, nav items |
|
||||
| Body Tight | 16px (1.00rem) | 500 | 1.00 (tight) | Compact labels, tab items |
|
||||
| Caption | 14px (0.88rem) | 400 | 2.00 (relaxed) | Footnotes, metadata, small labels |
|
||||
|
||||
### Principles
|
||||
- **One font, one voice**: Berkeley Mono is used exclusively. There is no typographic variation between display, body, and code -- everything speaks in the same monospace register. Hierarchy is achieved through size and weight alone.
|
||||
- **Weight as hierarchy**: 700 for headings, 500 for interactive/medium emphasis, 400 for body text. Three weight levels create the entire hierarchy.
|
||||
- **Generous line-height**: 1.50 as the standard line-height gives text room to breathe within the monospace grid. The relaxed 2.00 line-height on captions creates clear visual separation.
|
||||
- **Tight for interaction**: Interactive elements (tabs, compact labels) use 1.00 line-height for dense, clickable targets.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary (Dark Fill)**
|
||||
- Background: `#201d1d` (OpenCode Dark)
|
||||
- Text: `#fdfcfc` (OpenCode Light)
|
||||
- Padding: 4px 20px
|
||||
- Radius: 4px
|
||||
- Font: 16px Berkeley Mono, weight 500, line-height 2.00 (relaxed)
|
||||
- Outline: `rgb(253, 252, 252) none 0px`
|
||||
- Use: Primary CTAs, main actions
|
||||
|
||||
### Inputs
|
||||
|
||||
**Email Input**
|
||||
- Background: `#f8f7f7` (light neutral)
|
||||
- Text: `#201d1d`
|
||||
- Border: `1px solid rgba(15, 0, 0, 0.12)`
|
||||
- Padding: 20px
|
||||
- Radius: 6px
|
||||
- Font: Berkeley Mono, standard size
|
||||
- Use: Form fields, email capture
|
||||
|
||||
### Links
|
||||
|
||||
**Default Link**
|
||||
- Color: `#201d1d`
|
||||
- Decoration: underline 1px
|
||||
- Font-weight: 500
|
||||
- Use: Primary text links in body content
|
||||
|
||||
**Light Link**
|
||||
- Color: `#fdfcfc`
|
||||
- Decoration: none
|
||||
- Use: Links on dark backgrounds, navigation
|
||||
|
||||
**Muted Link**
|
||||
- Color: `#9a9898`
|
||||
- Decoration: none
|
||||
- Use: Footer links, secondary navigation
|
||||
|
||||
### Tabs
|
||||
|
||||
**Tab Navigation**
|
||||
- Border-bottom: `2px solid #9a9898` (active tab indicator)
|
||||
- Font: 16px, weight 500, line-height 1.00
|
||||
- Use: Section switching, content filtering
|
||||
|
||||
### Navigation
|
||||
- Clean horizontal layout with Berkeley Mono throughout
|
||||
- Brand logotype left-aligned in monospace
|
||||
- Links at 16px weight 500 with underline decoration
|
||||
- Dark background matching page background
|
||||
- No backdrop blur or transparency -- solid surfaces only
|
||||
|
||||
### Image Treatment
|
||||
- Terminal/code screenshots as hero imagery
|
||||
- Dark terminal aesthetic with monospace type
|
||||
- Minimal borders, content speaks for itself
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Terminal Hero**
|
||||
- Full-width dark terminal window as hero element
|
||||
- ASCII art / stylized logo within terminal frame
|
||||
- Monospace command examples with syntax highlighting
|
||||
- Reinforces the CLI-first identity of the product
|
||||
|
||||
**Feature List**
|
||||
- Bulleted feature items with Berkeley Mono text
|
||||
- Weight 500 for feature names, 400 for descriptions
|
||||
- Tight vertical spacing between items
|
||||
- No cards or borders -- pure text layout
|
||||
|
||||
**Email Capture**
|
||||
- Light background input (`#f8f7f7`) contrasting dark page
|
||||
- Generous 20px padding for comfortable typing
|
||||
- 6px radius -- the roundest element in the system
|
||||
- Newsletter/waitlist pattern
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Fine scale: 1px, 2px, 4px (sub-8px for borders and micro-adjustments)
|
||||
- Standard scale: 8px, 12px, 16px, 20px, 24px
|
||||
- Extended scale: 32px, 40px, 48px, 64px, 80px, 96px
|
||||
- The system follows a clean 4/8px grid with consistent doubling
|
||||
|
||||
### Grid & Container
|
||||
- Max content width: approximately 800-900px (narrow, reading-optimized)
|
||||
- Single-column layout as the primary pattern
|
||||
- Centered content with generous horizontal margins
|
||||
- Hero section: full-width dark terminal element
|
||||
- Feature sections: single-column text blocks
|
||||
- Footer: multi-column link grid
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Monospace rhythm**: The fixed-width nature of Berkeley Mono creates a natural vertical grid. Line-heights of 1.50 and 2.00 maintain consistent rhythm.
|
||||
- **Narrow and focused**: Content is constrained to a narrow column, creating generous side margins that focus attention on the text.
|
||||
- **Sections through spacing**: No decorative dividers. Sections are separated by generous vertical spacing (48-96px) rather than borders or background changes.
|
||||
|
||||
### Border Radius Scale
|
||||
- Micro (4px): Default for all elements -- buttons, containers, badges
|
||||
- Input (6px): Form inputs get slightly more roundness
|
||||
- The entire system uses just two radius values, reinforcing the utilitarian aesthetic
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow, no border | Default state for most elements |
|
||||
| Border Subtle (Level 1) | `1px solid rgba(15, 0, 0, 0.12)` | Section dividers, input borders, horizontal rules |
|
||||
| Border Tab (Level 2) | `2px solid #9a9898` bottom only | Active tab indicator |
|
||||
| Border Outline (Level 3) | `1px solid #646262` | Container outlines, elevated elements |
|
||||
|
||||
**Shadow Philosophy**: OpenCode's depth system is intentionally flat. There are no box-shadows in the extracted tokens -- zero shadow values were detected. Depth is communicated exclusively through border treatments and background color shifts. This flatness is consistent with the terminal aesthetic: terminals don't have shadows, and neither does OpenCode. The three border levels (transparent warm, tab indicator, solid outline) create sufficient visual hierarchy without any elevation illusion.
|
||||
|
||||
### Decorative Depth
|
||||
- Background color shifts between `#201d1d` and `#302c2c` create subtle surface differentiation
|
||||
- Transparent borders at 12% opacity provide barely-visible structure
|
||||
- The warm reddish tint in border colors (`rgba(15, 0, 0, 0.12)`) ties borders to the overall warm dark palette
|
||||
- No gradients, no blurs, no ambient effects -- pure flat terminal aesthetic
|
||||
|
||||
## 7. Interaction & Motion
|
||||
|
||||
### Hover States
|
||||
- Links: color shift from default to accent blue (`#007aff`) or underline style change
|
||||
- Buttons: subtle background lightening or border emphasis
|
||||
- Accent blue provides a three-stage hover sequence: `#007aff` → `#0056b3` → `#004085` (default → hover → active)
|
||||
- Danger red: `#ff3b30` → `#d70015` → `#a50011`
|
||||
- Warning orange: `#ff9f0a` → `#cc7f08` → `#995f06`
|
||||
|
||||
### Focus States
|
||||
- Border-based focus: increased border opacity or solid border color
|
||||
- No shadow-based focus rings -- consistent with the flat, no-shadow aesthetic
|
||||
- Keyboard focus likely uses outline or border color shift to accent blue
|
||||
|
||||
### Transitions
|
||||
- Minimal transitions expected -- terminal-inspired interfaces favor instant state changes
|
||||
- Color transitions: 100-150ms for subtle state feedback
|
||||
- No scale, rotate, or complex transform animations
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <640px | Single column, reduced padding, heading scales down |
|
||||
| Tablet | 640-1024px | Content width expands, slight padding increase |
|
||||
| Desktop | >1024px | Full content width (~800-900px centered), maximum whitespace |
|
||||
|
||||
### Touch Targets
|
||||
- Buttons with 4px 20px padding provide adequate horizontal touch area
|
||||
- Input fields with 20px padding ensure comfortable mobile typing
|
||||
- Tab items at 16px with tight line-height may need mobile adaptation
|
||||
|
||||
### Collapsing Strategy
|
||||
- Hero heading: 38px → 28px → 24px on smaller screens
|
||||
- Navigation: horizontal links → hamburger/drawer on mobile
|
||||
- Feature lists: maintain single-column, reduce horizontal padding
|
||||
- Terminal hero: maintain full-width, reduce internal padding
|
||||
- Footer columns: multi-column → stacked single column
|
||||
- Section spacing: 96px → 64px → 48px on mobile
|
||||
|
||||
### Image Behavior
|
||||
- Terminal screenshots maintain aspect ratio and border treatment
|
||||
- Full-width elements scale proportionally
|
||||
- Monospace type maintains readability at all sizes due to fixed-width nature
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Page background: `#201d1d` (warm near-black)
|
||||
- Primary text: `#fdfcfc` (warm off-white)
|
||||
- Secondary text: `#9a9898` (warm gray)
|
||||
- Muted text: `#6e6e73`
|
||||
- Accent: `#007aff` (blue)
|
||||
- Danger: `#ff3b30` (red)
|
||||
- Success: `#30d158` (green)
|
||||
- Warning: `#ff9f0a` (orange)
|
||||
- Button bg: `#201d1d`, button text: `#fdfcfc`
|
||||
- Border: `rgba(15, 0, 0, 0.12)` (warm transparent)
|
||||
- Input bg: `#f8f7f7`, input border: `rgba(15, 0, 0, 0.12)`
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on `#201d1d` warm dark background. Headline at 38px Berkeley Mono weight 700, line-height 1.50, color `#fdfcfc`. Subtitle at 16px weight 400, color `#9a9898`. Primary CTA button (`#201d1d` bg with `1px solid #646262` border, 4px radius, 4px 20px padding, `#fdfcfc` text at weight 500)."
|
||||
- "Design a feature list: single-column on `#201d1d` background. Feature name at 16px Berkeley Mono weight 700, color `#fdfcfc`. Description at 16px weight 400, color `#9a9898`. No cards, no borders -- pure text with 16px vertical gap between items."
|
||||
- "Build an email capture form: `#f8f7f7` background input, `1px solid rgba(15, 0, 0, 0.12)` border, 6px radius, 20px padding. Adjacent dark button (`#201d1d` bg, `#fdfcfc` text, 4px radius, 4px 20px padding). Berkeley Mono throughout."
|
||||
- "Create navigation: sticky `#201d1d` background. 16px Berkeley Mono weight 500 for links, `#fdfcfc` text. Brand name left-aligned in monospace. Links with underline decoration. No blur, no transparency -- solid dark surface."
|
||||
- "Design a footer: `#201d1d` background, multi-column link grid. Links at 16px Berkeley Mono weight 400, color `#9a9898`. Section headers at weight 700. Border-top `1px solid rgba(15, 0, 0, 0.12)` separator."
|
||||
|
||||
### Iteration Guide
|
||||
1. Berkeley Mono is the only font -- never introduce a second typeface. Size and weight create all hierarchy.
|
||||
2. Keep surfaces flat: no shadows, no gradients, no blur effects. Use borders and background shifts only.
|
||||
3. The warm undertone matters: use `#201d1d` not `#000000`, use `#fdfcfc` not `#ffffff`. The reddish warmth is subtle but essential.
|
||||
4. Border radius is 4px everywhere except inputs (6px). Never use rounded pills or large radii.
|
||||
5. Semantic colors follow Apple HIG: `#007aff` blue, `#ff3b30` red, `#30d158` green, `#ff9f0a` orange. Each has hover and active darkened variants.
|
||||
6. Three-stage interaction: default → hover (darkened) → active (deeply darkened) for all semantic colors.
|
||||
7. Borders use `rgba(15, 0, 0, 0.12)` -- a warm transparent dark, not neutral gray. This ties borders to the warm palette.
|
||||
8. Spacing follows an 8px grid: 8, 16, 24, 32, 40, 48, 64, 80, 96px. Use 4px for fine adjustments only.
|
||||
243
skills/creative/popular-web-designs/templates/pinterest.md
Normal file
243
skills/creative/popular-web-designs/templates/pinterest.md
Normal file
@@ -0,0 +1,243 @@
|
||||
# Design System: Pinterest
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `DM Sans` | **Mono:** `system monospace stack`
|
||||
> - **Font stack (CSS):** `font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Pinterest's website is a warm, inspiration-driven canvas that treats visual discovery like a lifestyle magazine. The design operates on a soft, slightly warm white background with Pinterest Red (`#e60023`) as the singular, bold brand accent. Unlike the cool blues of most tech platforms, Pinterest's neutral scale has a distinctly warm undertone — grays lean toward olive/sand (`#91918c`, `#62625b`, `#e5e5e0`) rather than cool steel, creating a cozy, craft-like atmosphere that invites browsing.
|
||||
|
||||
The typography uses Pin Sans — a custom proprietary font with a broad fallback stack including Japanese fonts, reflecting Pinterest's global reach. At display scale (70px, weight 600), Pin Sans creates large, inviting headlines. At smaller sizes, the system is compact: buttons at 12px, captions at 12–14px. The CSS variable naming system (`--comp-*`, `--sema-*`, `--base-*`) reveals a sophisticated three-tier design token architecture: component-level, semantic-level, and base-level tokens.
|
||||
|
||||
What distinguishes Pinterest is its generous border-radius system (12px–40px, plus 50% for circles) and warm-tinted button backgrounds. The secondary button (`#e5e5e0`) has a distinctly warm, sand-like tone rather than cold gray. The primary red button uses 16px radius — rounded but not pill-shaped. Combined with warm badge backgrounds (`hsla(60,20%,98%,.5)` — a subtle yellow-warm wash) and photography-dominant layouts, the result is a design that feels handcrafted and personal, not corporate and sterile.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Warm white canvas with olive/sand-toned neutrals — cozy, not clinical
|
||||
- Pinterest Red (`#e60023`) as singular bold accent — never subtle, always confident
|
||||
- Pin Sans custom font with global fallback stack (including CJK)
|
||||
- Three-tier token architecture: `--comp-*` / `--sema-*` / `--base-*`
|
||||
- Warm secondary surfaces: sand gray (`#e5e5e0`), warm badge (`hsla(60,20%,98%,.5)`)
|
||||
- Generous border-radius: 16px standard, up to 40px for large containers
|
||||
- Photography-first content — pins/images are the primary visual element
|
||||
- Dark near-purple text (`#211922`) — warm, with a hint of plum
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary Brand
|
||||
- **Pinterest Red** (`#e60023`): Primary CTA, brand accent — bold, confident red
|
||||
- **Green 700** (`#103c25`): `--base-color-green-700`, success/nature accent
|
||||
- **Green 700 Hover** (`#0b2819`): `--base-color-hover-green-700`, pressed green
|
||||
|
||||
### Text
|
||||
- **Plum Black** (`#211922`): Primary text — warm near-black with plum undertone
|
||||
- **Black** (`#000000`): Secondary text, button text
|
||||
- **Olive Gray** (`#62625b`): Secondary descriptions, muted text
|
||||
- **Warm Silver** (`#91918c`): `--comp-button-color-text-transparent-disabled`, disabled text, input borders
|
||||
- **White** (`#ffffff`): Text on dark/colored surfaces
|
||||
|
||||
### Interactive
|
||||
- **Focus Blue** (`#435ee5`): `--comp-button-color-border-focus-outer-transparent`, focus rings
|
||||
- **Performance Purple** (`#6845ab`): `--sema-color-hover-icon-performance-plus`, performance features
|
||||
- **Recommendation Purple** (`#7e238b`): `--sema-color-hover-text-recommendation`, AI recommendation
|
||||
- **Link Blue** (`#2b48d4`): Link text color
|
||||
- **Facebook Blue** (`#0866ff`): `--facebook-background-color`, social login
|
||||
- **Pressed Blue** (`#617bff`): `--base-color-pressed-blue-200`, pressed state
|
||||
|
||||
### Surface & Border
|
||||
- **Sand Gray** (`#e5e5e0`): Secondary button background — warm, craft-like
|
||||
- **Warm Light** (`#e0e0d9`): Circular button backgrounds, badges
|
||||
- **Warm Wash** (`hsla(60, 20%, 98%, 0.5)`): `--comp-badge-color-background-wash-light`, subtle warm badge bg
|
||||
- **Fog** (`#f6f6f3`): Light surface (at 50% opacity)
|
||||
- **Border Disabled** (`#c8c8c1`): `--sema-color-border-disabled`, disabled borders
|
||||
- **Hover Gray** (`#bcbcb3`): `--base-color-hover-grayscale-150`, hover border
|
||||
- **Dark Surface** (`#33332e`): Dark section backgrounds
|
||||
|
||||
### Semantic
|
||||
- **Error Red** (`#9e0a0a`): Checkbox/form error states
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Primary**: `Pin Sans`, fallbacks: `-apple-system, system-ui, Segoe UI, Roboto, Oxygen-Sans, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, Helvetica, ヒラギノ角ゴ Pro W3, メイリオ, Meiryo, MS Pゴシック, Arial`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | Pin Sans | 70px (4.38rem) | 600 | normal | normal | Maximum impact |
|
||||
| Section Heading | Pin Sans | 28px (1.75rem) | 700 | normal | -1.2px | Negative tracking |
|
||||
| Body | Pin Sans | 16px (1.00rem) | 400 | 1.40 | normal | Standard reading |
|
||||
| Caption Bold | Pin Sans | 14px (0.88rem) | 700 | normal | normal | Strong metadata |
|
||||
| Caption | Pin Sans | 12px (0.75rem) | 400–500 | 1.50 | normal | Small text, tags |
|
||||
| Button | Pin Sans | 12px (0.75rem) | 400 | normal | normal | Button labels |
|
||||
|
||||
### Principles
|
||||
- **Compact type scale**: The range is 12px–70px with a dramatic jump — most functional text is 12–16px, creating a dense, app-like information hierarchy.
|
||||
- **Warm weight distribution**: 600–700 for headings, 400–500 for body. No ultra-light weights — the type always feels substantial.
|
||||
- **Negative tracking on headings**: -1.2px on 28px headings creates cozy, intimate section titles.
|
||||
- **Single font family**: Pin Sans handles everything — no secondary display or monospace font detected.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Primary Red**
|
||||
- Background: `#e60023` (Pinterest Red)
|
||||
- Text: `#000000` (black — unusual choice for contrast on red)
|
||||
- Padding: 6px 14px
|
||||
- Radius: 16px (generously rounded, not pill)
|
||||
- Border: `2px solid rgba(255, 255, 255, 0)` (transparent)
|
||||
- Focus: semantic border + outline via CSS variables
|
||||
|
||||
**Secondary Sand**
|
||||
- Background: `#e5e5e0` (warm sand gray)
|
||||
- Text: `#000000`
|
||||
- Padding: 6px 14px
|
||||
- Radius: 16px
|
||||
- Focus: same semantic border system
|
||||
|
||||
**Circular Action**
|
||||
- Background: `#e0e0d9` (warm light)
|
||||
- Text: `#211922` (plum black)
|
||||
- Radius: 50% (circle)
|
||||
- Use: Pin actions, navigation controls
|
||||
|
||||
**Ghost / Transparent**
|
||||
- Background: transparent
|
||||
- Text: `#000000`
|
||||
- No border
|
||||
- Use: Tertiary actions
|
||||
|
||||
### Cards & Containers
|
||||
- Photography-first pin cards with generous radius (12px–20px)
|
||||
- No traditional box-shadow on most cards
|
||||
- White or warm fog backgrounds
|
||||
- 8px white thick border on some image containers
|
||||
|
||||
### Inputs
|
||||
- Email input: white background, `1px solid #91918c` border, 16px radius, 11px 15px padding
|
||||
- Focus: semantic border + outline system via CSS variables
|
||||
|
||||
### Navigation
|
||||
- Clean header on white or warm background
|
||||
- Pinterest logo + search bar centered
|
||||
- Pin Sans 16px for nav links
|
||||
- Pinterest Red accents for active states
|
||||
|
||||
### Image Treatment
|
||||
- Pin-style masonry grid (signature Pinterest layout)
|
||||
- Rounded corners: 12px–20px on images
|
||||
- Photography as primary content — every pin is an image
|
||||
- Thick white borders (8px) on featured image containers
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 4px, 6px, 7px, 8px, 10px, 11px, 12px, 16px, 18px, 20px, 22px, 24px, 32px, 80px, 100px
|
||||
- Large jumps: 32px → 80px → 100px for section spacing
|
||||
|
||||
### Grid & Container
|
||||
- Masonry grid for pin content (signature layout)
|
||||
- Centered content sections with generous max-width
|
||||
- Full-width dark footer
|
||||
- Search bar as primary navigation element
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Inspiration density**: The masonry grid packs pins tightly — the content density IS the value proposition. Whitespace exists between sections, not within the grid.
|
||||
- **Breathing above, density below**: Hero/feature sections get generous padding; the pin grid is compact and immersive.
|
||||
|
||||
### Border Radius Scale
|
||||
- Standard (12px): Small cards, links
|
||||
- Button (16px): Buttons, inputs, medium cards
|
||||
- Comfortable (20px): Feature cards
|
||||
- Large (28px): Large containers
|
||||
- Section (32px): Tab elements, large panels
|
||||
- Hero (40px): Hero containers, large feature blocks
|
||||
- Circle (50%): Action buttons, tab indicators
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow | Default — pins rely on content, not shadow |
|
||||
| Subtle (Level 1) | Minimal shadow (from tokens) | Elevated overlays, dropdowns |
|
||||
| Focus (Accessibility) | `--sema-color-border-focus-outer-default` ring | Focus states |
|
||||
|
||||
**Shadow Philosophy**: Pinterest uses minimal shadows. The masonry grid relies on content (photography) to create visual interest rather than elevation effects. Depth comes from the warmth of surface colors and the generous rounding of containers.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use warm neutrals (`#e5e5e0`, `#e0e0d9`, `#91918c`) — the warm olive/sand tone is the identity
|
||||
- Apply Pinterest Red (`#e60023`) only for primary CTAs — it's bold and singular
|
||||
- Use Pin Sans exclusively — one font for everything
|
||||
- Apply generous border-radius: 16px for buttons/inputs, 20px+ for cards
|
||||
- Keep the masonry grid dense — content density is the value
|
||||
- Use warm badge backgrounds (`hsla(60,20%,98%,.5)`) for subtle warm washes
|
||||
- Use `#211922` (plum black) for primary text — it's warmer than pure black
|
||||
|
||||
### Don't
|
||||
- Don't use cool gray neutrals — always warm/olive-toned
|
||||
- Don't use pure black (`#000000`) as primary text — use plum black (`#211922`)
|
||||
- Don't use pill-shaped buttons — 16px radius is rounded but not pill
|
||||
- Don't add heavy shadows — Pinterest is flat by design, depth from content
|
||||
- Don't use small border-radius (<12px) on cards — the generous rounding is core
|
||||
- Don't introduce additional brand colors — red + warm neutrals is the complete palette
|
||||
- Don't use thin font weights — Pin Sans at 400 minimum
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <576px | Single column, compact layout |
|
||||
| Mobile Large | 576–768px | 2-column pin grid |
|
||||
| Tablet | 768–890px | Expanded grid |
|
||||
| Desktop Small | 890–1312px | Standard masonry grid |
|
||||
| Desktop | 1312–1440px | Full layout |
|
||||
| Large Desktop | 1440–1680px | Expanded grid columns |
|
||||
| Ultra-wide | >1680px | Maximum grid density |
|
||||
|
||||
### Collapsing Strategy
|
||||
- Pin grid: 5+ columns → 3 → 2 → 1
|
||||
- Navigation: search bar + icons → simplified mobile nav
|
||||
- Feature sections: side-by-side → stacked
|
||||
- Hero: 70px → scales down proportionally
|
||||
- Footer: dark multi-column → stacked
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Brand: Pinterest Red (`#e60023`)
|
||||
- Background: White (`#ffffff`)
|
||||
- Text: Plum Black (`#211922`)
|
||||
- Secondary text: Olive Gray (`#62625b`)
|
||||
- Button surface: Sand Gray (`#e5e5e0`)
|
||||
- Border: Warm Silver (`#91918c`)
|
||||
- Focus: Focus Blue (`#435ee5`)
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero: white background. Headline at 70px Pin Sans weight 600, plum black (#211922). Red CTA button (#e60023, 16px radius, 6px 14px padding). Secondary sand button (#e5e5e0, 16px radius)."
|
||||
- "Design a pin card: white background, 16px radius, no shadow. Photography fills top, 16px Pin Sans weight 400 description below in #62625b."
|
||||
- "Build a circular action button: #e0e0d9 background, 50% radius, #211922 icon."
|
||||
- "Create an input field: white background, 1px solid #91918c, 16px radius, 11px 15px padding. Focus: blue outline via semantic tokens."
|
||||
- "Design the dark footer: #33332e background. Pinterest script logo in white. 12px Pin Sans links in #91918c."
|
||||
|
||||
### Iteration Guide
|
||||
1. Warm neutrals everywhere — olive/sand grays, never cool steel
|
||||
2. Pinterest Red for CTAs only — bold and singular
|
||||
3. 16px radius on buttons/inputs, 20px+ on cards — generous but not pill
|
||||
4. Pin Sans is the only font — compact at 12px for UI, 70px for display
|
||||
5. Photography carries the design — the UI stays warm and minimal
|
||||
6. Plum black (#211922) for text — warmer than pure black
|
||||
269
skills/creative/popular-web-designs/templates/posthog.md
Normal file
269
skills/creative/popular-web-designs/templates/posthog.md
Normal file
@@ -0,0 +1,269 @@
|
||||
# Design System: PostHog
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
PostHog's website feels like a startup's internal wiki that escaped into the wild — warm, irreverent, and deliberately anti-corporate. The background isn't the expected crisp white or dark void of developer tools; it's a warm, sage-tinted cream (`#fdfdf8`) that gives every surface a handmade, paper-like quality. Colors lean into earthy olive greens and muted sage rather than the conventional blues and purples of the SaaS world. It's as if someone designed a developer analytics platform inside a cozy garden shed.
|
||||
|
||||
The personality is the star: hand-drawn hedgehog illustrations, quirky action figures, and playful imagery replace the stock photography and abstract gradients typical of B2B SaaS. IBM Plex Sans Variable serves as the typographic foundation — a font with genuine technical credibility (created by IBM, widely used in developer contexts) deployed here with bold weights (700, 800) on headings and generous line-heights on body text. The typography says "we're serious engineers" while everything around it says "but we don't take ourselves too seriously."
|
||||
|
||||
The interaction design carries the same spirit: hover states flash PostHog Orange (`#F54E00`) text — a hidden brand color that doesn't appear at rest but surprises on interaction. Dark near-black buttons (`#1e1f23`) use opacity reduction on hover rather than color shifts, and active states scale slightly. The border system uses sage-tinted grays (`#bfc1b7`) that harmonize with the olive text palette. Built on Tailwind CSS with Radix UI and shadcn/ui primitives, the technical foundation is modern and component-driven, but the visual output is stubbornly unique.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Warm sage/olive color palette instead of conventional blues — earthy and approachable
|
||||
- IBM Plex Sans Variable font at bold weights (700/800) for headings with generous 1.50+ line-heights
|
||||
- Hidden brand orange (`#F54E00`) that only appears on hover interactions — a delightful surprise
|
||||
- Hand-drawn hedgehog illustrations and playful imagery — deliberately anti-corporate
|
||||
- Sage-tinted borders (`#bfc1b7`) and backgrounds (`#eeefe9`) creating a unified warm-green system
|
||||
- Dark near-black CTAs (`#1e1f23`) with opacity-based hover states
|
||||
- Content-heavy editorial layout — the site reads like a magazine, not a typical landing page
|
||||
- Tailwind CSS + Radix UI + shadcn/ui component architecture
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Olive Ink** (`#4d4f46`): Primary text color — a distinctive olive-gray that gives all text a warm, earthy tone
|
||||
- **Deep Olive** (`#23251d`): Link text and high-emphasis headings — near-black with green undertone
|
||||
- **PostHog Orange** (`#F54E00`): Hidden brand accent — appears only on hover states, a vibrant orange that surprises
|
||||
|
||||
### Secondary & Accent
|
||||
- **Amber Gold** (`#F7A501`): Secondary hover accent on dark buttons — warm gold that pairs with the orange
|
||||
- **Gold Border** (`#b17816`): Special button borders — an amber-gold for featured CTAs
|
||||
- **Focus Blue** (`#3b82f6`): Focus ring color (Tailwind default) — the only blue in the system, reserved for accessibility
|
||||
|
||||
### Surface & Background
|
||||
- **Warm Parchment** (`#fdfdf8`): Primary page background — warm near-white with yellow-green undertone
|
||||
- **Sage Cream** (`#eeefe9`): Input backgrounds, secondary surfaces — light sage tint
|
||||
- **Light Sage** (`#e5e7e0`): Button backgrounds, tertiary surfaces — muted sage-green
|
||||
- **Warm Tan** (`#d4c9b8`): Featured button backgrounds — warm tan/khaki for emphasis
|
||||
- **Hover White** (`#f4f4f4`): Universal hover background state
|
||||
|
||||
### Neutrals & Text
|
||||
- **Olive Ink** (`#4d4f46`): Primary body and UI text
|
||||
- **Muted Olive** (`#65675e`): Secondary text, button labels on light backgrounds
|
||||
- **Sage Placeholder** (`#9ea096`): Placeholder text, disabled states — warm sage-green
|
||||
- **Sage Border** (`#bfc1b7`): Primary border color — olive-tinted gray for all borders
|
||||
- **Light Border** (`#b6b7af`): Secondary border, toolbar borders — slightly darker sage
|
||||
|
||||
### Semantic & Accent
|
||||
- **PostHog Orange** (`#F54E00`): Hover text accent — signals interactivity and brand personality
|
||||
- **Amber Gold** (`#F7A501`): Dark button hover accent — warmth signal
|
||||
- **Focus Blue** (`#3b82f6` at 50% opacity): Keyboard focus rings — accessibility-only color
|
||||
- **Dark Text** (`#111827`): High-contrast link text — near-black for important links
|
||||
|
||||
### Gradient System
|
||||
- No gradients on the marketing site — PostHog's visual language is deliberately flat and warm
|
||||
- Depth is achieved through layered surfaces and border containment, not color transitions
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Display & Body**: `IBM Plex Sans Variable` — variable font (100–700+ weight range). Fallbacks: `IBM Plex Sans, -apple-system, system-ui, Avenir Next, Avenir, Segoe UI, Helvetica Neue, Helvetica, Ubuntu, Roboto, Noto, Arial`
|
||||
- **Monospace**: `ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New` — system monospace stack
|
||||
- **Code Display**: `Source Code Pro` — with fallbacks: `Menlo, Consolas, Monaco`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | IBM Plex Sans Variable | 30px | 800 | 1.20 | -0.75px | Extra-bold, tight, maximum impact |
|
||||
| Section Heading | IBM Plex Sans Variable | 36px | 700 | 1.50 | 0px | Large but generous line-height |
|
||||
| Feature Heading | IBM Plex Sans Variable | 24px | 700 | 1.33 | 0px | Feature section titles |
|
||||
| Card Heading | IBM Plex Sans Variable | 21.4px | 700 | 1.40 | -0.54px | Slightly unusual size (scaled) |
|
||||
| Sub-heading | IBM Plex Sans Variable | 20px | 700 | 1.40 | -0.5px | Content sub-sections |
|
||||
| Sub-heading Uppercase | IBM Plex Sans Variable | 20px | 700 | 1.40 | 0px | Uppercase transform for labels |
|
||||
| Body Emphasis | IBM Plex Sans Variable | 19.3px | 600 | 1.56 | -0.48px | Semi-bold callout text |
|
||||
| Label Uppercase | IBM Plex Sans Variable | 18px | 700 | 1.50 | 0px | Uppercase category labels |
|
||||
| Body Semi | IBM Plex Sans Variable | 18px | 600 | 1.56 | 0px | Semi-bold body text |
|
||||
| Body | IBM Plex Sans Variable | 16px | 400 | 1.50 | 0px | Standard reading text |
|
||||
| Body Medium | IBM Plex Sans Variable | 16px | 500 | 1.50 | 0px | Medium-weight body |
|
||||
| Body Relaxed | IBM Plex Sans Variable | 15px | 400 | 1.71 | 0px | Relaxed line-height for long reads |
|
||||
| Nav / UI | IBM Plex Sans Variable | 15px | 600 | 1.50 | 0px | Navigation and UI labels |
|
||||
| Caption | IBM Plex Sans Variable | 14px | 400–700 | 1.43 | 0px | Small text, various weights |
|
||||
| Small Label | IBM Plex Sans Variable | 13px | 500–700 | 1.00–1.50 | 0px | Tags, badges, micro labels |
|
||||
| Micro | IBM Plex Sans Variable | 12px | 400–700 | 1.33 | 0px | Smallest text, some uppercase |
|
||||
| Code | Source Code Pro | 14px | 500 | 1.43 | 0px | Code snippets and terminal |
|
||||
|
||||
### Principles
|
||||
- **Bold heading dominance**: Headings use 700–800 weight — PostHog's typography is confident and assertive, not whispery
|
||||
- **Generous body line-heights**: Body text at 1.50–1.71 line-height creates extremely comfortable reading — the site is content-heavy and optimized for long sessions
|
||||
- **Fractional sizes**: Several sizes (21.4px, 19.3px, 13.7px) suggest a fluid/scaled type system rather than fixed stops — likely computed from Tailwind's rem scale at non-standard base
|
||||
- **Uppercase as category signal**: Bold uppercase labels (18px–20px weight 700) are used for product category headings — a magazine-editorial convention
|
||||
- **Selective negative tracking**: Letter-spacing tightens on display text (-0.75px at 30px) but relaxes to 0px on body — headlines compress, body breathes
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
- **Dark Primary**: `#1e1f23` background, white text, 6px radius, `10px 12px` padding. Hover: opacity 0.7 with Amber Gold text. Active: opacity 0.8 with slight scale transform. The main CTA — dark and confident
|
||||
- **Sage Light**: `#e5e7e0` background, Olive Ink (`#4d4f46`) text, 4px radius, `4px` padding. Hover: `#f4f4f4` bg with PostHog Orange text. Compact utility button
|
||||
- **Warm Tan Featured**: `#d4c9b8` background, black text, no visible radius. Hover: same orange text flash. Featured/premium actions
|
||||
- **Input-style**: `#eeefe9` background, Sage Placeholder (`#9ea096`) text, 4px radius, 1px `#b6b7af` border. Looks like a search/filter control
|
||||
- **Near-white Ghost**: `#fdfdf8` background, Olive Ink text, 4px radius, transparent 1px border. Minimal presence
|
||||
- **Hover pattern**: All buttons flash PostHog Orange (`#F54E00`) or Amber Gold (`#F7A501`) text on hover — the brand's signature interaction surprise
|
||||
|
||||
### Cards & Containers
|
||||
- **Bordered Card**: Warm Parchment (`#fdfdf8`) or white background, 1px `#bfc1b7` border, 4px–6px radius — clean and minimal
|
||||
- **Sage Surface Card**: `#eeefe9` background for secondary content containers
|
||||
- **Shadow Card**: `0px 25px 50px -12px rgba(0, 0, 0, 0.25)` — a single deep shadow for elevated content (modals, dropdowns)
|
||||
- **Hover**: Orange text flash on interactive cards — consistent with button behavior
|
||||
|
||||
### Inputs & Forms
|
||||
- **Default**: `#eeefe9` background, `#9ea096` placeholder text, 1px `#b6b7af` border, 4px radius, `2px 0px 2px 8px` padding
|
||||
- **Focus**: `#3b82f6` ring at 50% opacity (Tailwind blue focus ring)
|
||||
- **Text color**: `#374151` for input values — darker than primary text for readability
|
||||
- **Border variations**: Multiple border patterns — some inputs use compound borders (top, left, bottom-only)
|
||||
|
||||
### Navigation
|
||||
- **Top nav**: Warm background, IBM Plex Sans at 15px weight 600
|
||||
- **Dropdown menus**: Rich mega-menu structure with product categories
|
||||
- **Link color**: Deep Olive (`#23251d`) for nav links, underline on hover
|
||||
- **CTA**: Dark Primary button (#1e1f23) in the nav — "Get started - free"
|
||||
- **Mobile**: Collapses to hamburger with simplified menu
|
||||
|
||||
### Image Treatment
|
||||
- **Hand-drawn illustrations**: Hedgehog mascot and quirky illustrations — the signature visual element
|
||||
- **Product screenshots**: UI screenshots embedded in device frames or clean containers
|
||||
- **Action figures**: Playful product photography of hedgehog figurines — anti-corporate
|
||||
- **Trust logos**: Enterprise logos (Airbus, GOV.UK) displayed in a muted trust bar
|
||||
- **Aspect ratios**: Mixed — illustrations are irregular, screenshots are 16:9 or widescreen
|
||||
|
||||
### AI Chat Widget
|
||||
- Floating PostHog AI assistant with speech bubble — an interactive product demo embedded in the marketing site
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- **Base unit**: 8px
|
||||
- **Scale**: 2px, 4px, 6px, 8px, 10px, 12px, 16px, 18px, 24px, 32px, 34px
|
||||
- **Section padding**: 32px–48px vertical between sections (compact for a content-heavy site)
|
||||
- **Card padding**: 4px–12px internal (notably compact)
|
||||
- **Component gaps**: 4px–8px between related elements
|
||||
|
||||
### Grid & Container
|
||||
- **Max width**: 1536px (largest breakpoint), with content containers likely 1200px–1280px
|
||||
- **Column patterns**: Varied — single column for text content, 2-3 column grids for feature cards, asymmetric layouts for product demos
|
||||
- **Breakpoints**: 13 defined — 1px, 425px, 482px, 640px, 768px, 767px, 800px, 900px, 1024px, 1076px, 1160px, 1280px, 1536px
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Content-dense by design**: PostHog's site is information-rich — whitespace is measured, not lavish
|
||||
- **Editorial pacing**: Content sections flow like a magazine with varied layouts keeping the eye moving
|
||||
- **Illustrations as breathing room**: Hand-drawn hedgehog art breaks up dense content sections naturally
|
||||
|
||||
### Border Radius Scale
|
||||
- **2px**: Small inline elements, tags (`span`)
|
||||
- **4px**: Primary UI components — buttons, inputs, dropdowns, menu items (`button`, `div`, `combobox`)
|
||||
- **6px**: Secondary containers — larger buttons, list items, card variants (`button`, `div`, `li`)
|
||||
- **9999px**: Pill shape — badges, status indicators, rounded tags (`span`, `div`)
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Level 0 (Flat) | No shadow, warm parchment background | Page canvas, most surfaces |
|
||||
| Level 1 (Border) | `1px solid #bfc1b7` (Sage Border) | Card containment, input borders, section dividers |
|
||||
| Level 2 (Compound Border) | Multiple 1px borders on different sides | Input groupings, toolbar elements |
|
||||
| Level 3 (Deep Shadow) | `0px 25px 50px -12px rgba(0, 0, 0, 0.25)` | Modals, floating elements, mega-menu dropdowns |
|
||||
|
||||
### Shadow Philosophy
|
||||
PostHog's elevation system is remarkably minimal — only one shadow definition exists in the entire system. Depth is communicated through:
|
||||
- **Border containment**: Sage-tinted borders (`#bfc1b7`) at 1px create gentle warm separation
|
||||
- **Surface color shifts**: Moving from `#fdfdf8` to `#eeefe9` to `#e5e7e0` creates layered depth without shadows
|
||||
- **The single shadow**: The one defined shadow (`0 25px 50px -12px`) is reserved for floating elements — modals, dropdowns, popovers. It's a deep, dramatic shadow that creates clear separation when needed
|
||||
|
||||
### Decorative Depth
|
||||
- **Illustration layering**: Hand-drawn hedgehog art creates visual depth naturally
|
||||
- **No gradients or glow**: The flat, warm surface system relies entirely on border and surface-color differentiation
|
||||
- **No glassmorphism**: Fully opaque surfaces throughout
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use the olive/sage color family (#4d4f46, #23251d, #bfc1b7) for text and borders — the warm green undertone is essential to the brand
|
||||
- Flash PostHog Orange (#F54E00) on hover states — it's the hidden brand signature
|
||||
- Use IBM Plex Sans at bold weights (700/800) for headings — the font carries technical credibility
|
||||
- Keep body text at generous line-heights (1.50–1.71) — the content-heavy site demands readability
|
||||
- Maintain the warm parchment background (#fdfdf8) — not pure white, never cold
|
||||
- Use 4px border-radius for most UI elements — keep corners subtle and functional
|
||||
- Include playful, hand-drawn illustration elements — the personality is the differentiator
|
||||
- Apply opacity-based hover states (0.7 opacity) on dark buttons rather than color shifts
|
||||
|
||||
### Don't
|
||||
- Use blue, purple, or typical tech-SaaS colors — PostHog's palette is deliberately olive/sage
|
||||
- Add heavy shadows — the system uses one shadow for floating elements only; everything else uses borders
|
||||
- Make the design look "polished" or "premium" in a conventional sense — PostHog's charm is its irreverent, scrappy energy
|
||||
- Use tight line-heights on body text — the generous 1.50+ spacing is essential for the content-heavy layout
|
||||
- Apply large border-radius (12px+) on cards — PostHog uses 4px–6px, keeping things tight and functional
|
||||
- Remove the orange hover flash — it's a core interaction pattern, not decoration
|
||||
- Replace illustrations with stock photography — the hand-drawn hedgehog art is the brand
|
||||
- Use pure white (#ffffff) as page background — the warm sage-cream (#fdfdf8) tint is foundational
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile Small | <425px | Single column, compact padding, stacked cards |
|
||||
| Mobile | 425px–640px | Slight layout adjustments, larger touch targets |
|
||||
| Tablet | 640px–768px | 2-column grids begin, nav partially visible |
|
||||
| Tablet Large | 768px–1024px | Multi-column layouts, expanded navigation |
|
||||
| Desktop | 1024px–1280px | Full layout, 3-column feature grids, expanded mega-menu |
|
||||
| Large Desktop | 1280px–1536px | Max-width container, generous margins |
|
||||
| Extra Large | >1536px | Centered container at max-width |
|
||||
|
||||
### Touch Targets
|
||||
- Buttons: 4px–6px radius with `4px–12px` padding — compact but usable
|
||||
- Nav links: 15px text at weight 600 with adequate padding
|
||||
- Mobile: Hamburger menu with simplified navigation
|
||||
- Inputs: Generous vertical padding for thumb-friendly forms
|
||||
|
||||
### Collapsing Strategy
|
||||
- **Navigation**: Full mega-menu with dropdowns → hamburger menu on mobile
|
||||
- **Feature grids**: 3-column → 2-column → single column stacked
|
||||
- **Typography**: Display sizes reduce across breakpoints (30px → smaller)
|
||||
- **Illustrations**: Scale within containers, some may hide on mobile for space
|
||||
- **Section spacing**: Reduces proportionally while maintaining readability
|
||||
|
||||
### Image Behavior
|
||||
- Illustrations scale responsively within containers
|
||||
- Product screenshots maintain aspect ratios
|
||||
- Trust logos reflow into multi-row grids on mobile
|
||||
- AI chat widget may reposition or simplify on small screens
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary Text: Olive Ink (`#4d4f46`)
|
||||
- Dark Text: Deep Olive (`#23251d`)
|
||||
- Hover Accent: PostHog Orange (`#F54E00`)
|
||||
- Dark CTA: Near-Black (`#1e1f23`)
|
||||
- Button Surface: Light Sage (`#e5e7e0`)
|
||||
- Page Background: Warm Parchment (`#fdfdf8`)
|
||||
- Border: Sage Border (`#bfc1b7`)
|
||||
- Placeholder: Sage Placeholder (`#9ea096`)
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on warm parchment background (#fdfdf8) with 30px IBM Plex Sans heading at weight 800, line-height 1.20, letter-spacing -0.75px, olive ink text (#4d4f46), and a dark CTA button (#1e1f23, 6px radius, white text, opacity 0.7 on hover)"
|
||||
- "Design a feature card with #fdfdf8 background, 1px #bfc1b7 border, 4px radius, IBM Plex Sans heading at 20px weight 700, and 16px body text at weight 400 with 1.50 line-height in olive ink (#4d4f46)"
|
||||
- "Build a navigation bar with warm background, IBM Plex Sans links at 15px weight 600 in deep olive (#23251d), underline on hover, and a dark CTA button (#1e1f23) at the right"
|
||||
- "Create a button group: primary dark (#1e1f23, white text, 6px radius), secondary sage (#e5e7e0, #4d4f46 text, 4px radius), and ghost/text button — all flash #F54E00 orange text on hover"
|
||||
- "Design an input field with #eeefe9 background, 1px #b6b7af border, 4px radius, #9ea096 placeholder text, focus ring in #3b82f6 at 50% opacity"
|
||||
|
||||
### Iteration Guide
|
||||
When refining existing screens generated with this design system:
|
||||
1. Verify the background is warm parchment (#fdfdf8) not pure white — the sage-cream warmth is essential
|
||||
2. Check that all text uses the olive family (#4d4f46, #23251d) not pure black or neutral gray
|
||||
3. Ensure hover states flash PostHog Orange (#F54E00) — if hovering feels bland, you're missing this
|
||||
4. Confirm borders use sage-tinted gray (#bfc1b7) not neutral gray — warmth runs through every element
|
||||
5. The overall tone should feel like a fun, scrappy startup wiki — never corporate-polished or sterile
|
||||
281
skills/creative/popular-web-designs/templates/raycast.md
Normal file
281
skills/creative/popular-web-designs/templates/raycast.md
Normal file
@@ -0,0 +1,281 @@
|
||||
# Design System: Raycast
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `Geist Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Raycast's marketing site feels like the dark interior of a precision instrument — a Swiss watch case carved from obsidian. The background isn't just dark, it's an almost-black blue-tint (`#07080a`) that creates a sense of being inside a macOS native application rather than a website. Every surface, every border, every shadow is calibrated to evoke the feeling of a high-performance desktop utility: fast, minimal, trustworthy.
|
||||
|
||||
The signature move is the layered shadow system borrowed from macOS window chrome: multi-layer box-shadows with inset highlights that simulate physical depth, as if cards and buttons are actual pressed or raised glass elements on a dark desk. Combined with Raycast Red (`#FF6363`) — deployed almost exclusively in the hero's iconic diagonal stripe pattern — the palette creates a brand that reads as "powerful tool with personality." The red doesn't dominate; it punctuates.
|
||||
|
||||
Inter is used everywhere — headings, body, buttons, captions — with extensive OpenType features (`calt`, `kern`, `liga`, `ss03`) creating a consistent, readable typographic voice. The positive letter-spacing (0.2px–0.4px on body text) is unusual for a dark UI and gives the text an airy, breathable quality that counterbalances the dense, dark surfaces. GeistMono appears for code elements, reinforcing the developer-tool identity.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Near-black blue-tinted background (`#07080a`) — not pure black, subtly blue-shifted
|
||||
- macOS-native shadow system with multi-layer inset highlights simulating physical depth
|
||||
- Raycast Red (`#FF6363`) as a punctuation color — hero stripes, not pervasive
|
||||
- Inter with positive letter-spacing (0.2px) for an airy, readable dark-mode experience
|
||||
- Radix UI component primitives powering the interaction layer
|
||||
- Subtle rgba white borders (0.06–0.1 opacity) for containment on dark surfaces
|
||||
- Keyboard shortcut styling with gradient key caps and heavy shadows
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Near-Black Blue** (`#07080a`): Primary page background — the foundational void with a subtle blue-cold undertone
|
||||
- **Pure White** (`#ffffff`): Primary heading text, high-emphasis elements
|
||||
- **Raycast Red** (`#FF6363` / `hsl(0, 100%, 69%)`): Brand accent — hero stripes, danger states, critical highlights
|
||||
|
||||
### Secondary & Accent
|
||||
- **Raycast Blue** (`hsl(202, 100%, 67%)` / ~`#55b3ff`): Interactive accent — links, focus states, selected items
|
||||
- **Raycast Green** (`hsl(151, 59%, 59%)` / ~`#5fc992`): Success states, positive indicators
|
||||
- **Raycast Yellow** (`hsl(43, 100%, 60%)` / ~`#ffbc33`): Warning accents, highlights
|
||||
- **Blue Transparent** (`hsla(202, 100%, 67%, 0.15)`): Blue tint overlay for interactive surfaces
|
||||
- **Red Transparent** (`hsla(0, 100%, 69%, 0.15)`): Red tint overlay for danger/error surfaces
|
||||
|
||||
### Surface & Background
|
||||
- **Deep Background** (`#07080a`): Page canvas, the darkest surface
|
||||
- **Surface 100** (`#101111`): Elevated surface, card backgrounds
|
||||
- **Key Start** (`#121212`): Keyboard key gradient start
|
||||
- **Key End** (`#0d0d0d`): Keyboard key gradient end
|
||||
- **Card Surface** (`#1b1c1e`): Badge backgrounds, tag fills, elevated containers
|
||||
- **Button Foreground** (`#18191a`): Dark surface for button text on light backgrounds
|
||||
|
||||
### Neutrals & Text
|
||||
- **Near White** (`#f9f9f9` / `hsl(240, 11%, 96%)`): Primary body text, high-emphasis content
|
||||
- **Light Gray** (`#cecece` / `#cdcdce`): Secondary body text, descriptions
|
||||
- **Silver** (`#c0c0c0`): Tertiary text, subdued labels
|
||||
- **Medium Gray** (`#9c9c9d`): Link default color, secondary navigation
|
||||
- **Dim Gray** (`#6a6b6c`): Disabled text, low-emphasis labels
|
||||
- **Dark Gray** (`#434345`): Muted borders, inactive navigation links
|
||||
- **Border** (`hsl(195, 5%, 15%)` / ~`#252829`): Standard border color for cards and dividers
|
||||
- **Dark Border** (`#2f3031`): Separator lines, table borders
|
||||
|
||||
### Semantic & Accent
|
||||
- **Error Red** (`hsl(0, 100%, 69%)`): Error states, destructive actions
|
||||
- **Success Green** (`hsl(151, 59%, 59%)`): Success confirmations, positive states
|
||||
- **Warning Yellow** (`hsl(43, 100%, 60%)`): Warnings, attention-needed states
|
||||
- **Info Blue** (`hsl(202, 100%, 67%)`): Informational highlights, links
|
||||
|
||||
### Gradient System
|
||||
- **Keyboard Key Gradient**: Linear gradient from `#121212` (top) to `#0d0d0d` (bottom) — simulates physical key depth
|
||||
- **Warm Glow**: `rgba(215, 201, 175, 0.05)` radial spread — subtle warm ambient glow behind featured elements
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Primary**: `Inter` — humanist sans-serif, used everywhere. Fallbacks: `Inter Fallback`, system sans-serif
|
||||
- **System**: `SF Pro Text` — Apple system font for select macOS-native UI elements. Fallbacks: `SF Pro Icons`, `Inter`, `Inter Fallback`
|
||||
- **Monospace**: `GeistMono` — Vercel's monospace font for code elements. Fallbacks: `ui-monospace`, `SFMono-Regular`, `Roboto Mono`, `Menlo`, `Monaco`
|
||||
- **OpenType features**: `calt`, `kern`, `liga`, `ss03` enabled globally; `ss02`, `ss08` on display text; `liga` disabled (`"liga" 0`) on hero headings
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|--------|-------------|----------------|-------|
|
||||
| Display Hero | 64px | 600 | 1.10 | 0px | OpenType: liga 0, ss02, ss08 |
|
||||
| Section Display | 56px | 400 | 1.17 | 0.2px | OpenType: calt, kern, liga, ss03 |
|
||||
| Section Heading | 24px | 500 | normal | 0.2px | OpenType: calt, kern, liga, ss03 |
|
||||
| Card Heading | 22px | 400 | 1.15 | 0px | OpenType: calt, kern, liga, ss03 |
|
||||
| Sub-heading | 20px | 500 | 1.60 | 0.2px | Relaxed line-height for readability |
|
||||
| Body Large | 18px | 400 | 1.15 | 0.2px | OpenType: calt, kern, liga, ss03 |
|
||||
| Body | 16px | 500 | 1.60 | 0.2px | Primary body text, relaxed rhythm |
|
||||
| Body Tight | 16px | 400 | 1.15 | 0.1px | UI labels, compact contexts |
|
||||
| Button | 16px | 600 | 1.15 | 0.3px | Semibold, slightly wider tracking |
|
||||
| Nav Link | 16px | 500 | 1.40 | 0.3px | Links in navigation |
|
||||
| Caption | 14px | 500 | 1.14 | 0.2px | Small labels, metadata |
|
||||
| Caption Bold | 14px | 600 | 1.40 | 0px | Emphasized captions |
|
||||
| Small | 12px | 600 | 1.33 | 0px | Badges, tags, micro-labels |
|
||||
| Small Link | 12px | 400 | 1.50 | 0.4px | Footer links, fine print |
|
||||
| Code | 14px (GeistMono) | 500 | 1.60 | 0.3px | Code blocks, technical content |
|
||||
| Code Small | 12px (GeistMono) | 400 | 1.60 | 0.2px | Inline code, terminal output |
|
||||
|
||||
### Principles
|
||||
- **Positive tracking on dark**: Unlike most dark UIs that use tight or neutral letter-spacing, Raycast applies +0.2px to +0.4px — creating an airy, readable feel that compensates for the dark background
|
||||
- **Weight 500 as baseline**: Most body text uses medium weight (500), not regular (400) — subtle extra heft improves legibility on dark surfaces
|
||||
- **Display restraint**: Hero text at 64px/600 is confident but not oversized — Raycast avoids typographic spectacle in favor of functional elegance
|
||||
- **OpenType everywhere**: `ss03` (stylistic set 3) is enabled globally across Inter, giving the typeface a slightly more geometric, tool-like quality
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
- **Primary Pill**: Transparent background, white text, pill shape (86px radius), multi-layer inset shadow (`rgba(255, 255, 255, 0.1) 0px 1px 0px 0px inset`). Hover: opacity 0.6
|
||||
- **Secondary Button**: Transparent background, white text, 6px radius, `1px solid rgba(255, 255, 255, 0.1)` border, subtle drop shadow (`rgba(0, 0, 0, 0.03) 0px 7px 3px`). Hover: opacity 0.6
|
||||
- **Ghost Button**: No background or border, gray text (`#6a6b6c`), 86px radius, same inset shadow. Hover: opacity 0.6, text brightens to white
|
||||
- **CTA (Download)**: Semi-transparent white background (`hsla(0, 0%, 100%, 0.815)`), dark text (`#18191a`), pill shape. Hover: full white background (`hsl(0, 0%, 100%)`)
|
||||
- **Transition**: All buttons use opacity transition for hover rather than background-color change — a signature Raycast interaction pattern
|
||||
|
||||
### Cards & Containers
|
||||
- **Standard Card**: `#101111` surface, `1px solid rgba(255, 255, 255, 0.06)` border, 12px–16px border-radius
|
||||
- **Elevated Card**: Ring shadow `rgb(27, 28, 30) 0px 0px 0px 1px` outer + `rgb(7, 8, 10) 0px 0px 0px 1px inset` inner — creates a double-ring containment
|
||||
- **Feature Card**: 16px–20px border-radius, subtle warm glow (`rgba(215, 201, 175, 0.05) 0px 0px 20px 5px`) behind hero elements
|
||||
- **Hover**: Cards brighten slightly via border opacity increase or subtle shadow enhancement
|
||||
|
||||
### Inputs & Forms
|
||||
- Dark input fields with `#07080a` background, `1px solid rgba(255, 255, 255, 0.08)` border, 8px border-radius
|
||||
- Focus state: Border brightens, blue glow (`hsla(202, 100%, 67%, 0.15)`) ring appears
|
||||
- Text: `#f9f9f9` input color, `#6a6b6c` placeholder
|
||||
- Labels: `#9c9c9d` at 14px weight 500
|
||||
|
||||
### Navigation
|
||||
- **Top nav**: Dark background blending with page, white text links at 16px weight 500
|
||||
- **Nav links**: Gray text (`#9c9c9d`) → white on hover, underline decoration on hover
|
||||
- **CTA button**: Semi-transparent white pill at nav end
|
||||
- **Mobile**: Collapses to hamburger, maintains dark theme
|
||||
- **Sticky**: Nav fixed at top with subtle border separator
|
||||
|
||||
### Image Treatment
|
||||
- **Product screenshots**: macOS window chrome style — rounded corners (12px), deep shadows simulating floating windows
|
||||
- **Full-bleed sections**: Dark screenshots blend seamlessly into the dark background
|
||||
- **Hero illustration**: Diagonal stripe pattern in Raycast Red — abstract, geometric, brand-defining
|
||||
- **App UI embeds**: Showing actual Raycast command palette and extensions — product as content
|
||||
|
||||
### Keyboard Shortcut Keys
|
||||
- **Key cap styling**: Gradient background (`#121212` → `#0d0d0d`), heavy multi-layer shadow (`rgba(0, 0, 0, 0.4) 0px 1.5px 0.5px 2.5px` + inset shadows), creating realistic physical key appearance
|
||||
- Border-radius: 4px–6px for individual keys
|
||||
|
||||
### Badges & Tags
|
||||
- **Neutral badge**: `#1b1c1e` background, white text, 6px radius, 14px font at weight 500, `0px 6px` padding
|
||||
- Compact, pill-like treatment for categorization
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- **Base unit**: 8px
|
||||
- **Scale**: 1px, 2px, 3px, 4px, 8px, 10px, 12px, 16px, 20px, 24px, 32px, 40px
|
||||
- **Section padding**: 80px–120px vertical between major sections
|
||||
- **Card padding**: 16px–32px internal spacing
|
||||
- **Component gaps**: 8px–16px between related elements
|
||||
|
||||
### Grid & Container
|
||||
- **Max width**: ~1200px container (breakpoint at 1204px), centered
|
||||
- **Column patterns**: Single-column hero, 2–3 column feature grids, full-width showcase sections
|
||||
- **App showcase**: Product UI presented in centered window frames
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Dramatic negative space**: Sections float in vast dark void, creating cinematic pacing between features
|
||||
- **Dense product, sparse marketing**: The product UI screenshots are information-dense, but the surrounding marketing copy uses minimal text with generous spacing
|
||||
- **Vertical rhythm**: Consistent 24px–32px gaps between elements within sections
|
||||
|
||||
### Border Radius Scale
|
||||
- **2px–3px**: Micro-elements, code spans, tiny indicators
|
||||
- **4px–5px**: Keyboard keys, small interactive elements
|
||||
- **6px**: Buttons, badges, tags — the workhorse radius
|
||||
- **8px**: Input fields, inline components
|
||||
- **9px–11px**: Images, medium containers
|
||||
- **12px**: Standard cards, product screenshots
|
||||
- **16px**: Large cards, feature sections
|
||||
- **20px**: Hero cards, prominent containers
|
||||
- **86px+**: Pill buttons, nav CTAs — full pill shape
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Level 0 (Void) | No shadow, `#07080a` surface | Page background |
|
||||
| Level 1 (Subtle) | `rgba(0, 0, 0, 0.28) 0px 1.189px 2.377px` | Minimal lift, inline elements |
|
||||
| Level 2 (Ring) | `rgb(27, 28, 30) 0px 0px 0px 1px` outer + `rgb(7, 8, 10) 0px 0px 0px 1px inset` inner | Card containment, double-ring technique |
|
||||
| Level 3 (Button) | `rgba(255, 255, 255, 0.05) 0px 1px 0px 0px inset` + `rgba(255, 255, 255, 0.25) 0px 0px 0px 1px` + `rgba(0, 0, 0, 0.2) 0px -1px 0px 0px inset` | macOS-native button press — white highlight top, dark inset bottom |
|
||||
| Level 4 (Key) | 5-layer shadow stack with inset press effects | Keyboard shortcut key caps — physical 3D appearance |
|
||||
| Level 5 (Floating) | `rgba(0, 0, 0, 0.5) 0px 0px 0px 2px` + `rgba(255, 255, 255, 0.19) 0px 0px 14px` + insets | Command palette, floating panels — heavy depth with glow |
|
||||
|
||||
### Shadow Philosophy
|
||||
Raycast's shadow system is the most macOS-native on the web. Multi-layer shadows combine:
|
||||
- **Outer rings** for containment (replacing traditional borders)
|
||||
- **Inset top highlights** (`rgba(255, 255, 255, 0.05–0.25)`) simulating light source from above
|
||||
- **Inset bottom darks** (`rgba(0, 0, 0, 0.2)`) simulating shadow underneath
|
||||
- The effect is physical: elements feel like glass or brushed metal, not flat rectangles
|
||||
|
||||
### Decorative Depth
|
||||
- **Warm glow**: `rgba(215, 201, 175, 0.05) 0px 0px 20px 5px` behind featured elements — a subtle warm aura on the cold dark canvas
|
||||
- **Blue info glow**: `rgba(0, 153, 255, 0.15)` for interactive state emphasis
|
||||
- **Red danger glow**: `rgba(255, 99, 99, 0.15)` for error/destructive state emphasis
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use `#07080a` (not pure black) as the background — the blue-cold tint is essential to the Raycast feel
|
||||
- Apply positive letter-spacing (+0.2px) on body text — this is deliberately different from most dark UIs
|
||||
- Use multi-layer shadows with inset highlights for interactive elements — the macOS-native depth is signature
|
||||
- Keep Raycast Red (`#FF6363`) as punctuation, not pervasive — reserve it for hero moments and error states
|
||||
- Use `rgba(255, 255, 255, 0.06)` borders for card containment — barely visible, structurally essential
|
||||
- Apply weight 500 as the body text baseline — medium weight improves dark-mode legibility
|
||||
- Use pill shapes (86px+ radius) for primary CTAs, rectangular shapes (6px–8px) for secondary actions
|
||||
- Enable OpenType features `calt`, `kern`, `liga`, `ss03` on all Inter text
|
||||
- Use opacity transitions (hover: opacity 0.6) for button interactions, not color changes
|
||||
|
||||
### Don't
|
||||
- Use pure black (`#000000`) as the background — the blue tint differentiates Raycast from generic dark themes
|
||||
- Apply negative letter-spacing on body text — Raycast deliberately uses positive spacing for readability
|
||||
- Use Raycast Blue as the primary accent for everything — blue is for interactive/info, red is the brand color
|
||||
- Create single-layer flat shadows — the multi-layer inset system is core to the macOS-native aesthetic
|
||||
- Use regular weight (400) for body text when 500 is available — the extra weight prevents dark-mode text from feeling thin
|
||||
- Mix warm and cool borders — stick to the cool gray (`hsl(195, 5%, 15%)`) border palette
|
||||
- Apply heavy drop shadows without inset companions — shadows always come in pairs (outer + inset)
|
||||
- Use decorative elements, gradients, or colorful backgrounds — the dark void is the stage, content is the performer
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
| Name | Width | Key Changes |
|
||||
|------|-------|-------------|
|
||||
| Mobile | <600px | Single column, stacked cards, hamburger nav, hero text reduces to ~40px |
|
||||
| Small Tablet | 600px–768px | 2-column grid begins, nav partially visible |
|
||||
| Tablet | 768px–1024px | 2–3 column features, nav expanding, screenshots scale |
|
||||
| Desktop | 1024px–1200px | Full layout, all nav links visible, 64px hero display |
|
||||
| Large Desktop | >1200px | Max-width container centered, generous side margins |
|
||||
|
||||
### Touch Targets
|
||||
- Pill buttons: 86px radius with 20px padding — well above 44px minimum
|
||||
- Secondary buttons: 8px padding minimum, but border provides visual target expansion
|
||||
- Nav links: 16px text with surrounding padding for accessible touch targets
|
||||
|
||||
### Collapsing Strategy
|
||||
- **Navigation**: Full horizontal nav → hamburger at mobile with slide-out menu
|
||||
- **Hero**: 64px display → 48px → 36px across breakpoints
|
||||
- **Feature grids**: 3-column → 2-column → single-column stack
|
||||
- **Product screenshots**: Scale within containers, maintaining macOS window chrome proportions
|
||||
- **Keyboard shortcut displays**: Simplify or hide on mobile where keyboard shortcuts are irrelevant
|
||||
|
||||
### Image Behavior
|
||||
- Product screenshots scale responsively within fixed-ratio containers
|
||||
- Hero diagonal stripe pattern scales proportionally
|
||||
- macOS window chrome rounded corners maintained at all sizes
|
||||
- No lazy-loading artifacts — images are critical to the product narrative
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary Background: Near-Black Blue (`#07080a`)
|
||||
- Primary Text: Near White (`#f9f9f9`)
|
||||
- Brand Accent: Raycast Red (`#FF6363`)
|
||||
- Interactive Blue: Raycast Blue (`hsl(202, 100%, 67%)` / ~`#55b3ff`)
|
||||
- Secondary Text: Medium Gray (`#9c9c9d`)
|
||||
- Card Surface: Surface 100 (`#101111`)
|
||||
- Border: Dark Border (`hsl(195, 5%, 15%)` / ~`#252829`)
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section on #07080a background with 64px Inter heading (weight 600, line-height 1.1), near-white text (#f9f9f9), and a semi-transparent white pill CTA button (hsla(0,0%,100%,0.815), 86px radius, dark text #18191a)"
|
||||
- "Design a feature card with #101111 background, 1px solid rgba(255,255,255,0.06) border, 16px border-radius, double-ring shadow (rgb(27,28,30) 0px 0px 0px 1px outer), 22px Inter heading, and #9c9c9d body text"
|
||||
- "Build a navigation bar on dark background (#07080a), Inter links at 16px weight 500 in #9c9c9d, hover to white, and a translucent white pill button at the right end"
|
||||
- "Create a keyboard shortcut display with key caps using gradient background (#121212→#0d0d0d), 5-layer shadow for physical depth, 4px radius, Inter 12px weight 600 text"
|
||||
- "Design an alert card with #101111 surface, Raycast Red (#FF6363) left border accent, translucent red glow (hsla(0,100%,69%,0.15)), white heading, and #cecece description text"
|
||||
|
||||
### Iteration Guide
|
||||
When refining existing screens generated with this design system:
|
||||
1. Check the background is `#07080a` not pure black — the blue tint is critical
|
||||
2. Verify letter-spacing is positive (+0.2px) on body text — negative spacing breaks the Raycast aesthetic
|
||||
3. Ensure shadows have both outer and inset layers — single-layer shadows look flat and wrong
|
||||
4. Confirm Inter has OpenType features `calt`, `kern`, `liga`, `ss03` enabled
|
||||
5. Test that hover states use opacity transitions (0.6) not color swaps — this is a core interaction pattern
|
||||
274
skills/creative/popular-web-designs/templates/replicate.md
Normal file
274
skills/creative/popular-web-designs/templates/replicate.md
Normal file
@@ -0,0 +1,274 @@
|
||||
# Design System: Replicate
|
||||
|
||||
|
||||
> **Hermes Agent — Implementation Notes**
|
||||
>
|
||||
> The original site uses proprietary fonts. For self-contained HTML output, use these CDN substitutes:
|
||||
> - **Primary:** `Inter` | **Mono:** `JetBrains Mono`
|
||||
> - **Font stack (CSS):** `font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;`
|
||||
> - **Mono stack (CSS):** `font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;`
|
||||
> ```html
|
||||
> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
> ```
|
||||
> Use `write_file` to create HTML, serve via `generative-widgets` skill (cloudflared tunnel).
|
||||
> Verify visual accuracy with `browser_vision` after generating.
|
||||
|
||||
## 1. Visual Theme & Atmosphere
|
||||
|
||||
Replicate's interface is a developer playground crackling with creative energy — a bold, high-contrast design that feels more like a music festival poster than a typical API platform. The hero section explodes with a vibrant orange-red-magenta gradient that immediately signals "this is where AI models come alive," while the body of the page grounds itself in a clean white canvas where code snippets and model galleries take center stage.
|
||||
|
||||
The design personality is defined by two extreme choices: **massive display typography** (up to 128px) using the custom rb-freigeist-neue face, and **exclusively pill-shaped geometry** (9999px radius on everything). The display font is thick, bold, and confident — its heavy weight at enormous sizes creates text that feels like it's shouting with joy rather than whispering authority. Combined with basier-square for body text (a clean geometric sans) and JetBrains Mono for code, the system serves developers who want power and playfulness in equal measure.
|
||||
|
||||
What makes Replicate distinctive is its community-powered energy. The model gallery with AI-generated images, the dotted-underline links, the green status badges, and the "Imagine what you can build" closing manifesto all create a space that feels alive and participatory — not a corporate product page but a launchpad for creative developers.
|
||||
|
||||
**Key Characteristics:**
|
||||
- Explosive orange-red-magenta gradient hero (#ea2804 brand anchor)
|
||||
- Massive display typography (128px) in heavy rb-freigeist-neue
|
||||
- Exclusively pill-shaped geometry: 9999px radius on EVERYTHING
|
||||
- High-contrast black (#202020) and white palette with red brand accent
|
||||
- Developer-community energy: model galleries, code examples, dotted-underline links
|
||||
- Green status badges (#2b9a66) for live/operational indicators
|
||||
- Bold/heavy font weights (600-700) creating maximum typographic impact
|
||||
- Playful closing manifesto: "Imagine what you can build."
|
||||
|
||||
## 2. Color Palette & Roles
|
||||
|
||||
### Primary
|
||||
- **Replicate Dark** (`#202020`): The primary text color and dark surface — a near-black that's the anchor of all text and borders. Slightly warmer than pure #000.
|
||||
- **Replicate Red** (`#ea2804`): The core brand color — a vivid, saturated orange-red used in the hero gradient, accent borders, and high-signal moments.
|
||||
- **Secondary Red** (`#dd4425`): A slightly warmer variant for button borders and link hover states.
|
||||
|
||||
### Secondary & Accent
|
||||
- **Status Green** (`#2b9a66`): Badge/pill background for "running" or operational status indicators.
|
||||
- **GitHub Dark** (`#24292e`): A blue-tinted dark used for code block backgrounds and developer contexts.
|
||||
|
||||
### Surface & Background
|
||||
- **Pure White** (`#ffffff`): The primary page body background.
|
||||
- **Near White** (`#fcfcfc`): Button text on dark surfaces and the lightest content.
|
||||
- **Hero Gradient**: A dramatic orange → red → magenta → pink gradient for the hero section. Transitions from warm (#ea2804 family) through hot pink.
|
||||
|
||||
### Neutrals & Text
|
||||
- **Medium Gray** (`#646464`): Secondary body text and de-emphasized content.
|
||||
- **Warm Gray** (`#4e4e4e`): Emphasized secondary text.
|
||||
- **Mid Silver** (`#8d8d8d`): Tertiary text, footnotes.
|
||||
- **Light Silver** (`#bbbbbb`): Dotted-underline link decoration color, muted metadata.
|
||||
- **Pure Black** (`#000000`): Maximum-emphasis borders and occasional text.
|
||||
|
||||
### Gradient System
|
||||
- **Hero Blaze**: A dramatic multi-stop gradient flowing through orange (`#ea2804`) → red → magenta → hot pink. This gradient occupies the full hero section and is the most visually dominant element on the page.
|
||||
- **Dark Sections**: Deep dark (#202020) sections with white/near-white text provide contrast against the white body.
|
||||
|
||||
## 3. Typography Rules
|
||||
|
||||
### Font Family
|
||||
- **Display**: `rb-freigeist-neue`, with fallbacks: `ui-sans-serif, system-ui`
|
||||
- **Body / UI**: `basier-square`, with fallbacks: `ui-sans-serif, system-ui`
|
||||
- **Code**: `jetbrains-mono`, with fallbacks: `ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes |
|
||||
|------|------|------|--------|-------------|----------------|-------|
|
||||
| Display Mega | rb-freigeist-neue | 128px (8rem) | 700 | 1.00 (tight) | normal | The maximum: closing manifesto |
|
||||
| Display / Hero | rb-freigeist-neue | 72px (4.5rem) | 700 | 1.00 (tight) | -1.8px | Hero section headline |
|
||||
| Section Heading | rb-freigeist-neue | 48px (3rem) | 400–700 | 1.00 (tight) | normal | Feature section titles |
|
||||
| Sub-heading | rb-freigeist-neue | 30px (1.88rem) | 600 | 1.20 (tight) | normal | Card headings |
|
||||
| Sub-heading Sans | basier-square | 38.4px (2.4rem) | 400 | 0.83 (ultra-tight) | normal | Large body headings |
|
||||
| Feature Title | basier-square / rb-freigeist-neue | 18px (1.13rem) | 600 | 1.56 | normal | Small section titles, labels |
|
||||
| Body Large | basier-square | 20px (1.25rem) | 400 | 1.40 | normal | Intro paragraphs |
|
||||
| Body / Button | basier-square | 16–18px (1–1.13rem) | 400–600 | 1.50–1.56 | normal | Standard text, buttons |
|
||||
| Caption | basier-square | 14px (0.88rem) | 400–600 | 1.43 | -0.35px to normal | Metadata, descriptions |
|
||||
| Small / Tag | basier-square | 12px (0.75rem) | 400 | 1.33 | normal | Tags (lowercase transform) |
|
||||
| Code | jetbrains-mono | 14px (0.88rem) | 400 | 1.43 | normal | Code snippets, API examples |
|
||||
| Code Small | jetbrains-mono | 11px (0.69rem) | 400 | 1.50 | normal | Tiny code references |
|
||||
|
||||
### Principles
|
||||
- **Heavy display, light body**: rb-freigeist-neue at 700 weight creates thundering headlines, while basier-square at 400 handles body text with quiet efficiency. The contrast is extreme and intentional.
|
||||
- **128px is a real size**: The closing manifesto "Imagine what you can build." uses 128px — bigger than most mobile screens. This is the design equivalent of shouting from a rooftop.
|
||||
- **Negative tracking on hero**: -1.8px letter-spacing at 72px creates dense, impactful hero text.
|
||||
- **Lowercase tags**: 12px basier-square uses `text-transform: lowercase` — an unusual choice that creates a casual, developer-friendly vibe.
|
||||
- **Weight 600 as emphasis**: When basier-square needs emphasis, it uses 600 (semibold) — never bold (700), which is reserved for rb-freigeist-neue display text.
|
||||
|
||||
## 4. Component Stylings
|
||||
|
||||
### Buttons
|
||||
|
||||
**Dark Solid**
|
||||
- Background: Replicate Dark (`#202020`)
|
||||
- Text: Near White (`#fcfcfc`)
|
||||
- Padding: 0px 4px (extremely compact)
|
||||
- Outline: Replicate Dark 4px solid
|
||||
- Radius: pill-shaped (implied by system)
|
||||
- Maximum emphasis — dark pill on light surface
|
||||
|
||||
**White Outlined**
|
||||
- Background: Pure White (`#ffffff`)
|
||||
- Text: Replicate Dark (`#202020`)
|
||||
- Border: `1px solid #202020`
|
||||
- Radius: pill-shaped
|
||||
- Clean outlined pill for secondary actions
|
||||
|
||||
**Transparent Glass**
|
||||
- Background: `rgba(255, 255, 255, 0.1)` (frosted glass)
|
||||
- Text: Replicate Dark (`#202020`)
|
||||
- Padding: 6px 56px 6px 28px (asymmetric — icon/search layout)
|
||||
- Border: transparent
|
||||
- Outline: Light Silver (`#bbbbbb`) 1px solid
|
||||
- Used for search/input-like buttons
|
||||
|
||||
### Cards & Containers
|
||||
- Background: Pure White or subtle gray
|
||||
- Border: `1px solid #202020` for prominent containment
|
||||
- Radius: pill-shaped (9999px) for badges, labels, images
|
||||
- Shadow: minimal standard shadows
|
||||
- Model gallery: grid of AI-generated image thumbnails
|
||||
- Accent border: `1px solid #ea2804` for highlighted/featured items
|
||||
|
||||
### Inputs & Forms
|
||||
- Background: `rgba(255, 255, 255, 0.1)` (frosted glass)
|
||||
- Text: Replicate Dark (`#202020`)
|
||||
- Border: transparent with outline
|
||||
- Padding: 6px 56px 6px 28px (search-bar style)
|
||||
|
||||
### Navigation
|
||||
- Clean horizontal nav on white
|
||||
- Logo: Replicate wordmark in dark
|
||||
- Links: dark text with dotted underline on hover
|
||||
- CTA: Dark pill button
|
||||
- GitHub link and sign-in
|
||||
|
||||
### Image Treatment
|
||||
- AI-generated model output images in a gallery grid
|
||||
- Pill-shaped image containers (9999px)
|
||||
- Full-width gradient hero section
|
||||
- Product screenshots with dark backgrounds
|
||||
|
||||
### Distinctive Components
|
||||
|
||||
**Model Gallery Grid**
|
||||
- Horizontal scrolling or grid of AI-generated images
|
||||
- Each image in a pill-shaped container
|
||||
- Model names and run counts displayed
|
||||
- The visual heart of the community platform
|
||||
|
||||
**Dotted Underline Links**
|
||||
- Links use `text-decoration: underline dotted #bbbbbb`
|
||||
- A distinctive, developer-notebook aesthetic
|
||||
- Lighter and more casual than solid underlines
|
||||
|
||||
**Status Badges**
|
||||
- Status Green (`#2b9a66`) background with white text
|
||||
- Pill-shaped (9999px)
|
||||
- 14px font size
|
||||
- Indicates model availability/operational status
|
||||
|
||||
**Manifesto Section**
|
||||
- "Imagine what you can build." at 128px
|
||||
- Dark background with white text
|
||||
- Images embedded between words
|
||||
- The emotional climax of the page
|
||||
|
||||
## 5. Layout Principles
|
||||
|
||||
### Spacing System
|
||||
- Base unit: 8px
|
||||
- Scale: 1px, 2px, 4px, 6px, 8px, 10px, 12px, 16px, 24px, 32px, 48px, 64px, 96px, 160px, 192px
|
||||
- Button padding: varies widely (0px 4px to 6px 56px)
|
||||
- Section vertical spacing: very generous (96–192px)
|
||||
|
||||
### Grid & Container
|
||||
- Fluid width with responsive constraints
|
||||
- Hero: full-width gradient with centered content
|
||||
- Model gallery: multi-column responsive grid
|
||||
- Feature sections: mixed layouts
|
||||
- Code examples: contained dark blocks
|
||||
|
||||
### Whitespace Philosophy
|
||||
- **Bold and generous**: Massive spacing between sections (up to 192px) creates distinct zones.
|
||||
- **Dense within galleries**: Model images are tightly packed in the grid for browsable density.
|
||||
- **The gradient IS the whitespace**: The hero gradient section occupies significant vertical space as a colored void.
|
||||
|
||||
### Border Radius Scale
|
||||
- **Pill (9999px)**: The ONLY radius in the system. Everything interactive, every image, every badge, every label, every container uses 9999px. This is the most extreme pill-radius commitment in any major tech brand.
|
||||
|
||||
## 6. Depth & Elevation
|
||||
|
||||
| Level | Treatment | Use |
|
||||
|-------|-----------|-----|
|
||||
| Flat (Level 0) | No shadow | White body, text blocks |
|
||||
| Bordered (Level 1) | `1px solid #202020` | Cards, buttons, containers |
|
||||
| Accent Border (Level 2) | `1px solid #ea2804` | Featured/highlighted items |
|
||||
| Gradient Hero (Level 3) | Full-width blaze gradient | Hero section, maximum visual impact |
|
||||
| Dark Section (Level 4) | Dark bg (#202020) with light text | Manifesto, footer, feature sections |
|
||||
|
||||
**Shadow Philosophy**: Replicate relies on **borders and background color** for depth rather than shadows. The `1px solid #202020` border is the primary containment mechanism. The dramatic gradient hero and dark/light section alternation provide all the depth the design needs.
|
||||
|
||||
## 7. Do's and Don'ts
|
||||
|
||||
### Do
|
||||
- Use pill-shaped (9999px) radius on EVERYTHING — buttons, images, badges, containers
|
||||
- Use rb-freigeist-neue at weight 700 for display text — go big (72px+) or go home
|
||||
- Use the orange-red brand gradient for hero sections
|
||||
- Use Replicate Dark (#202020) as the primary dark — not pure black
|
||||
- Apply dotted underline decoration on text links (#bbbbbb)
|
||||
- Use Status Green (#2b9a66) for operational/success badges
|
||||
- Keep body text in basier-square at 400–600 weight
|
||||
- Use JetBrains Mono for all code content
|
||||
- Create a "manifesto" section with 128px type for emotional impact
|
||||
|
||||
### Don't
|
||||
- Don't use any border-radius other than 9999px — the pill system is absolute
|
||||
- Don't use the brand red (#ea2804) as a surface/background color — it's for gradients and accent borders
|
||||
- Don't reduce display text below 48px on desktop — the heavy display font needs size to breathe
|
||||
- Don't use light/thin font weights on rb-freigeist-neue — 600–700 is the range
|
||||
- Don't use solid underlines on links — dotted is the signature
|
||||
- Don't add drop shadows — depth comes from borders and background color
|
||||
- Don't use warm neutrals — the gray scale is purely neutral (#202020 → #bbbbbb)
|
||||
- Don't skip the code examples — they're primary content, not decoration
|
||||
- Don't make the hero gradient subtle — it should be BOLD and vibrant
|
||||
|
||||
## 8. Responsive Behavior
|
||||
|
||||
### Breakpoints
|
||||
*No explicit breakpoints detected — likely using fluid/container-query responsive system.*
|
||||
|
||||
### Touch Targets
|
||||
- Pill buttons with generous padding
|
||||
- Gallery images as large touch targets
|
||||
- Navigation adequately spaced
|
||||
|
||||
### Collapsing Strategy
|
||||
- **Hero text**: 128px → 72px → 48px progressive scaling
|
||||
- **Model gallery**: Grid reduces columns
|
||||
- **Navigation**: Collapses to hamburger
|
||||
- **Manifesto**: Scales down but maintains impact
|
||||
|
||||
### Image Behavior
|
||||
- AI-generated images scale within pill containers
|
||||
- Gallery reflows to fewer columns on narrow screens
|
||||
- Hero gradient maintained at all sizes
|
||||
|
||||
## 9. Agent Prompt Guide
|
||||
|
||||
### Quick Color Reference
|
||||
- Primary Text: "Replicate Dark (#202020)"
|
||||
- Page Background: "Pure White (#ffffff)"
|
||||
- Brand Accent: "Replicate Red (#ea2804)"
|
||||
- Secondary Text: "Medium Gray (#646464)"
|
||||
- Muted/Decoration: "Light Silver (#bbbbbb)"
|
||||
- Status: "Status Green (#2b9a66)"
|
||||
- Dark Surface: "Replicate Dark (#202020)"
|
||||
|
||||
### Example Component Prompts
|
||||
- "Create a hero section with a vibrant orange-red-magenta gradient background. Headline at 72px rb-freigeist-neue weight 700, white text, -1.8px letter-spacing. Include a dark pill CTA button and a white outlined pill button."
|
||||
- "Design a model card with pill-shaped (9999px) image container, model name at 16px basier-square weight 600, run count at 14px in Medium Gray. Border: 1px solid #202020."
|
||||
- "Build a status badge: pill-shaped (9999px), Status Green (#2b9a66) background, white text at 14px basier-square."
|
||||
- "Create a manifesto section on Replicate Dark (#202020) with 'Imagine what you can build.' at 128px rb-freigeist-neue weight 700, white text. Embed small AI-generated images between the words."
|
||||
- "Design a code block: dark background (#24292e), JetBrains Mono at 14px, white text. Pill-shaped container."
|
||||
|
||||
### Iteration Guide
|
||||
1. Everything is pill-shaped — never specify any other border-radius
|
||||
2. Display text is HEAVY — weight 700, sizes 48px+
|
||||
3. Links use dotted underline (#bbbbbb) — never solid
|
||||
4. The gradient hero is the visual anchor — make it bold
|
||||
5. Use basier-square for body, rb-freigeist-neue for display, JetBrains Mono for code
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user