formatting

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package formatting provides formatting configuration section for slogtxt theme configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format struct {
	Prefix string `yaml:"prefix,omitempty"`
	Suffix string `yaml:"suffix,omitempty"`
	Style  Style  `yaml:"style"`
}

Format contains prefix, suffix and style, each is optional.

func (Format) UpdatedBy

func (f Format) UpdatedBy(other Format) Format

UpdatedBy returns a copy of f updated by other.

type Item

type Item struct {
	Outer     Format     `yaml:"outer"`
	Inner     Format     `yaml:"inner"`
	Separator StyledText `yaml:"separator,omitempty"`
	Text      string     `yaml:"text,omitempty"`
}

Item is an item inside formatting section.

func (Item) UpdatedBy

func (i Item) UpdatedBy(other Item) Item

UpdatedBy returns a copy of i updated by other.

type Level

type Level struct {
	All     Item `yaml:"all"`
	Debug   Item `yaml:"debug"`
	Info    Item `yaml:"info"`
	Warning Item `yaml:"warning"`
	Error   Item `yaml:"error"`
}

Level is a log level formatting configuration.

type ModePatch added in v0.6.0

type ModePatch struct {
	Mode   sgr.Mode
	Action sgr.ModeAction
}

ModePatch is a patch for a mode.

func (ModePatch) MarshalText added in v0.6.0

func (p ModePatch) MarshalText() ([]byte, error)

MarshalText returns a text representation of p.

func (*ModePatch) UnmarshalText added in v0.6.0

func (p *ModePatch) UnmarshalText(text []byte) error

UnmarshalText parses text and stores the result in p.

type ModePatchList added in v0.6.0

type ModePatchList []ModePatch

ModePatchList is a list of mode patches.

func (ModePatchList) Sets added in v0.6.0

func (l ModePatchList) Sets() [3]sgr.ModeSet

Sets returns an array of mode sets for actions sgr.ModeAdd, sgr.ModeRemove and sgr.ModeToggle.

func (ModePatchList) UpdatedBy added in v0.6.0

func (l ModePatchList) UpdatedBy(other ModePatchList) ModePatchList

UpdatedBy returns a copy of l updated by other.

type Style

type Style struct {
	Background sgr.Color     `yaml:"background,omitempty"`
	Foreground sgr.Color     `yaml:"foreground,omitempty"`
	Modes      ModePatchList `yaml:"modes,omitempty"`
}

Style includes background color, foreground color and a set of modes. Modes overwrites current set of modes during style rendering. So, explicitly specifying empty list of modes will disable all currently enabled modes.

func (Style) IsZero added in v0.6.0

func (s Style) IsZero() bool

IsZero returns true if s is zero value.

func (Style) UpdatedBy

func (s Style) UpdatedBy(other Style) Style

UpdatedBy returns a copy of s updated by other.

type StyledText added in v0.6.0

type StyledText struct {
	Text  string `yaml:"text,omitempty"`
	Style Style  `yaml:"style"`
}

StyledText is a text with style.

func (StyledText) UpdatedBy added in v0.6.0

func (t StyledText) UpdatedBy(other StyledText) StyledText

UpdatedBy returns a copy of t updated by other.

Jump to

Keyboard shortcuts

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