lettermark

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

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.

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

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initials

func Initials(name string) string
Example
package main

import (
	"fmt"

	"github.com/botforge-pro/lettermark"
)

func main() {
	fmt.Println(lettermark.Initials("Wiki Layer"))
}
Output:
WL

Types

type Palette added in v0.2.0

type Palette struct {
	// contains filtered or unexported fields
}

func NewPalette added in v0.2.0

func NewPalette(slots int) Palette

func (Palette) Slot added in v0.2.0

func (p Palette) Slot(id int64) int

func (Palette) Slots added in v0.2.0

func (p Palette) Slots() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL