Help us shape the future of Go! Take the 2026 Go Developer Survey

themeaccess

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package themeaccess is what the module's own commands may do with the theme package that a host may not: write a theme's stylesheet and print text from a theme file safely. The theme package is public, so it exports neither; it registers the stylesheet generators here when it is loaded, and the pages' servers and the approve page's build call them through this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSS

func CSS[T any](themes []T) string

CSS is the stylesheet of the checked themes (see theme.css in the theme package). T is *theme.Theme; any other type panics.

func CSSDefault

func CSSDefault[T any](themes []T, def string) string

CSSDefault is CSS with def, the theme a reader starts in, as the :root block. A def that names no theme in themes panics.

func CSSLocked

func CSSLocked[T any](themes []T, lock string) string

CSSLocked is CSS for a page locked to the theme named lock: it has that theme only, no switch, and the system's contrast and forced-colors requests still win. A lock that names no theme in themes panics.

func Escape

func Escape(s string) string

Escape returns s with every rune that is not printable (a control character, an escape, a newline, a byte that is not UTF-8) written as a Go escape, so text from a hostile file is safe to print and cannot start a line of its own.

func Register

func Register(c func([]any) string, d func([]any, string, string) string, s func([]any) string)

Register is called once by the theme package's init with its generators, which take the themes as any because this package cannot import theme (theme imports it).

func SystemCSS

func SystemCSS[T any](themes []T) string

SystemCSS is the stylesheet of a page that takes no theme input: the shipped themes picked by the reader's system settings alone.

Types

This section is empty.

Jump to

Keyboard shortcuts

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