styles

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2022 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package styles defines the color themes and Lip Gloss styles for Mabel based on the user config file.

Index

Constants

This section is empty.

Variables

View Source
var (
	Bold = gloss.NewStyle().Bold(true)

	Border       = gloss.RoundedBorder()
	BorderWindow = gloss.NewStyle().
					Align(gloss.Center).
					BorderStyle(Border)
)

Define the Lip Gloss styles for borders and bold text

View Source
var ANSITheme = ColorTheme{
	Primary:       gloss.AdaptiveColor{Light: "4", Dark: "4"},
	Light:         gloss.AdaptiveColor{Light: "14", Dark: "14"},
	Dark:          gloss.AdaptiveColor{Light: "12", Dark: "12"},
	Error:         gloss.AdaptiveColor{Light: "9", Dark: "9"},
	Tooltip:       gloss.AdaptiveColor{Light: "8", Dark: "8"},
	GradientSolid: gloss.AdaptiveColor{Light: "5", Dark: "5"},
}

Define the ANSI/8-bit theme

View Source
var DefaultTheme = ColorTheme{
	Primary: gloss.AdaptiveColor{
		Light: "#464FB6",
		Dark:  "#5FFFD7",
	},
	Light: gloss.AdaptiveColor{
		Light: "#9EA4D0",
		Dark:  "#DFFFF7",
	},
	Dark: gloss.AdaptiveColor{
		Light: "#353B88",
		Dark:  "#00AC81",
	},
	Error: gloss.AdaptiveColor{
		Light: "#FF5E87",
		Dark:  "#FF5E87",
	},
	Tooltip: gloss.AdaptiveColor{
		Light: "#4A4A4A",
		Dark:  "#B2B2B2",
	},
	GradientStart: gloss.AdaptiveColor{
		Light: "#5A56E0",
		Dark:  "#5A56E0",
	},
	GradientEnd: gloss.AdaptiveColor{
		Light: "#EE6FF8",
		Dark:  "#EE6FF8",
	},
}

Define the default theme

View Source
var DesertTheme = ColorTheme{
	Primary: gloss.AdaptiveColor{
		Light: "#D08B5D",
		Dark:  "#D08B5D",
	},
	Light: gloss.AdaptiveColor{
		Light: "#E3AF8C",
		Dark:  "#E3AF8C",
	},
	Dark: gloss.AdaptiveColor{
		Light: "#BC662E",
		Dark:  "#BC662E",
	},
	Error: gloss.AdaptiveColor{
		Light: "#5179C5",
		Dark:  "#5179C5",
	},
	Tooltip: gloss.AdaptiveColor{
		Light: "#564F45",
		Dark:  "#B6A589",
	},
	GradientStart: gloss.AdaptiveColor{
		Light: "#D37435",
		Dark:  "#D37435",
	},
	GradientEnd: gloss.AdaptiveColor{
		Light: "#E3AF8C",
		Dark:  "#E3AF8C",
	},
}

Define the desert theme

View Source
var PurpleTheme = ColorTheme{
	Primary: gloss.AdaptiveColor{
		Light: "#8C00FF",
		Dark:  "#8C00FF",
	},
	Light: gloss.AdaptiveColor{
		Light: "#8C00FF",
		Dark:  "#8C00FF",
	},
	Dark: gloss.AdaptiveColor{
		Light: "#8C00FF",
		Dark:  "#8C00FF",
	},
	Error: gloss.AdaptiveColor{
		Light: "#8C00FF",
		Dark:  "#8C00FF",
	},
	Tooltip: gloss.AdaptiveColor{
		Light: "#8C00FF",
		Dark:  "#8C00FF",
	},
	GradientSolid: gloss.AdaptiveColor{
		Light: "#8C00FF",
		Dark:  "#8C00FF",
	},
}

Define the purple theme

Functions

func AdaptiveColorToString

func AdaptiveColorToString(c *gloss.AdaptiveColor) string

AdaptiveColorToString returns the Light or Dark alternative of an AdaptiveColor as a string, based on the background color of the terminal.

Types

type ColorTheme

type ColorTheme struct {
	Primary, Light, Dark, Error,
	Tooltip, GradientStart,
	GradientEnd, GradientSolid gloss.AdaptiveColor
}

func StringToTheme

func StringToTheme(s *string) *ColorTheme

StringToTheme converts strings from the config file into ColorTheme pointers.

func (*ColorTheme) UseSolidGradient

func (t *ColorTheme) UseSolidGradient() bool

UseSolidGradient returns a boolean based on whether the gradient for the progress bar is solid or not.

type CustomTheme

type CustomTheme struct {
	Base, Primary, Light, Dark, Error,
	Tooltip, GradientStart,
	GradientEnd, GradientSolid string
}

func (*CustomTheme) ToTheme

func (c *CustomTheme) ToTheme() *ColorTheme

ToTheme translates a CustomTheme of strings to a ColorTheme of Lip Gloss AdaptiveColors.

Jump to

Keyboard shortcuts

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