config

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2017 License: Unlicense Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultColor = ColorName("default")

	Black   = ColorName("black")
	Red     = ColorName("red")
	Green   = ColorName("green")
	Yellow  = ColorName("yellow")
	Blue    = ColorName("blue")
	Magenta = ColorName("magenta")
	Cyan    = ColorName("cyan")
	White   = ColorName("white")

	LightBlack   = ColorName("lightBlack")
	LightRed     = ColorName("lightRed")
	LightGreen   = ColorName("lightGreen")
	LightYellow  = ColorName("lightYellow")
	LightBlue    = ColorName("lightBlue")
	LightMagenta = ColorName("lightMagenta")
	LightCyan    = ColorName("lightCyan")
	LightWhite   = ColorName("lightWhite")
)

Colors

View Source
const (
	// ColorTypeNone defines empty
	ColorTypeNone = ColorType("none")
	// ColorType8Bit defines 8-bit (256) colors
	ColorType8Bit = ColorType("8bit")
	// ColorType24Bit defines 24-bit (R: 8bit + G: 8bit + B: 8bit ; full) colors
	ColorType24Bit = ColorType("24bit")
	// ColorTypeName defines named colors
	ColorTypeName = ColorType("named")
)
View Source
const (
	// LabelTypeNone suppress line-labels
	LabelTypeNone = LabelType("none")
	// LabelTypeShort prints single-character line-label
	LabelTypeShort = LabelType("short")
	// LabelTypeLong prints text line-label
	LabelTypeLong = LabelType("long")
)
View Source
const (
	// Filename is filename of configurations for this app.
	Filename = ".richstyle"
	// LocalOnlyEnvName is the name of environment variable
	// to stop searching configuration files excepting current directory.
	LocalOnlyEnvName = "RICHGO_LOCAL"
)

Variables

This section is empty.

Functions

func Default

func Default()

func Load

func Load()

Load configurations from file

Types

type Color

type Color struct {
	Type ColorType

	Value8 uint8

	ValueR uint8
	ValueG uint8
	ValueB uint8

	Name ColorName
}

Color is the color in the ANSI for configuration

func (*Color) B

func (c *Color) B() aec.ANSI

B gets background ANSI color

func (*Color) F

func (c *Color) F() aec.ANSI

F gets foreground ANSI color

func (Color) MarshalJSON

func (c Color) MarshalJSON() ([]byte, error)

MarshalJSON implements Marshaler

func (Color) MarshalYAML

func (c Color) MarshalYAML() (interface{}, error)

MarshalYAML implements Marshaler

func (*Color) UnmarshalJSON

func (c *Color) UnmarshalJSON(raw []byte) error

UnmarshalJSON implements Unmarshaler

func (*Color) UnmarshalYAML

func (c *Color) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements Unmarshaler

type ColorName

type ColorName string

ColorName is the name of ANSI-colors

func ColorNames

func ColorNames() []ColorName

ColorNames will get variations of the colors.

func (ColorName) String

func (n ColorName) String() string

type ColorType

type ColorType string

ColorType is the type of color

func (ColorType) String

func (l ColorType) String() string

type Config

type Config struct {
	LabelType *LabelType `json:"labelType,omitempty" yaml:"labelType,omitempty"`

	BuildStyle *Style `json:"buildStyle,omitempty" yaml:"buildStyle,omitempty"`
	StartStyle *Style `json:"startStyle,omitempty" yaml:"startStyle,omitempty"`
	PassStyle  *Style `json:"passStyle,omitempty" yaml:"passStyle,omitempty"`
	FailStyle  *Style `json:"failStyle,omitempty" yaml:"failStyle,omitempty"`
	SkipStyle  *Style `json:"skipStyle,omitempty" yaml:"skipStyle,omitempty"`
	FileStyle  *Style `json:"fileStyle,omitempty" yaml:"fileStyle,omitempty"`
	LineStyle  *Style `json:"lineStyle,omitempty" yaml:"lineStyle,omitempty"`

	CoverThreshold *int   `json:"coverThreshold,omitempty" yaml:"coverThreshold,omitempty"`
	CoveredStyle   *Style `json:"coveredStyle,omitempty" yaml:"coveredStyle,omitempty"`
	UncoveredStyle *Style `json:"uncoveredStyle,omitempty" yaml:"uncoveredStyle,omitempty"`

	Removals []string `json:"removals,omitempty" yaml:"removals,omitempty"`
}

Config holds settings for richgo

var (
	// Extensions is extension choices of configurations for this app.
	Extensions = []string{
		"",
		".yaml",
		".yml",
	}
	// C is global configuration
	C Config
)

type LabelType

type LabelType string

LabelType is the type of line-labels

func LabelTypes

func LabelTypes() []LabelType

LabelTypes defines the possible values of LabelType

func (LabelType) MarshalJSON

func (l LabelType) MarshalJSON() ([]byte, error)

MarshalJSON implements Marshaler

func (LabelType) String

func (l LabelType) String() string

func (*LabelType) UnmarshalJSON

func (l *LabelType) UnmarshalJSON(raw []byte) error

UnmarshalJSON implements Unmarshaler

type Style

type Style struct {
	// Hide text
	Hide *bool `json:"hide,omitempty" yaml:"hide,omitempty"`

	// Bold set the text style to bold or increased intensity.
	Bold *bool `json:"bold,omitempty" yaml:"bold,omitempty"`
	// Faint set the text style to faint.
	Faint *bool `json:"faint,omitempty" yaml:"faint,omitempty"`
	// Italic set the text style to italic.
	Italic *bool `json:"italic,omitempty" yaml:"italic,omitempty"`
	// Underline set the text style to underline.
	Underline *bool `json:"underline,omitempty" yaml:"underline,omitempty"`
	// BlinkSlow set the text style to slow blink.
	BlinkSlow *bool `json:"blinkSlow,omitempty" yaml:"blinkSlow,omitempty"`
	// BlinkRapid set the text style to rapid blink.
	BlinkRapid *bool `json:"blinkRapid,omitempty" yaml:"blinkRapid,omitempty"`
	// Inverse swap the foreground color and background color.
	Inverse *bool `json:"inverse,omitempty" yaml:"inverse,omitempty"`
	// Conceal set the text style to conceal.
	Conceal *bool `json:"conceal,omitempty" yaml:"conceal,omitempty"`
	// CrossOut set the text style to crossed out.
	CrossOut *bool `json:"crossOut,omitempty" yaml:"crossOut,omitempty"`
	// Frame set the text style to framed.
	Frame *bool `json:"frame,omitempty" yaml:"frame,omitempty"`
	// Encircle set the text style to encircled.
	Encircle *bool `json:"encircle,omitempty" yaml:"encircle,omitempty"`
	// Overline set the text style to overlined.
	Overline *bool `json:"overline,omitempty" yaml:"overline,omitempty"`

	// Foreground set the fore-color of text
	Foreground *Color `json:"foreground,omitempty" yaml:"foreground,omitempty"`
	// Foreground set the back-color of text
	Background *Color `json:"background,omitempty" yaml:"background,omitempty"`
}

Style format the text with ANSI

func (*Style) Apply

func (s *Style) Apply(str string) string

Apply style To string

Jump to

Keyboard shortcuts

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