fatihcolor

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package fatihcolor provides an adapter between fatih/color and neilotoole/jsoncolor's native mechanism. See ToCoreColors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToCoreColor

func ToCoreColor(c *color.Color) jsoncolor.Color

ToCoreColor creates a jsoncolor.Color instance from a fatih/color instance.

func ToCoreColors

func ToCoreColors(clrs *Colors) *jsoncolor.Colors

ToCoreColors converts clrs to a core jsoncolor.Colors instance.

Types

type Colors

type Colors struct {
	// Bool is the color for boolean values.
	Bool *color.Color

	// Bytes is the color for byte / binary values.
	Bytes *color.Color

	// Datetime is the color for time-related values.
	Datetime *color.Color

	// Null is the color for null.
	Null *color.Color

	// Number is the color for number values, including int,
	// float, decimal etc.
	Number *color.Color

	// String is the color for string values.
	String *color.Color

	// Key is the color for keys such as a JSON field name.
	Key *color.Color

	// Punc is the color for punctuation such as colons, braces, etc.
	// Frequently Punc will just be color.Bold.
	Punc *color.Color

	// TextMarshaler is the color for types implementing encoding.TextMarshaler.
	TextMarshaler *color.Color
}

Colors encapsulates JSON color output, using fatih/color elements. It can be converted to a jsoncolor.Colors using ToCoreColors.

func DefaultColors

func DefaultColors() *Colors

DefaultColors returns default Colors instance.

Jump to

Keyboard shortcuts

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