styles

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DebugLabel   = "DEBUG"
	InfoLabel    = "INFO"
	WarningLabel = "WARN"
	ErrorLabel   = "ERROR"
	FatalLabel   = "FATAL"
)
View Source
var (
	ProxyStyle  = baseBlock.Background(lipgloss.Color("#6a71f7"))
	MockStyle   = baseBlock.Background(lipgloss.Color("#ee7ff8"))
	StaticStyle = baseBlock.Background(lipgloss.Color("#ffffff"))
	CacheStyle  = baseBlock.Background(lipgloss.Color("#fefc7f"))
)
View Source
var (
	LogoYellow = lipgloss.NewStyle().
				Foreground(yellow)

	LogoRed = lipgloss.NewStyle().
			Foreground(red)

	WarningBlock = lipgloss.NewStyle().
					Background(yellow).
					Foreground(black).
					Padding(0, 1)

	WarningText = lipgloss.NewStyle().
				Foreground(yellow)

	InfoBlock = lipgloss.NewStyle().
				Background(blue).
				Foreground(black).
				Padding(0, 1)

	InfoText = lipgloss.NewStyle().
				Foreground(blue)

	SuccessBlock = lipgloss.NewStyle().
					Background(green).
					Foreground(black).
					Padding(0, 1)

	SuccessText = lipgloss.NewStyle().
				Foreground(green)

	ErrorBlock = lipgloss.NewStyle().
				Background(red).
				Foreground(black).
				Padding(0, 1)

	ErrorText = lipgloss.NewStyle().
				Foreground(red)

	DebugBlock = lipgloss.NewStyle().
				Background(grey).
				Foreground(black).
				Padding(0, 1)

	DebugText = lipgloss.NewStyle().
				Foreground(grey)

	DisabledBlock = lipgloss.NewStyle().
					Background(darkGrey).
					Foreground(black).
					Padding(0, 1)

	DisabledText = lipgloss.NewStyle().
					Foreground(darkGrey)
)

TODO: Replace to adaptive colors.

View Source
var CanceledStyle = StatusStyle{
	BlockStyle:         DisabledBlock,
	MainTextStyle:      DisabledText.Strikethrough(true),
	SecondaryTextStyle: DisabledText.Strikethrough(true),
}
View Source
var ClientErrorStyle = StatusStyle{
	BlockStyle:         ErrorBlock,
	MainTextStyle:      ErrorText,
	SecondaryTextStyle: DisabledText,
}
View Source
var (
	DefaultStyles = log.Styles{
		Timestamp: lipgloss.NewStyle(),
		Caller:    lipgloss.NewStyle().Faint(true),
		Prefix:    lipgloss.NewStyle().Bold(true).Faint(true),
		Message:   lipgloss.NewStyle(),
		Key:       lipgloss.NewStyle().Faint(true),
		Value:     lipgloss.NewStyle(),
		Separator: lipgloss.NewStyle().Faint(true),
		Levels: map[log.Level]lipgloss.Style{

			log.DebugLevel: DebugText.
				SetString(debugPrefix.Render(DebugLabel)).
				Bold(true),
			log.InfoLevel: InfoText.
				SetString(infoPrefix.Render(InfoLabel)).
				Bold(true),
			log.WarnLevel: WarningText.
				SetString(warnPrefix.Render(WarningLabel)).
				Bold(true),
			log.ErrorLevel: ErrorText.
				SetString(errorPrefix.Render(ErrorLabel)).
				Bold(true),
			log.FatalLevel: ErrorText.
				SetString(errorPrefix.Render(FatalLabel)).
				Bold(true),
			// contains filtered or unexported fields
		},
		Keys:   map[string]lipgloss.Style{},
		Values: map[string]lipgloss.Style{},
	}
)
View Source
var InformationalStyle = StatusStyle{
	BlockStyle:         InfoBlock,
	MainTextStyle:      InfoText,
	SecondaryTextStyle: DisabledText,
}
View Source
var PendingStyle = StatusStyle{
	BlockStyle:         DisabledBlock,
	MainTextStyle:      DisabledText,
	SecondaryTextStyle: DisabledText,
}
View Source
var RedirectionStyle = StatusStyle{
	BlockStyle:         WarningBlock,
	MainTextStyle:      WarningText,
	SecondaryTextStyle: DisabledText,
}
View Source
var ServerErrorStyle = ClientErrorStyle
View Source
var SuccessStyle = StatusStyle{
	BlockStyle:         SuccessBlock,
	MainTextStyle:      SuccessText,
	SecondaryTextStyle: DisabledText,
}

Functions

func CreateLogger

func CreateLogger(logger *log.Logger, prefix string) *log.Logger

Types

type StatusStyle

type StatusStyle struct {
	BlockStyle         lipgloss.Style
	MainTextStyle      lipgloss.Style
	SecondaryTextStyle lipgloss.Style
}

Jump to

Keyboard shortcuts

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