color

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package color provides configuration for coloring for unified diffs using ANSI escape sequences.

Specifying colors uses [Select Graphic Rendition parameters]. For example the code below, presents the header in bold yellow:

HunkHeader(1, 33)

This is equivalent to the following raw ANSI sequence: \033[1;33m.

It's the responsibility of the caller to ensure that the parameters are correct and supported by the underlying terminal.

[Select Graphic Rendition parameters]: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*config.ColorConfig)

A Option makes it possible to configure custom colors in [textdiff.TerminalColors].

[textdiff.TerminalColors]: https://pkg.go.dev/znkr.io/diff/textdiff#TerminalColors

func Deletes

func Deletes(params ...int) Option

Deletes colors deleted lines.

func HunkHeaders

func HunkHeaders(params ...int) Option

HunkHeaders colors hunk headers, the "@@ ... @@" part of the unified diff.

func Inserts

func Inserts(params ...int) Option

Inserts colors deleted lines.

func Matches

func Matches(params ...int) Option

Matches colors matching lines.

Jump to

Keyboard shortcuts

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