zalgo

package
v0.0.0-...-3c3bede Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorizeLine

func ColorizeLine(line string, p Palette, intensity float64, rng *rand.Rand) string

ColorizeLine applies palette colors to each grapheme cluster in a line. Clusters with combining marks are colored at full intensity. Unaffected clusters get a reduced probability so color bleeds into surrounding text.

func ColorizeRune

func ColorizeRune(s string, p Palette, intensity float64, charIndex int, rng *rand.Rand) string

ColorizeRune wraps a single rune string with a color from the palette. intensity controls how likely a character is to get colored (0 = never, 1 = always). charIndex provides variation across characters in a line.

func ListPalettes

func ListPalettes() []string

ListPalettes returns all available palette names.

func TransformLine

func TransformLine(line string, intensity float64, maxMarks int, rng *rand.Rand) string

TransformLine applies zalgo to every rune in a line.

func TransformRune

func TransformRune(r rune, intensity float64, maxMarks int, rng *rand.Rand) string

TransformRune applies zalgo combining characters to a single rune. intensity is 0.0 (no effect) to 1.0 (full effect). Returns the rune as a string with combining characters appended. TransformRune applies zalgo combining characters to a single rune. intensity is 0.0 (no effect) to 1.0 (full effect). Returns the rune as a string with combining characters appended.

Types

type Descent

type Descent struct {
	Start int
	End   int
}

Descent defines the line range over which zalgo intensity ramps from 0 to 1.

func DefaultDescent

func DefaultDescent() Descent

DefaultDescent returns the default descent range (lines 20-200).

func ParseDescent

func ParseDescent(s string) (Descent, error)

ParseDescent parses a "start:end" string into a Descent.

func (Descent) Intensity

func (d Descent) Intensity(line int) float64

Intensity returns the zalgo intensity for a given line number. Returns 0.0 before Start, 1.0 after End, linearly interpolated between.

func (Descent) String

func (d Descent) String() string

String returns the descent as "start:end".

type Palette

type Palette struct {
	Name   string
	Colors []string // hex color values
}

Palette defines a named color palette for zalgo text.

func GetPalette

func GetPalette(name string) (Palette, error)

GetPalette returns a palette by name, or an error if not found.

Jump to

Keyboard shortcuts

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