Skip to main content

didbot_brand/
lib.rs

1//! The did.bot brand images, rebuilt from the simulation that draws the
2//! landing page.
3//!
4//! Every file this crate writes — the wordmark, the social card, the whole
5//! icon set, the favicon — is a snap of the same 2-D Ising anneal
6//! `crates/didbot-site-anim` runs in the browser, stopped at the end of
7//! its schedule. Nothing is traced, redrawn, or exported from a design
8//! tool, so there is no second copy of the mark to keep in step with the
9//! page: change the schedule and rebuild, and the images change with it.
10//!
11//! # Rebuilding
12//!
13//! ```text
14//! scripts/build-brand.sh          # rewrite site/public
15//! scripts/build-brand.sh --check  # fail if anything is stale
16//! ```
17//!
18//! Both run this crate's `render` example, which is what the generator is:
19//! a program run from a checkout to refresh committed files, never one
20//! anybody installs. The `--check` form is what CI runs, and it is the
21//! reason the images are committed at all: the tree is allowed to hold
22//! generated files as long as something proves they are the ones the
23//! generator produces.
24//!
25//! # Icons, and what "the same noise" means
26//!
27//! An icon is not the wordmark shrunk. It is a size ladder of marks — a
28//! "d" cut out of a disc from 48 sites up, the dot below that — set in
29//! the same six-glyph font, annealed on its own square lattice by the
30//! same schedule, and painted with the same two colours at the same
31//! one-block-a-site magnification. So the grain reads as the same
32//! material as the landing page at every size, without ever resampling a
33//! picture of it. [`mark`] is where the ladder is written down, and each
34//! tier's doc comment says what fails on the tile below it. "did.bot"
35//! itself appears only on the wordmark and the social card.
36//!
37//! Every icon also carries three [`mark::Specks`] — pinned sites the field
38//! does not decide, single pixels at 16 and irregular clumps above it.
39//!
40//! # Determinism
41//!
42//! An image is a pure function of its [`mark::Mark`] — no clock, no
43//! entropy, no filesystem — so building twice on one host gives identical
44//! bytes, which `--check` relies on. Bit-exactness across platforms is
45//! not promised, for the reason `didbot-avatar` gives: the Metropolis
46//! acceptance test goes through `exp`, and a `libm` is entitled to its own
47//! last bit. That is why `--check` is a CI gate on one platform rather
48//! than a claim about every machine.
49//!
50//! # Pages
51//!
52//! [`page`] draws the page a browser lands on at each step of a sign-in,
53//! around [`WORDMARK_SVG`] and [`FAVICON_SVG`]. A server needs only that,
54//! so everything else here is behind the default `render` feature, and the
55//! simulation with it.
56
57#![forbid(unsafe_code)]
58
59#[cfg(feature = "render")]
60pub mod ico;
61#[cfg(feature = "render")]
62pub mod mark;
63pub mod page;
64#[cfg(feature = "render")]
65pub mod paint;
66#[cfg(feature = "render")]
67mod render;
68
69#[cfg(feature = "render")]
70pub use render::*;
71
72/// The cropped wordmark as `scripts/build-brand.sh` last wrote it, for a
73/// page that carries the logo inline rather than linking to the site.
74pub const WORDMARK_SVG: &str = include_str!("../../../site/public/brand/wordmark-tight.svg");
75
76/// The tab icon, the same way.
77pub const FAVICON_SVG: &str = include_str!("../../../site/public/favicon.svg");