looks

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 10 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.

Documentation

Overview

Package looks reads the desktop app's looks. Each look is a folder in web/looks with a look.css that paints it and, in TOML between +++ lines at the top of its first comment, says what it is:

/* +++
id = "witch"
name = "Witchcraft"
…
+++

   The Witchcraft look (Settings › Look): …
*/

Plain's look.css only describes it: its colors are style.css's. Everything else that names the looks is made from those folders: the Settings › Look menu and its options, the stylesheet the pages load (bundle/looks.css), the look the app accepts in its settings, the tests every look must pass, the website's gallery and the GUI README's pictures.

docs/looks.md says how to add one, and

go run ./internal/newlook <folder> "<Name>"

starts one.

Index

Constants

View Source
const (
	ReadmeBegin = "<!-- looks: " + Generated + " -->"
	ReadmeEnd   = "<!-- end looks -->"
)

The GUI README's section on the looks is between these lines.

View Source
const Generated = "Generated by go generate from each look's web/looks/<folder>/look.css. DO NOT EDIT. See docs/looks.md."

Generated says, at the top of each file made from the looks, where it comes from. It opens web/bundle/looks.css as a CSS comment, so it must not hold the comment's end, */: a path glob like looks/*/look.css ended the comment early, and the rest of it hid the first rule, the Teletype paper's colours.

Variables

This section is empty.

Functions

func Readme

func Readme(readme []byte, all []Look) ([]byte, error)

Readme returns the GUI README, readme, with its section on the looks made again from all.

func SiteData

func SiteData(all []Look) ([]byte, error)

SiteData is site/data/looks.toml, for the website's looks band and its lists of the looks. Hugo reads it as site.Data.looks, with the looks as its "looks".

func TS

func TS(all []Look) ([]byte, error)

TS is web/src/looks.gen.ts: what the pages need to know about each look.

func Valid

func Valid(all []Look, id string) bool

Valid says whether id is a look's.

Types

type Hero

type Hero struct {
	Light string `toml:"light"`
	Dark  string `toml:"dark,omitempty"`
	Alt   string `toml:"alt"`
}

Hero is a picture, light and dark, for the website.

type Look

type Look struct {
	// ID is the look's value for the look setting and the pages'
	// data-look attribute, such as "tty"; its CSS selects
	// :root[data-look="tty"]. Plain's is empty. Lowercase letters and
	// digits, starting with a letter.
	ID string `toml:"id"`
	// Name is what Settings › Look and the docs call it, such as
	// "Teletype".
	Name string `toml:"name"`
	// Order places it in the Look menu and the galleries, lowest first.
	Order int `toml:"order"`
	// Since is the release that brought it, such as "1.4".
	Since string `toml:"since"`
	// Description is a sentence or two for Settings › Look, shown under
	// the menu while the look is chosen.
	Description string `toml:"description"`
	// Tagline finishes the website's "Plain for every day, Teletype
	// for …" sentence: "for fan-fold paper and green phosphor".
	Tagline string `toml:"tagline"`
	// TextSize is the text size, in percent, the look's CSS sets with
	// --text-scale, for the Text size slider. 0 is 100.
	TextSize int `toml:"textSize,omitempty"`
	// Tokens is the prefix of the CSS custom properties the look adds
	// to the plain look's, such as "--tty-". Each must be set in the
	// dark palette as well as the light one.
	Tokens string `toml:"tokens,omitempty"`
	// ContrastGaps excuses the look from TestLookContrast, for the
	// older looks whose gaps the accessibility audit lists. A new look
	// leaves it out and passes.
	ContrastGaps bool `toml:"contrastGaps,omitempty"`
	// Texture, if set, shows the texture checkboxes in Settings › Look
	// while the look is chosen.
	Texture *Texture `toml:"texture,omitempty"`
	// Hero is the look's picture in the website's looks band, from
	// site/static/images/app/. Taken from a release build, so a new
	// look can leave it out until then.
	Hero *Hero `toml:"hero,omitempty"`
	// Screenshots are the look's pictures in the GUI README, from
	// site/static/images/gui/.
	Screenshots []Shot `toml:"screenshots,omitempty"`

	// Dir is the look's folder in web/looks.
	Dir string `toml:"-"`
}

Look is what a look's look.css says of it, in its front matter.

func Load

func Load(fsys fs.FS) ([]Look, error)

Load reads every look in fsys, a folder of look folders, and returns them in order.

func Parse

func Parse(css []byte) (Look, error)

Parse reads a look.css's front matter: TOML between +++ lines, which open the file's first comment. Dir is left empty.

type Shot

type Shot struct {
	File string `toml:"file"`
	Alt  string `toml:"alt"`
}

Shot is a picture and its alt text.

type Texture

type Texture struct {
	Label     string `toml:"label"`
	Sprockets string `toml:"sprockets,omitempty"`
	Rules     string `toml:"rules,omitempty"`
	Shadows   string `toml:"shadows,omitempty"`
}

Texture names the texture switches a look draws, by the settings they turn off (noSprockets, noRules, noShadows), and the group's label. A switch with no name isn't shown.

Jump to

Keyboard shortcuts

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