Skip to content

About

The mark a thing gets when it has no picture: initials from its name, a colour slot from its id.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

lettermark

Go Reference

The mark a thing gets when it has no picture of its own: the letters that go in the square, and which of the palette's colour slots it is drawn on.

letters := lettermark.Initials(name)

marks := lettermark.NewPalette(12) // however many colours your theme paints
slot := marks.Slot(id)             // 0 … marks.Slots()-1

The palette is not here, and neither is its size. A caller keeps its own — CSS custom properties, a colour catalogue, a theme — and says how many colours are in it when it builds the palette. That keeps one thing in one place: the rule here, the colours where the rest of the design lives, the count beside them.

Build it once, with the rest of your setup. NewPalette refuses a count below 1, because a palette that paints nothing means the code and the theme disagree, and the place to hear that is startup rather than the middle of a screen.

The same id always answers the same slot, so a thing keeps its colour between screens and between runs — for as long as the palette holds the same number of colours. Painting one more or one fewer moves almost everything to a different colour, which readers notice.

A Palette is a value that holds one number and never changes, so the one you built at startup is read from as many goroutines as you like.

Initials is given the name a reader sees. A caller holding markup strips it first; this library does not know what markup its caller writes.

cases.yaml is the contract. Every port carries a copy of it and a test that compares that copy with this repository byte for byte, so a case added here is answered by all of them or fails loudly.

Ports

Lines of Code

Lines of Code graph

About

The mark a thing gets when it has no picture: initials from its name, a colour slot from its id.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages