Skip to content

Motion films that never cut to the next slide: every beat grows out of the one before, one continuous camera, continuity measured by an oracle. Product launch films and feature demos, made with a coding agent.

feat: add built-in looks — six measured palettes, OFL faces, look.py

feitangyuan7e709e4b6d83
diff --git a/SKILL.md b/SKILL.md
index c01369e..5cd9470 100644
--- a/SKILL.md
+++ b/SKILL.md
@@ -65,8 +65,11 @@ that differ in that idea — not three stories told with the same cards:
- **a chain reaction** — every beat is the collision that starts the next (`cases/knockon-15s`);
- or a physical metaphor, one continuous surface, a typographic system…
-For each: the hook frame, what carries every boundary, what it rules out (no cards? no cuts?). Show the three and
-let the user pick. The template's story — kinetic words → typed prompt → ticking checklist → result → staccato
+For each: the hook frame, what carries every boundary, what it rules out (no cards? no cuts?), and **its look** —
+a preset from `looks/` (`python3 scripts/look.py sheet` → `gallery/sheets/looks.png`: paper, dusk, tabletop,
+ultramarine, riso, ember, each measured from an accepted film), the product's own colours
+(`look.py from-shot shots/*.png --out look.json`), or one made for this film. Show the three and let the user pick.
+The template's story — kinetic words → typed prompt → ticking checklist → result → staccato
hits → black wordmark — is one concept, never the default: an operation demo built on it passed every oracle leg
(carry 1.00) and was sent back as 「和 motion web 很像…没有创造力」.
@@ -121,6 +124,12 @@ one continuous hand path every sim reads from) — copy its beats only when that
otherwise keep its contract and helpers and write the concept's own beats. Everything is `f(t)`; sims are pre-simulated once at 240 Hz and
sampled. Preview `?play`, pin `?t=6.4&hud`. `references/motion-library.md`, `references/composition.md`.
+**The look ships with the comp.** `python3 scripts/look.py apply ember cases/my-film/comp.html` (or a `look.json`)
+writes `look.js` beside it: the eight colours as CSS variables and `LOOK.color`, three OFL faces subset to the glyphs
+the comp sets and inlined, so the `file://` render gets real type. Load it before the comp's script, write against
+`var(--ink)` / `var(--display)` or `LOOK.font('display', 96)`, and chain `window.__ready` on `LOOK.ready`. Re-run it
+after copy changes; it names any character a face lacks (`--cjk <font>` for Chinese / Japanese / Korean).
+
**Camera: keyed, but operated.** `OM.camera(t, keys)` puts the camera where each beat needs it; the feel of an
operator comes from how the keys are placed: key the subject ~0.1 s ahead on `sineInOut` to follow it, key the landing
point before a snap on `expoInOut` to whip to it, add a hand (a slow two-sine float, zero in the holds) and `OM.shake`
@@ -182,7 +191,8 @@ behind a snap and nothing else noticed. With `--ref`, the reference's energy map
- **Never default to the template's story.** Three concepts that differ in their central idea; the user picks
(§2). A new film in the template's beats reads as the template, however good the craft.
- **Never carry the last film's look into the next.** Palette, stage, camera grammar, transitions: the tools
- (replica, narration, time warp) are reusable, the look is not. Name those choices in the concept round.
+ (replica, narration, time warp) are reusable, the look is not. Name those choices in the concept round. A preset
+ from `looks/` is fine when it is picked there by name; a silent default is not.
- **A second language never forks the composition.** `?lang=`, a time warp, and the source cut checked
pixel-identical. A copied comp doubles every later fix.
- **Never cut on a metronome.** Equal shot lengths read as slides no matter how good each shot is.
@@ -217,8 +227,10 @@ behind a snap and nothing else noticed. With `--ref`, the reference's energy map
| path | what |
|---|---|
| `lib/motion.js` | the move library → `window.OM`: curves, springs, entrances, carries, contact, sims, camera, fluid |
+| `looks/looks.json` | six starting looks (eight colour tokens, three faces each) measured from accepted films; `looks/fonts/` the OFL faces and their licences |
+| `scripts/look.py` | `list` / `sheet` / `check` the looks, `from-shot` a look from product screenshots, `apply` → `look.js` with the faces subset and inlined |
| `lib/ui_kit.js` | → `window.UIK`: a rebuilt UI on the plane (`stage`, `domLocal`, `rectCache`, `flow`), the content-hugging `glowRing`, legibility (`screenPx`, `zoomFor`), languages (`tr`, `loadFont`), `timeWarp` between a narration and the authored timeline, `subAt` |
-| `gallery/gallery.html` | one live demo per move (`?demo=ribbon&play`); `gallery/sheets/<move>.png` six frames + speed graph |
+| `gallery/gallery.html` | one live demo per move (`?demo=ribbon&play`); `gallery/sheets/<move>.png` six frames + speed graph; `gallery/sheets/looks.png` the looks |
| `scripts/analyze_ref.py` | reference → energy map, cuts, stillness, contact sheets, motion line (t80, smear), JSON |
| `scripts/record_footage.py` | config → real-time recordings with action marker → 30 fps frames + paths |
| `scripts/probe.py` | comp → what is on screen per frame → continuity per boundary, curves per move |
@@ -247,6 +259,6 @@ behind a snap and nothing else noticed. With `--ref`, the reference's energy map
| `cases/ebb-15s/` | case 7: one take through five places, carried by a field of light — keyed camera with a hand, shake and depth, odometer digits, a flood that drains in rings onto the next scene, silk cards on belts at three depths |
| `cases/<film>/` | every film made with this skill: the film and a README (beat sheet, numbers, what was rejected and why). Also: overlap, unbroken, skill-demo, and onetake's own launch film. The films' source code is not included |
-Requires: python3 with `playwright` (chromium), `numpy`, `scipy`, `Pillow`, `matplotlib`; `opencv-python` for the
+Requires: python3 with `playwright` (chromium), `numpy`, `scipy`, `Pillow`, `matplotlib`, `fonttools` + `brotli` (looks); `opencv-python` for the
motion line; `ffmpeg` / `ffprobe`; `node` for the library tests. Narration: `faster-whisper` (python3), and Kokoro
(`kokoro-onnx`, `soundfile`, plus `misaki[ja]` and `unidic-lite` for Japanese) in `~/.cache/kokoro/venv`.
diff --git a/gallery/sheets/looks.png b/gallery/sheets/looks.png
new file mode 100644
index 0000000..8627bdd
Binary files /dev/null and b/gallery/sheets/looks.png differ
diff --git a/looks/fonts/Archivo.ttf b/looks/fonts/Archivo.ttf
new file mode 100644
index 0000000..cc64253
Binary files /dev/null and b/looks/fonts/Archivo.ttf differ
diff --git a/looks/fonts/Fraunces.ttf b/looks/fonts/Fraunces.ttf
new file mode 100644
index 0000000..8210f94
Binary files /dev/null and b/looks/fonts/Fraunces.ttf differ
diff --git a/looks/fonts/Geist.ttf b/looks/fonts/Geist.ttf
new file mode 100644
index 0000000..f63f0af
Binary files /dev/null and b/looks/fonts/Geist.ttf differ
diff --git a/looks/fonts/GeistMono.ttf b/looks/fonts/GeistMono.ttf
new file mode 100644
index 0000000..173867d
Binary files /dev/null and b/looks/fonts/GeistMono.ttf differ
diff --git a/looks/fonts/InstrumentSans.ttf b/looks/fonts/InstrumentSans.ttf
new file mode 100644
index 0000000..3589b81
Binary files /dev/null and b/looks/fonts/InstrumentSans.ttf differ
diff --git a/looks/fonts/InstrumentSerif.ttf b/looks/fonts/InstrumentSerif.ttf
new file mode 100644
index 0000000..36fac00
Binary files /dev/null and b/looks/fonts/InstrumentSerif.ttf differ
diff --git a/looks/fonts/Inter.ttf b/looks/fonts/Inter.ttf
new file mode 100644
index 0000000..e724708
Binary files /dev/null and b/looks/fonts/Inter.ttf differ
diff --git a/looks/fonts/LICENSES.txt b/looks/fonts/LICENSES.txt
new file mode 100644
index 0000000..a7509e9
--- /dev/null
+++ b/looks/fonts/LICENSES.txt
@@ -0,0 +1,677 @@
+════ Inter.ttf ════
+
+Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
+
+
+════ InstrumentSans.ttf ════
+
+Copyright 2022 The Instrument Sans Project Authors (https://github.com/Instrument/instrument-sans)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
+
+
+════ InstrumentSerif.ttf ════
+
+Copyright 2022 The Instrument Serif Project Authors (https://github.com/Instrument/instrument-serif)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
+
+
+════ Fraunces.ttf ════
+
+Copyright 2018 The Fraunces Project Authors (https://github.com/undercasetype/Fraunces)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
+
+
+════ Archivo.ttf ════
+
+Copyright 2020 The Archivo Project Authors (https://github.com/Omnibus-Type/Archivo)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
+
+
+════ Geist.ttf ════
+
+Copyright 2024 The Geist Project Authors (https://github.com/vercel/geist-font.git)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://openfontlicense.org
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
+
+════ GeistMono.ttf ════
+
+Copyright 2024 The Geist Project Authors (https://github.com/vercel/geist-font.git)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://openfontlicense.org
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
+
diff --git a/looks/looks.json b/looks/looks.json
new file mode 100644
index 0000000..46c05c8
--- /dev/null
+++ b/looks/looks.json
@@ -0,0 +1,85 @@
+{
+ "about": "Starting looks, each measured from an accepted film and set in OFL faces that ship in looks/fonts. A look is picked by name in the concept round (SKILL.md §2), or made from the product with `look.py from-shot`; it is never a silent default. Every look has the same eight colours and three faces, so a comp written against the tokens can switch looks by name.",
+ "tokens": {
+ "ground": "the frame's ground — the 70 % of the picture",
+ "deep": "a second ground: vignette edge, far plane, a well under cards",
+ "card": "surfaces that sit on the ground",
+ "line": "hairlines, card edges, lattice",
+ "mute": "labels and secondary text; ≥ 3:1 on ground",
+ "ink": "type and the subject; ≥ 4.5:1 on ground",
+ "accent": "the one colour that means something",
+ "accent2": "its partner, used rarely"
+ },
+ "faces": {
+ "Inter": { "file": "Inter.ttf", "weight": "100 900", "pin": { "slnt": 0 }, "fallback": "system-ui, sans-serif" },
+ "Instrument Sans": { "file": "InstrumentSans.ttf", "weight": "400 700", "pin": { "wdth": 100 }, "fallback": "system-ui, sans-serif" },
+ "Instrument Serif": { "file": "InstrumentSerif.ttf", "weight": "400", "fallback": "Georgia, serif" },
+ "Fraunces": { "file": "Fraunces.ttf", "weight": "100 900", "pin": { "SOFT": 0, "WONK": 0 }, "fallback": "Georgia, serif" },
+ "Archivo": { "file": "Archivo.ttf", "weight": "100 900", "pin": { "wdth": 100 }, "fallback": "system-ui, sans-serif" },
+ "Archivo Condensed": { "file": "Archivo.ttf", "weight": "100 900", "pin": { "wdth": 62 }, "fallback": "'Arial Narrow', sans-serif" },
+ "Geist": { "file": "Geist.ttf", "weight": "100 900", "fallback": "system-ui, sans-serif" },
+ "Geist Mono": { "file": "GeistMono.ttf", "weight": "100 900", "fallback": "ui-monospace, Menlo, monospace" }
+ },
+ "looks": {
+ "paper": {
+ "from": "cases/motion-web-15s",
+ "mood": "white page, black type, one green tick — calm product UI, lots of air",
+ "color": { "ground": "#f8f8f6", "deep": "#ededea", "card": "#ffffff", "line": "#e4e4e0", "mute": "#83837f", "ink": "#161616", "accent": "#17a05e", "accent2": "#b42323" },
+ "type": {
+ "display": { "face": "Instrument Serif", "weight": 400, "tracking": -0.01 },
+ "text": { "face": "Inter", "weight": 500, "tracking": -0.02 },
+ "mono": { "face": "Geist Mono", "weight": 400, "tracking": 0 }
+ }
+ },
+ "dusk": {
+ "from": "cases/one-dot-15s",
+ "mood": "near-black violet night, one lit violet subject, warm cream type",
+ "color": { "ground": "#15131c", "deep": "#08070b", "card": "#1f1c29", "line": "#34313f", "mute": "#807c8c", "ink": "#efece6", "accent": "#7c6cff", "accent2": "#f4c64f" },
+ "type": {
+ "display": { "face": "Geist", "weight": 600, "tracking": -0.03 },
+ "text": { "face": "Inter", "weight": 450, "tracking": -0.01 },
+ "mono": { "face": "Geist Mono", "weight": 400, "tracking": 0 }
+ }
+ },
+ "tabletop": {
+ "from": "cases/knockon-15s",
+ "mood": "warm grey table under soft light, white objects, a red-orange cause",
+ "color": { "ground": "#f2efe9", "deep": "#e3dfd7", "card": "#ffffff", "line": "#d5d0c6", "mute": "#7d7970", "ink": "#1b1a18", "accent": "#ff5a36", "accent2": "#17a05e" },
+ "type": {
+ "display": { "face": "Inter", "weight": 700, "tracking": -0.035 },
+ "text": { "face": "Inter", "weight": 500, "tracking": -0.01 },
+ "mono": { "face": "Geist Mono", "weight": 400, "tracking": 0 }
+ }
+ },
+ "ultramarine": {
+ "from": "cases/clearing-15s",
+ "mood": "a saturated blue field, white type, one yellow — poster, not interface",
+ "color": { "ground": "#3548ec", "deep": "#1a28b0", "card": "#2436d0", "line": "#5566f0", "mute": "#b4bcf8", "ink": "#ffffff", "accent": "#ffd84a", "accent2": "#ff8a52" },
+ "type": {
+ "display": { "face": "Archivo", "weight": 800, "tracking": -0.02 },
+ "text": { "face": "Inter", "weight": 500, "tracking": -0.01 },
+ "mono": { "face": "Geist Mono", "weight": 500, "tracking": 0.02 }
+ }
+ },
+ "riso": {
+ "from": "cases/overlap-15s",
+ "mood": "cream stock, fluorescent pink and blue inks, condensed headlines — printed matter",
+ "color": { "ground": "#f4efe2", "deep": "#c9c2b2", "card": "#fbf8f0", "line": "#ddd6c6", "mute": "#7a7263", "ink": "#34322e", "accent": "#ff48b0", "accent2": "#0078bf" },
+ "type": {
+ "display": { "face": "Archivo Condensed", "weight": 800, "tracking": 0 },
+ "text": { "face": "Instrument Sans", "weight": 500, "tracking": 0 },
+ "mono": { "face": "Geist Mono", "weight": 400, "tracking": 0.02 }
+ }
+ },
+ "ember": {
+ "from": "cases/ebb-15s",
+ "mood": "warm paper and brown ink, an orange light — editorial serif, slow and soft",
+ "color": { "ground": "#fdfbf7", "deep": "#f3ebe1", "card": "#fffaf5", "line": "#e6dace", "mute": "#8e7a69", "ink": "#2b1d14", "accent": "#ec682e", "accent2": "#f4965c" },
+ "type": {
+ "display": { "face": "Fraunces", "weight": 400, "tracking": -0.02 },
+ "text": { "face": "Instrument Sans", "weight": 500, "tracking": -0.005 },
+ "mono": { "face": "Geist Mono", "weight": 400, "tracking": 0 }
+ }
+ }
+ }
+}
diff --git a/scripts/look.py b/scripts/look.py
new file mode 100644
index 0000000..b344aee
--- /dev/null
+++ b/scripts/look.py
@@ -0,0 +1,413 @@
+#!/usr/bin/env python3
+"""look.py — the starting looks: eight colours and three OFL faces, subset and inlined for a file:// comp.
+
+A look is a choice made in the concept round (SKILL.md §2), not a default. Six are measured from accepted films
+(looks/looks.json); `from-shot` makes one from the product's own screenshots; either way it is named.
+
+ python3 scripts/look.py list # the looks and the film each came from
+ python3 scripts/look.py sheet # → gallery/sheets/looks.png, one tile per look
+ python3 scripts/look.py check [mine.json] # ink / mute / accent contrast on the ground
+ python3 scripts/look.py apply ember cases/my-film/comp.html # → cases/my-film/look.js
+ python3 scripts/look.py apply cases/my-film/look.json cases/my-film/comp.html --text-from strings.json --cjk NotoSansSC.ttf
+ python3 scripts/look.py from-shot shot1.png shot2.png --faces paper --out cases/my-film/look.json
+
+In the comp, before its own script: <script src="look.js"></script>
+ DOM var(--ground) … var(--accent2), font-family: var(--display) / var(--text) / var(--mono),
+ var(--display-weight), letter-spacing: var(--display-tracking)
+ canvas ctx.font = LOOK.font('display', 96); ctx.letterSpacing = LOOK.track('display', 96); LOOK.color.ink
+ render window.__ready = LOOK.ready.then(() => { measure(); seek(0); })
+
+Why inlined: render.py loads the comp over file://, where a remote @font-face never arrives and canvas silently
+falls back to a system face. apply subsets each face to the glyphs the comp sets (plus printable ASCII, so copy
+edits rarely need a re-run) and embeds them as base64 woff2 — tens of KB, not megabytes. Re-run it after copy
+changes that add characters; it reports any character a face lacks (CJK needs --cjk).
+
+Faces are SIL OFL 1.1 (looks/fonts/LICENSES.txt). Pinned axes (Archivo Condensed's wdth 62) are instanced at
+build time, so canvas and DOM see the same face without font-variation-settings.
+"""
+import argparse, base64, colorsys, io, json, pathlib, re, sys
+
+ROOT = pathlib.Path(__file__).resolve().parent.parent
+LOOKS = ROOT / "looks" / "looks.json"
+FONTS = ROOT / "looks" / "fonts"
+ROLES = ("display", "text", "mono")
+COLORS = ("ground", "deep", "card", "line", "mute", "ink", "accent", "accent2")
+TYPO = "“”‘’–—…·×→←↑↓✓•°±%€£" # common punctuation a comp may set from JS strings built at runtime
+
+
+def load_db():
+ return json.loads(LOOKS.read_text())
+
+
+def resolve(spec, db):
+ """A look by name, or a JSON file holding one look (from-shot's output, or hand-written)."""
+ if spec in db["looks"]:
+ return dict(db["looks"][spec], name=spec)
+ p = pathlib.Path(spec)
+ if p.suffix == ".json" and p.exists():
+ look = json.loads(p.read_text())
+ look.setdefault("name", p.stem)
+ missing = [c for c in COLORS if c not in look.get("color", {})] + [r for r in ROLES if r not in look.get("type", {})]
+ if missing:
+ sys.exit(f"look.py: {p} lacks {', '.join(missing)}")
+ return look
+ sys.exit(f"look.py: no look '{spec}' — one of {', '.join(db['looks'])}, or a .json file")
+
+
+# ── colour ────────────────────────────────────────────────────────────────────────────────────────────────────────
+def rgb(h):
+ h = h.lstrip("#")
+ return tuple(int(h[i:i + 2], 16) for i in (0, 2, 4))
+
+
+def hexc(c):
+ return "#%02x%02x%02x" % tuple(max(0, min(255, round(v))) for v in c)
+
+
+def lum(c):
+ def ch(v):
+ v /= 255
+ return v / 12.92 if v <= 0.04045 else ((v + 0.055) / 1.055) ** 2.4
+ r, g, b = (ch(v) for v in c)
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b
+
+
+def contrast(a, b):
+ la, lb = sorted((lum(a), lum(b)), reverse=True)
+ return (la + 0.05) / (lb + 0.05)
+
+
+def mix(a, b, k):
+ return tuple(x + (y - x) * k for x, y in zip(a, b))
+
+
+def check(look):
+ g = rgb(look["color"]["ground"])
+ rows, ok = [], True
+ for tok, floor in (("ink", 4.5), ("mute", 3.0), ("accent", 1.8), ("accent2", 1.5)):
+ c = contrast(rgb(look["color"][tok]), g)
+ flag = "ok" if c >= floor else "LOW"
+ ok &= c >= floor or tok.startswith("accent") # accents are advisory: a yellow on white can be the point
+ rows.append(f" {tok:8s} {look['color'][tok]} {c:5.2f}:1 (≥ {floor}) {flag}")
+ return ok, rows
+
+
+# ── faces ─────────────────────────────────────────────────────────────────────────────────────────────────────────
+def family_of(face):
+ return "Look" + re.sub(r"[^A-Za-z0-9]", "", face)
+
+
+def need_fonttools():
+ try:
+ import fontTools # noqa: F401
+ import brotli # noqa: F401
+ except ImportError:
+ sys.exit("look.py: needs fontTools and brotli — `python3 -m pip install fonttools brotli`")
+ import logging
+ logging.getLogger("fontTools").setLevel(logging.ERROR) # "meta NOT subset" and friends
+
+
+def subset_face(path, pin, chars):
+ """→ (woff2 bytes, cmap set). Pins axes first (partial instancing keeps the others variable)."""
+ from fontTools.ttLib import TTFont
+ from fontTools.subset import Subsetter, Options
+ f = TTFont(str(path))
+ cmap = set(f.getBestCmap())
+ if pin and "fvar" in f:
+ from fontTools.varLib import instancer
+ axes = {a.axisTag for a in f["fvar"].axes}
+ f = instancer.instantiateVariableFont(f, {k: v for k, v in pin.items() if k in axes})
+ o = Options()
+ o.flavor = "woff2"
+ o.layout_features = ["*"] # tnum for counters, case, ss/cv sets — cheap at this glyph count
+ o.name_IDs = ["*"]
+ o.notdef_outline = True
+ o.drop_tables += ["DSIG"]
+ s = Subsetter(options=o)
+ s.populate(unicodes=sorted(ord(c) for c in chars))
+ s.subset(f)
+ buf = io.BytesIO()
+ f.flavor = "woff2"
+ f.save(buf)
+ return buf.getvalue(), cmap
+
+
+def build_faces(look, db, chars, cjk=None, prefix=""):
+ """→ ([(family, weight, b64)], {role: {family, stack, weight, tracking}}, missing{face: chars})."""
+ need_fonttools()
+ faces, types, missing, done = [], {}, {}, {}
+ cjk_fam = None
+ if cjk:
+ cjk_fam = prefix + "LookCJK"
+ data, cjk_cmap = subset_face(pathlib.Path(cjk), None, [c for c in chars if ord(c) > 0x2e7f])
+ faces.append((cjk_fam, "100 900", base64.b64encode(data).decode()))
+ for role in ROLES:
+ t = look["type"][role]
+ face = t["face"]
+ spec = db["faces"].get(face)
+ if not spec:
+ sys.exit(f"look.py: unknown face '{face}' — one of {', '.join(db['faces'])}")
+ fam = prefix + family_of(face)
+ if face not in done:
+ data, cmap = subset_face(FONTS / spec["file"], spec.get("pin"), chars)
+ faces.append((fam, spec["weight"], base64.b64encode(data).decode()))
+ done[face] = cmap
+ lack = sorted({c for c in chars if not c.isspace() and ord(c) not in cmap
+ and not (cjk and ord(c) in cjk_cmap)})
+ if lack:
+ missing[face] = "".join(lack)
+ stack = ", ".join([f"'{fam}'"] + ([f"'{cjk_fam}'"] if cjk_fam else []) + [spec["fallback"]])
+ types[role] = {"face": face, "family": fam, "stack": stack, "weight": t["weight"], "tracking": t["tracking"]}
+ return faces, types, missing
+
+
+def comp_chars(paths):
+ text = ""
+ for p in paths:
+ s = pathlib.Path(p).read_text(errors="ignore")
+ text += re.sub(r"base64,[A-Za-z0-9+/=]+", "", s)
+ used = {c for c in text if ord(c) >= 0x20}
+ return used, used | {chr(c) for c in range(0x20, 0x7F)} | set(TYPO)
+
+
+# ── commands ──────────────────────────────────────────────────────────────────────────────────────────────────────
+def cmd_list(a):
+ db = load_db()
+ for name, lk in db["looks"].items():
+ ty = lk["type"]
+ print(f"{name:12s} {lk['from']:26s} {ty['display']['face']} / {ty['text']['face']} / {ty['mono']['face']}")
+ print(f"{'':12s} {lk['mood']}")
+ print(f"{'':12s} " + " ".join(f"{k} {lk['color'][k]}" for k in COLORS))
+
+
+def cmd_check(a):
+ db = load_db()
+ specs = [a.look] if a.look else list(db["looks"])
+ bad = 0
+ for spec in specs:
+ look = resolve(spec, db)
+ ok, rows = check(look)
+ print(f"{look['name']}: {'PASS' if ok else 'FAIL'}")
+ print("\n".join(rows))
+ bad += not ok
+ sys.exit(1 if bad else 0)
+
+
+JS = """/* look.js — generated by ohmymotion scripts/look.py; re-run `look.py apply` after copy changes, never edit by hand.
+ * look: {name} ({origin}) · faces: {facelist} · subset to {nchars} characters · SIL OFL 1.1 (looks/fonts/LICENSES.txt)
+ * DOM: var(--ink), font-family: var(--display) · canvas: ctx.font = LOOK.font('display', 96) · render: LOOK.ready
+ */
+(function (root) {{
+ 'use strict';
+ const LOOK = {meta};
+ const FACES = {faces};
+ const bytes = b64 => Uint8Array.from(atob(b64), c => c.charCodeAt(0));
+ // canvas helpers: the role's weight unless one is passed; tracking is stored in em, canvas wants px
+ LOOK.font = (role, px, weight) => `${{weight || LOOK.type[role].weight}} ${{px}}px ${{LOOK.type[role].stack}}`;
+ LOOK.track = (role, px) => `${{(LOOK.type[role].tracking * px).toFixed(2)}}px`;
+ const el = root.document.documentElement;
+ for (const [k, v] of Object.entries(LOOK.color)) el.style.setProperty('--' + k, v);
+ for (const [r, t] of Object.entries(LOOK.type)) {{
+ el.style.setProperty('--' + r, t.stack);
+ el.style.setProperty(`--${{r}}-weight`, String(t.weight));
+ el.style.setProperty(`--${{r}}-tracking`, t.tracking + 'em');
+ }}
+ // FontFace from bytes: loaded and parsed before __ready resolves, no network, same result every render
+ LOOK.ready = Promise.all(FACES.map(([family, weight, b64]) => {{
+ const f = new FontFace(family, bytes(b64), {{ weight }});
+ root.document.fonts.add(f);
+ return f.load();
+ }}));
+ root.LOOK = LOOK;
+}})(window);
+"""
+
+
+def render_js(look, faces, types, nchars):
+ meta = {"name": look["name"], "from": look.get("from", ""), "color": {k: look["color"][k] for k in COLORS},
+ "type": types}
+ facelist = ", ".join(dict.fromkeys(t["face"] for t in types.values()))
+ face_js = "[\n" + ",\n".join(f" [{json.dumps(f)}, {json.dumps(w)}, '{b}']" for f, w, b in faces) + "\n ]"
+ return JS.format(name=look["name"], origin=look.get("from", "custom"), facelist=facelist, nchars=nchars,
+ meta=json.dumps(meta, ensure_ascii=False), faces=face_js)
+
+
+def cmd_apply(a):
+ db = load_db()
+ look = resolve(a.look, db)
+ comp = pathlib.Path(a.comp)
+ used, chars = comp_chars([comp] + list(a.text_from or []))
+ faces, types, missing = build_faces(look, db, sorted(chars), a.cjk)
+ out = pathlib.Path(a.out) if a.out else comp.with_name("look.js")
+ js = render_js(look, faces, types, len(chars))
+ out.write_text(js)
+ ok, rows = check(look)
+ print(f"{out} · look {look['name']} · {len(js) / 1024:.0f} KB · {len(chars)} characters")
+ for role, t in types.items():
+ print(f" {role:8s} {t['face']:18s} {t['weight']} tracking {t['tracking']}em")
+ print("\n".join(rows))
+ groups = {}
+ for face, lack in missing.items():
+ groups.setdefault("".join(c for c in lack if c in used), []).append(face)
+ for shown, faces_ in groups.items():
+ if shown:
+ print(f" ! {' / '.join(faces_)} lack{'s' if len(faces_) == 1 else ''} {len(shown)} character(s) the comp sets: {shown[:40]}"
+ f"{'…' if len(shown) > 40 else ''} — they fall back to the system face"
+ + ("; pass --cjk <font file>" if any(ord(c) > 0x2e7f for c in shown) else ""))
+ if "look.js" not in comp.read_text(errors="ignore"):
+ print(f" → add <script src=\"{out.name}\"></script> to {comp.name} and chain __ready on LOOK.ready")
+
+
+SHEET = """<!DOCTYPE html><html><head><meta charset="utf-8"><style>
+html,body{{margin:0;background:#000}} .g{{display:grid;grid-template-columns:960px 960px;gap:0}}
+.t{{position:relative;width:960px;height:540px;overflow:hidden}}
+.lab{{position:absolute;left:44px;top:36px;font-size:17px;letter-spacing:.02em}}
+.big{{position:absolute;left:40px;top:92px;font-size:112px;line-height:1;white-space:nowrap}}
+.mood{{position:absolute;left:44px;top:232px;width:520px;font-size:23px;line-height:1.35}}
+.card{{position:absolute;right:44px;top:92px;width:300px;height:212px;border-radius:16px;box-sizing:border-box;padding:24px 26px}}
+.card .m{{font-size:15px;line-height:30px;white-space:nowrap}} .pill{{display:inline-block;margin-top:18px;padding:0 18px;
+ height:40px;line-height:40px;border-radius:999px;font-size:17px}}
+.sw{{position:absolute;left:44px;right:44px;bottom:40px;display:flex;gap:14px}}
+.sw div{{flex:1;font-size:12px;line-height:1.5}} .sw i{{display:block;height:44px;border-radius:10px;margin-bottom:8px}}
+</style></head><body><div class="g">{tiles}</div><script>{scripts}
+window.__ready = Promise.all([{readies}]).then(() => document.querySelectorAll('.big').forEach(e => {{
+ let px = 112; while (e.offsetWidth > 530 && px > 40) e.style.fontSize = (px -= 2) + 'px'; }}));</script></body></html>"""
+
+
+def cmd_sheet(a):
+ db = load_db()
+ tiles, scripts, readies = [], [], []
+ phrase = "Make it move."
+ for i, (name, lk) in enumerate(db["looks"].items()):
+ look = dict(lk, name=name)
+ chars = sorted(set(phrase + name + lk["from"] + lk["mood"] + "".join(lk["color"].values())
+ + "".join(COLORS) + "verify → PASS Render" + TYPO + "0123456789·"))
+ faces, types, _ = build_faces(look, db, chars, prefix=f"s{i}")
+ c = lk["color"]
+ ty = {r: f"font-family:{t['stack']};font-weight:{t['weight']};letter-spacing:{t['tracking']}em" for r, t in types.items()}
+ sw = "".join(f"<div style=\"{ty['mono']};color:{c['mute']}\"><i style=\"background:{c[k]};"
+ f"box-shadow:inset 0 0 0 1px {c['line']}\"></i>{k}<br>{c[k]}</div>" for k in COLORS)
+ tiles.append(
+ f"<div class=\"t\" style=\"background:radial-gradient(120% 90% at 30% 35%,{c['ground']} 55%,{c['deep']})\">"
+ f"<div class=\"lab\" style=\"{ty['mono']};color:{c['mute']}\">{name} · {lk['from']}</div>"
+ f"<div class=\"big\" style=\"{ty['display']};color:{c['ink']}\">{phrase}</div>"
+ f"<div class=\"mood\" style=\"{ty['text']};color:{c['ink']}\">{lk['mood']}</div>"
+ f"<div class=\"card\" style=\"background:{c['card']};border:1px solid {c['line']}\">"
+ f"<div class=\"m\" style=\"{ty['mono']};color:{c['mute']}\">$ verify</div>"
+ f"<div class=\"m\" style=\"{ty['mono']};color:{c['ink']}\">continuity · 0.83</div>"
+ f"<div class=\"m\" style=\"{ty['mono']};color:{c['ink']}\">→ <b style=\"color:{c['accent']};font-weight:inherit\">PASS</b></div>"
+ f"<div class=\"pill\" style=\"{ty['text']};background:{c['accent']};color:{c['ground'] if contrast(rgb(c['ground']), rgb(c['accent'])) > contrast(rgb(c['ink']), rgb(c['accent'])) else c['ink']}\">Render</div>"
+ f"<span style=\"display:inline-block;width:14px;height:14px;border-radius:50%;margin-left:14px;vertical-align:-1px;background:{c['accent2']}\"></span>"
+ f"</div><div class=\"sw\">{sw}</div></div>")
+ for fam, w, b in faces:
+ scripts.append(f"const f_{fam}=new FontFace('{fam}',Uint8Array.from(atob('{b}'),c=>c.charCodeAt(0)),{{weight:'{w}'}});"
+ f"document.fonts.add(f_{fam});")
+ readies.append(f"f_{fam}.load()")
+ html = SHEET.format(tiles="".join(tiles), scripts="\n".join(scripts), readies=",".join(readies))
+ out = pathlib.Path(a.out)
+ out.parent.mkdir(parents=True, exist_ok=True)
+ tmp = out.with_suffix(".html")
+ tmp.write_text(html)
+ from playwright.sync_api import sync_playwright
+ rows = -(-len(tiles) // 2)
+ with sync_playwright() as p:
+ b = p.chromium.launch()
+ pg = b.new_page(viewport={"width": 1920, "height": 540 * rows})
+ pg.goto(tmp.resolve().as_uri())
+ pg.evaluate("window.__ready")
+ pg.screenshot(path=str(out))
+ b.close()
+ if not a.keep_html:
+ tmp.unlink()
+ print(f"{out} · {len(tiles)} looks")
+
+
+def cmd_from_shot(a):
+ """Palette from the product's own screenshots. Pixels are counted in a coarse RGB histogram, not quantized: a
+ median cut spends its palette on the near-whites of a UI and merges the text and the brand colour into greys.
+ Core colours concentrate in one bin while anti-aliasing smears across many, so "most frequent bin that meets
+ the role's contrast" finds them: ground = commonest; ink = commonest neutral at ≥ 4.5:1; accent = the hue
+ family (12 buckets) with the most chromatic pixels (≥ 0.03 % of the frame); accent2 = the next family at least 60° away."""
+ import numpy as np
+ from PIL import Image
+ db = load_db()
+ base = resolve(a.faces, db)
+ counts = {}
+ for p in a.shots:
+ im = Image.open(p).convert("RGB")
+ k = max(1, max(im.size) // 900)
+ px = np.asarray(im.resize((im.width // k, im.height // k), Image.NEAREST)).reshape(-1, 3).astype(int) // 8
+ keys, n = np.unique(px, axis=0, return_counts=True)
+ for c, m in zip(map(tuple, keys), n):
+ c = tuple(int(v) for v in c)
+ counts[c] = counts.get(c, 0) + int(m)
+ total = sum(counts.values())
+ bins = sorted(((m / total, tuple(v * 8 + 4 for v in c)) for c, m in counts.items()), reverse=True)
+ ground = bins[0][1]
+ light = lum(ground) > 0.4
+
+ def hls(c):
+ return colorsys.rgb_to_hls(*(v / 255 for v in c))
+
+ def chroma(c):
+ h, l, s = hls(c)
+ return s * (1 - abs(2 * l - 1))
+
+ def first(pred, floor=0.0005):
+ return next((c for s, c in bins if s >= floor and pred(c)), None)
+
+ neutral = lambda c: chroma(c) < 0.12
+ ink = first(lambda c: neutral(c) and contrast(c, ground) >= 7) or first(lambda c: neutral(c) and contrast(c, ground) >= 4.5)
+ ink = ink or ((22, 22, 22) if light else (240, 238, 232))
+ fam = {}
+ for s, c in bins:
+ if s >= 0.00002 and chroma(c) > 0.3 and contrast(c, ground) >= 1.3: # a UI's accent is ~0.1 % of it
+ fam.setdefault(int(hls(c)[0] * 12) % 12, []).append((s, c))
+ ranked = sorted(((h, v) for h, v in fam.items() if sum(s for s, _ in v) >= 0.0003),
+ key=lambda kv: -sum(s for s, _ in kv[1]))
+ accent = ranked[0][1][0][1] if ranked else mix(ink, ground, 0.35)
+ far = [v for h, v in ranked[1:] if min(abs(h - ranked[0][0]), 12 - abs(h - ranked[0][0])) >= 2]
+ accent2 = far[0][0][1] if far else mix(accent, ground, 0.45)
+ mute = first(lambda c: neutral(c) and 3 <= contrast(c, ground) < 6) or mix(ground, ink, 0.55)
+ line = first(lambda c: neutral(c) and 1.1 <= contrast(c, ground) < 1.6, 0.002) or mix(ground, ink, 0.12)
+ card = first(lambda c: c != ground and contrast(c, ground) < 1.1, 0.01) or \
+ (mix(ground, (255, 255, 255), 0.6) if light else mix(ground, ink, 0.06))
+ deep = mix(ground, (0, 0, 0), 0.06 if light else 0.45)
+ look = {"name": pathlib.Path(a.out).stem if a.out else "product",
+ "from": ", ".join(str(p) for p in a.shots),
+ "mood": "the product's own colours, measured from its screenshots",
+ "color": {k: hexc(v) for k, v in dict(ground=ground, deep=deep, card=card, line=line, mute=mute, ink=ink,
+ accent=accent, accent2=accent2).items()},
+ "type": base["type"]}
+ txt = json.dumps(look, indent=2, ensure_ascii=False)
+ if a.out:
+ pathlib.Path(a.out).write_text(txt + "\n")
+ print(f"{a.out} · faces from '{base['name']}' — edit the file to change them")
+ else:
+ print(txt)
+ ok, rows = check(look)
+ print("\n".join(rows))
+ print(" hue families: " + " ".join(f"{hexc(v[0][1])} {sum(s for s, _ in v):.2%}" for h, v in ranked[:5]))
+
+
+def main():
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ sub = ap.add_subparsers(dest="cmd", required=True)
+ sub.add_parser("list").set_defaults(fn=cmd_list)
+ c = sub.add_parser("check"); c.add_argument("look", nargs="?"); c.set_defaults(fn=cmd_check)
+ s = sub.add_parser("sheet"); s.add_argument("--out", default=str(ROOT / "gallery" / "sheets" / "looks.png"))
+ s.add_argument("--keep-html", action="store_true"); s.set_defaults(fn=cmd_sheet)
+ p = sub.add_parser("apply"); p.add_argument("look"); p.add_argument("comp")
+ p.add_argument("--out", help="default: look.js next to the comp")
+ p.add_argument("--text-from", nargs="*", help="more files whose characters the film sets (string tables, other languages)")
+ p.add_argument("--cjk", help="a CJK font file (e.g. Noto Sans SC) appended to every stack, subset to the CJK the comp sets")
+ p.set_defaults(fn=cmd_apply)
+ f = sub.add_parser("from-shot"); f.add_argument("shots", nargs="+")
+ f.add_argument("--faces", default="paper", help="the look whose three faces to keep (default paper)")
+ f.add_argument("--out", help="write the look here (.json); prints it otherwise"); f.set_defaults(fn=cmd_from_shot)
+ a = ap.parse_args()
+ a.fn(a)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/templates/comp.html b/templates/comp.html
index 19f00a6..fea3f00 100644
--- a/templates/comp.html
+++ b/templates/comp.html
@@ -4,9 +4,10 @@
<head>
<meta charset="utf-8">
<title>onetake · composition</title>
-<!-- FONTS: the motion-web film shipped subset faces as faces.css (families 'Sans','Serif','Mono', generated with
- motion-web's subset_fonts.py pack --text-from). Without it the stacks below fall back to Inter / Georgia /
- system mono. Add <link rel="stylesheet" href="faces.css"> once you have real faces; the render waits on document.fonts.ready. -->
+<!-- FONTS: the motion-web film shipped subset faces as faces.css (families 'Sans','Serif','Mono'). Without it the
+ stacks below fall back to Inter / Georgia / system mono. Its look is `paper` in looks/looks.json; for this or any
+ other look, `python3 scripts/look.py apply <look> comp.html` writes look.js (colours + inlined faces) — load it
+ before the script below and write against var(--ink) / var(--display); the render waits on window.__ready. -->
<style>
:root{ --bg:#f8f8f6; --ink:#161616; --grey:#8f8f8b; --green:#17a05e; --red:#b42323; --card:#fff; --line:#e8e8e4; }
html,body{margin:0;width:1920px;height:1080px;overflow:hidden;background:var(--bg)}