Skip to content

Pluggable looks: let other packages supply a mark look (#3) - #4

Merged
visul merged 3 commits into
mainfrom
look-hook
Oct 10, 2026
Merged

visul merged 3 commits into
mainfrom
look-hook

Conversation

@visul

@visul visul commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Implements option 1 from #3: a small ainotate.looks entry point, so a separate package can supply a look (for example the soft "neat" look) while the built-in look stays the default.

  • Commit 1 is @testy-cool's look-hook branch, rebased on main, authorship kept.
  • Commit 2 adds what we asked for in Optional softer look for marks (neat-annotations style)? #3: a look that is installed but fails to import, is not a Look subclass or fails to start renders with the built-in look plus a warning, instead of failing the render. It also pins the default-look pixels per platform: fonts come from the system, so the Linux pin from the contributor and a macOS pin made on main before this change both hold. The macOS pin confirms the default render is pixel-identical.
  • Commit 3: CHANGELOG.

How a look is picked: "look" in the spec, --look, the MCP look argument, AINOTATE_LOOK, or look in config.toml. An unknown name is a spec error that lists the installed looks.

Tests: 593 passed locally (web tests excluded), including 9 in tests/test_looks.py. All files stay under 500 lines (render.py 475).

Closes #3

🤖 Generated with Claude Code

testycool and others added 3 commits October 10, 2026 03:19
People want marks that look different from AInotate's bold default, for
example a calm hand-drawn style. Building each style into AInotate would
add fonts and drawing code to every install. A plug-in point keeps AInotate
small: a look lives in its own package and is used only where installed.

render() now draws every mark through a Look object. The built-in look,
the only one shipped, is the class `ainotate.render.Look`, which holds
exactly the drawing calls render() made before (colors, label font and
size, labels and text notes, outlines, step badges, arrows, highlights,
the spotlight dim and corner, the redaction fill, the keycap font, the
magnifier line width and the drop shadow). A package registers a subclass
under the entry point group "ainotate.looks" and overrides what it
changes. A look can change a redaction's color but never its area.

The look is chosen by spec "look", then the env AINOTATE_LOOK, then
`look` in config.toml (the same order as the output folder), then
"default". `annotate` and `shoot` take --look, and the MCP annotate,
preview and shoot tools take a `look` argument. An unknown name is a
spec error (exit 2) that says where it came from and lists the installed
looks.

The default look is pixel-identical: a test pins the sha256 of a render
of every mark type, light and dark, from before this change (Pillow
12.3.0 / FreeType 2.14.3; other versions skip the pin). Other tests
register a fake look, check that it draws the marks and is picked by the
flag, the env and the config file, and check the unknown-look error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ls per platform

A look that is installed but fails to import, is not a Look subclass, or fails to start
now renders with the built-in look and adds a warning instead of failing the render.
The pixel pin of the default look depends on system fonts, so it is kept per platform
(the macOS pin matches main before the hook: the default render is unchanged).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@visul
visul merged commit bb2c862 into main Oct 10, 2026
5 checks passed
@visul
visul deleted the look-hook branch October 10, 2026 00:31
visul added a commit that referenced this pull request Oct 10, 2026
#6)

Rebases testy-cool's #5 onto main: the look hook from #4 is replaced by this version,
which also recovers when a look fails mid-draw. Default renders stay pixel-identical
(per-platform pins kept from #4; golden tests pass on macOS).

Co-authored-by: testy-cool <202153476+testy-cool@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Optional softer look for marks (neat-annotations style)?

1 participant