display

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 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 display provides functions for styled terminal output.

Package display provides functions for styled terminal output and theme management.

Index

Constants

View Source
const (
	// None disables all terminal styling.
	None = "none"
	// Custom indicates a custom color profile is in use.
	Custom = "custom"
	// Auto enables automatic color profile detection.
	Auto = "auto"
	// Notty indicates no TTY is available (non-interactive mode).
	Notty = "notty"
	// Truecolor indicates a terminal supporting 24-bit true color.
	Truecolor = "truecolor"
	// Bit24 is an alias for 24-bit color support.
	Bit24 = "24bit"
)

Theme and terminal color constants used throughout the display package.

View Source
const (
	// DefaultWordWrapWidth is the default word wrap width for terminal display.
	DefaultWordWrapWidth = 120
)

Terminal display layout constants.

Variables

This section is empty.

Functions

func DetermineGlamourStyle

func DetermineGlamourStyle(opts *Options) string

DetermineGlamourStyle returns the Glamour style string to use for markdown rendering based on the provided options, considering color enablement, terminal color support, and the selected theme.

func IsTerminalColorCapable

func IsTerminalColorCapable() bool

IsTerminalColorCapable returns true if the current terminal environment supports color output, based on environment variables and terminal type heuristics.

Types

type Options

type Options struct {
	Theme        Theme
	WrapWidth    int
	EnableTables bool
	EnableColors bool
}

Options holds display configuration settings.

type TerminalDisplay

type TerminalDisplay struct {
	// contains filtered or unexported fields
}

TerminalDisplay represents a terminal markdown displayer.

func NewTerminalDisplayWithMarkdownOptions

func NewTerminalDisplayWithMarkdownOptions(mdOpts converter.Options) *TerminalDisplay

NewTerminalDisplayWithMarkdownOptions creates a TerminalDisplay with markdown options. This provides compatibility with the markdown package options.

func NewTerminalDisplayWithOptions

func NewTerminalDisplayWithOptions(opts Options) *TerminalDisplay

NewTerminalDisplayWithOptions returns a TerminalDisplay configured with the provided options, setting the wrap width if not specified.

func (*TerminalDisplay) Display

func (td *TerminalDisplay) Display(ctx context.Context, markdownContent string) error

Display renders and displays markdown content in the terminal with syntax highlighting.

type Theme

type Theme struct {
	Name         string
	Palette      map[string]string
	GlamourStyle string
}

Theme represents a color theme with customizable palettes.

func CustomTheme

func CustomTheme() Theme

CustomTheme returns a Theme with an empty palette and Glamour style set to "auto", intended for user customization.

func DarkTheme

func DarkTheme() Theme

DarkTheme returns a Theme configured with a predefined dark color palette and the Glamour style "dark".

func DetectTheme

func DetectTheme(configTheme string) Theme

DetectTheme determines the theme based on configuration and environment. DetectTheme determines the terminal color theme to use based on the provided configuration, the OPNDOSSIER_THEME environment variable, or automatic detection if neither is set.

func LightTheme

func LightTheme() Theme

LightTheme returns a Theme configured with a predefined light color palette and the Glamour style "light".

func (*Theme) GetGlamourStyleName

func (t *Theme) GetGlamourStyleName() string

GetGlamourStyleName returns the Glamour style name for this theme.

Jump to

Keyboard shortcuts

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