static

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package static renders diffs to a terminal writer with ANSI colouring.

Index

Constants

This section is empty.

Variables

View Source
var (
	Cyber   = themeFromPalette(theme.PaletteCyber)
	Matrix  = themeFromPalette(theme.PaletteMatrix)
	Dracula = themeFromPalette(theme.PaletteDracula)
	Nord    = themeFromPalette(theme.PaletteNord)
)

Functions

func Boot

func Boot(w io.Writer, fileA, fileB string, opts Options) func(added, removed, modified int, elapsed time.Duration)

Boot prints the diff boot sequence to w. Call before parsing; invoke the returned func after parsing to complete the line.

func Render

func Render(w io.Writer, d *node.Diff, opts Options) error

Render writes the coloured diff to w.

Types

type Options

type Options struct {
	Theme   Theme
	Context int  // lines of context per hunk (default 3)
	Stat    bool // print summary only, no diff body
	NoColor bool
	Quiet   bool
}

Options configures static rendering.

type Theme

type Theme struct {
	Added       lipgloss.Style
	Removed     lipgloss.Style
	Modified    lipgloss.Style // structured diffs: changed value
	Unchanged   lipgloss.Style
	HunkHeader  lipgloss.Style
	FileHeader  lipgloss.Style
	LineNumber  lipgloss.Style
	StatAdded   lipgloss.Style
	StatRemoved lipgloss.Style
	Banner      lipgloss.Style
}

Theme holds lipgloss styles for static diff rendering.

func ResolveTheme

func ResolveTheme(name string) Theme

ResolveTheme returns the named theme, defaulting to Cyber.

Jump to

Keyboard shortcuts

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