styles

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpenCodeIcon string = "⌬"

	CheckIcon   string = "✓"
	ErrorIcon   string = "✖"
	WarningIcon string = "⚠"
	InfoIcon    string = ""
	HintIcon    string = "i"
	SpinnerIcon string = "..."
	LoadingIcon string = "⟳"
)

Variables

View Source
var (
	Background = lipgloss.AdaptiveColor{
		Dark:  "#212121",
		Light: "#212121",
	}
	BackgroundDim = lipgloss.AdaptiveColor{
		Dark:  "#2c2c2c",
		Light: "#2c2c2c",
	}
	BackgroundDarker = lipgloss.AdaptiveColor{
		Dark:  "#181818",
		Light: "#181818",
	}
	BorderColor = lipgloss.AdaptiveColor{
		Dark:  "#4b4c5c",
		Light: "#4b4c5c",
	}

	Forground = lipgloss.AdaptiveColor{
		Dark:  "#d3d3d3",
		Light: "#d3d3d3",
	}

	ForgroundMid = lipgloss.AdaptiveColor{
		Dark:  "#a0a0a0",
		Light: "#a0a0a0",
	}

	ForgroundDim = lipgloss.AdaptiveColor{
		Dark:  "#737373",
		Light: "#737373",
	}

	BaseStyle = lipgloss.NewStyle().
				Background(Background).
				Foreground(Forground)

	PrimaryColor = lipgloss.AdaptiveColor{
		Dark:  "#fab283",
		Light: "#fab283",
	}
)

NEW STYLES

View Source
var (
	Regular = lipgloss.NewStyle()
	Bold    = Regular.Bold(true)
	Padded  = Regular.Padding(0, 1)

	Border       = Regular.Border(lipgloss.NormalBorder())
	ThickBorder  = Regular.Border(lipgloss.ThickBorder())
	DoubleBorder = Regular.Border(lipgloss.DoubleBorder())

	// Colors
	White    = lipgloss.Color("#ffffff")
	Surface0 = lipgloss.AdaptiveColor{
		Dark:  dark.Surface0().Hex,
		Light: light.Surface0().Hex,
	}

	Overlay0 = lipgloss.AdaptiveColor{
		Dark:  dark.Overlay0().Hex,
		Light: light.Overlay0().Hex,
	}

	Ovelay1 = lipgloss.AdaptiveColor{
		Dark:  dark.Overlay1().Hex,
		Light: light.Overlay1().Hex,
	}

	Text = lipgloss.AdaptiveColor{
		Dark:  dark.Text().Hex,
		Light: light.Text().Hex,
	}

	SubText0 = lipgloss.AdaptiveColor{
		Dark:  dark.Subtext0().Hex,
		Light: light.Subtext0().Hex,
	}

	SubText1 = lipgloss.AdaptiveColor{
		Dark:  dark.Subtext1().Hex,
		Light: light.Subtext1().Hex,
	}

	LightGrey = lipgloss.AdaptiveColor{
		Dark:  dark.Surface0().Hex,
		Light: light.Surface0().Hex,
	}
	Grey = lipgloss.AdaptiveColor{
		Dark:  dark.Surface1().Hex,
		Light: light.Surface1().Hex,
	}

	DarkGrey = lipgloss.AdaptiveColor{
		Dark:  dark.Surface2().Hex,
		Light: light.Surface2().Hex,
	}

	Base = lipgloss.AdaptiveColor{
		Dark:  dark.Base().Hex,
		Light: light.Base().Hex,
	}

	Crust = lipgloss.AdaptiveColor{
		Dark:  dark.Crust().Hex,
		Light: light.Crust().Hex,
	}

	Blue = lipgloss.AdaptiveColor{
		Dark:  dark.Blue().Hex,
		Light: light.Blue().Hex,
	}

	Red = lipgloss.AdaptiveColor{
		Dark:  dark.Red().Hex,
		Light: light.Red().Hex,
	}

	Green = lipgloss.AdaptiveColor{
		Dark:  dark.Green().Hex,
		Light: light.Green().Hex,
	}

	Mauve = lipgloss.AdaptiveColor{
		Dark:  dark.Mauve().Hex,
		Light: light.Mauve().Hex,
	}

	Teal = lipgloss.AdaptiveColor{
		Dark:  dark.Teal().Hex,
		Light: light.Teal().Hex,
	}

	Rosewater = lipgloss.AdaptiveColor{
		Dark:  dark.Rosewater().Hex,
		Light: light.Rosewater().Hex,
	}

	Flamingo = lipgloss.AdaptiveColor{
		Dark:  dark.Flamingo().Hex,
		Light: light.Flamingo().Hex,
	}

	Lavender = lipgloss.AdaptiveColor{
		Dark:  dark.Lavender().Hex,
		Light: light.Lavender().Hex,
	}

	Peach = lipgloss.AdaptiveColor{
		Dark:  dark.Peach().Hex,
		Light: light.Peach().Hex,
	}

	Yellow = lipgloss.AdaptiveColor{
		Dark:  dark.Yellow().Hex,
		Light: light.Yellow().Hex,
	}

	Primary   = Blue
	Secondary = Mauve

	Warning = Peach
	Error   = Red
)
View Source
var ASCIIStyleConfig = ansi.StyleConfig{
	Document: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			BackgroundColor: stringPtr(Background.Dark),
			Color:           stringPtr(ForgroundDim.Dark),
		},
		Indent:      uintPtr(1),
		IndentToken: stringPtr(BaseStyle.Render(" ")),
	},
	BlockQuote: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			BackgroundColor: stringPtr(Background.Dark),
		},
		Indent:      uintPtr(1),
		IndentToken: stringPtr("| "),
	},
	Paragraph: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			BackgroundColor: stringPtr(Background.Dark),
		},
	},
	List: ansi.StyleList{
		StyleBlock: ansi.StyleBlock{
			IndentToken: stringPtr(BaseStyle.Render(" ")),
			StylePrimitive: ansi.StylePrimitive{
				BackgroundColor: stringPtr(Background.Dark),
			},
		},
		LevelIndent: defaultListLevelIndent,
	},
	Heading: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			BackgroundColor: stringPtr(Background.Dark),
			BlockSuffix:     "\n",
		},
	},
	H1: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			BackgroundColor: stringPtr(Background.Dark),
			Prefix:          "# ",
		},
	},
	H2: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			BackgroundColor: stringPtr(Background.Dark),
			Prefix:          "## ",
		},
	},
	H3: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			BackgroundColor: stringPtr(Background.Dark),
			Prefix:          "### ",
		},
	},
	H4: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			BackgroundColor: stringPtr(Background.Dark),
			Prefix:          "#### ",
		},
	},
	H5: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			BackgroundColor: stringPtr(Background.Dark),
			Prefix:          "##### ",
		},
	},
	H6: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			BackgroundColor: stringPtr(Background.Dark),
			Prefix:          "###### ",
		},
	},
	Strikethrough: ansi.StylePrimitive{
		BackgroundColor: stringPtr(Background.Dark),
		BlockPrefix:     "~~",
		BlockSuffix:     "~~",
	},
	Emph: ansi.StylePrimitive{
		BackgroundColor: stringPtr(Background.Dark),
		BlockPrefix:     "*",
		BlockSuffix:     "*",
	},
	Strong: ansi.StylePrimitive{
		BackgroundColor: stringPtr(Background.Dark),
		BlockPrefix:     "**",
		BlockSuffix:     "**",
	},
	HorizontalRule: ansi.StylePrimitive{
		BackgroundColor: stringPtr(Background.Dark),
		Format:          "\n--------\n",
	},
	Item: ansi.StylePrimitive{
		BlockPrefix:     "• ",
		BackgroundColor: stringPtr(Background.Dark),
	},
	Enumeration: ansi.StylePrimitive{
		BlockPrefix:     ". ",
		BackgroundColor: stringPtr(Background.Dark),
	},
	Task: ansi.StyleTask{
		Ticked:   "[x] ",
		Unticked: "[ ] ",
		StylePrimitive: ansi.StylePrimitive{
			BackgroundColor: stringPtr(Background.Dark),
		},
	},
	ImageText: ansi.StylePrimitive{
		BackgroundColor: stringPtr(Background.Dark),
		Format:          "Image: {{.text}} →",
	},
	Code: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			BlockPrefix:     "`",
			BlockSuffix:     "`",
			BackgroundColor: stringPtr(Background.Dark),
		},
	},
	CodeBlock: ansi.StyleCodeBlock{
		StyleBlock: ansi.StyleBlock{
			StylePrimitive: ansi.StylePrimitive{
				BackgroundColor: stringPtr(Background.Dark),
			},
			Margin: uintPtr(defaultMargin),
		},
	},
	Table: ansi.StyleTable{
		StyleBlock: ansi.StyleBlock{
			StylePrimitive: ansi.StylePrimitive{
				BackgroundColor: stringPtr(Background.Dark),
			},
			IndentToken: stringPtr(BaseStyle.Render(" ")),
		},
		CenterSeparator: stringPtr("|"),
		ColumnSeparator: stringPtr("|"),
		RowSeparator:    stringPtr("-"),
	},
	DefinitionDescription: ansi.StylePrimitive{
		BackgroundColor: stringPtr(Background.Dark),
		BlockPrefix:     "\n* ",
	},
}
View Source
var DraculaStyleConfig = ansi.StyleConfig{
	Document: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			Color:           stringPtr(Forground.Dark),
			BackgroundColor: stringPtr(Background.Dark),
		},
		Indent:      uintPtr(defaultMargin),
		IndentToken: stringPtr(BaseStyle.Render(" ")),
	},
	BlockQuote: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			Color:           stringPtr("#f1fa8c"),
			Italic:          boolPtr(true),
			BackgroundColor: stringPtr(Background.Dark),
		},
		Indent:      uintPtr(defaultMargin),
		IndentToken: stringPtr(BaseStyle.Render(" ")),
	},
	Paragraph: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			BackgroundColor: stringPtr(Background.Dark),
		},
	},
	List: ansi.StyleList{
		LevelIndent: defaultMargin,
		StyleBlock: ansi.StyleBlock{
			IndentToken: stringPtr(BaseStyle.Render(" ")),
			StylePrimitive: ansi.StylePrimitive{
				Color:           stringPtr(Forground.Dark),
				BackgroundColor: stringPtr(Background.Dark),
			},
		},
	},
	Heading: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			BlockSuffix:     "\n",
			Color:           stringPtr(PrimaryColor.Dark),
			Bold:            boolPtr(true),
			BackgroundColor: stringPtr(Background.Dark),
		},
	},
	H1: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			Prefix:          "# ",
			BackgroundColor: stringPtr(Background.Dark),
		},
	},
	H2: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			Prefix:          "## ",
			BackgroundColor: stringPtr(Background.Dark),
		},
	},
	H3: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			Prefix:          "### ",
			BackgroundColor: stringPtr(Background.Dark),
		},
	},
	H4: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			Prefix:          "#### ",
			BackgroundColor: stringPtr(Background.Dark),
		},
	},
	H5: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			Prefix:          "##### ",
			BackgroundColor: stringPtr(Background.Dark),
		},
	},
	H6: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			Prefix:          "###### ",
			BackgroundColor: stringPtr(Background.Dark),
		},
	},
	Strikethrough: ansi.StylePrimitive{
		CrossedOut:      boolPtr(true),
		BackgroundColor: stringPtr(Background.Dark),
	},
	Emph: ansi.StylePrimitive{
		Color:           stringPtr("#f1fa8c"),
		Italic:          boolPtr(true),
		BackgroundColor: stringPtr(Background.Dark),
	},
	Strong: ansi.StylePrimitive{
		Bold:            boolPtr(true),
		Color:           stringPtr(Blue.Dark),
		BackgroundColor: stringPtr(Background.Dark),
	},
	HorizontalRule: ansi.StylePrimitive{
		Color:           stringPtr("#6272A4"),
		Format:          "\n--------\n",
		BackgroundColor: stringPtr(Background.Dark),
	},
	Item: ansi.StylePrimitive{
		BlockPrefix:     "• ",
		BackgroundColor: stringPtr(Background.Dark),
	},
	Enumeration: ansi.StylePrimitive{
		BlockPrefix:     ". ",
		Color:           stringPtr("#8be9fd"),
		BackgroundColor: stringPtr(Background.Dark),
	},
	Task: ansi.StyleTask{
		StylePrimitive: ansi.StylePrimitive{
			BackgroundColor: stringPtr(Background.Dark),
		},
		Ticked:   "[✓] ",
		Unticked: "[ ] ",
	},
	Link: ansi.StylePrimitive{
		Color:           stringPtr("#8be9fd"),
		Underline:       boolPtr(true),
		BackgroundColor: stringPtr(Background.Dark),
	},
	LinkText: ansi.StylePrimitive{
		Color:           stringPtr("#ff79c6"),
		BackgroundColor: stringPtr(Background.Dark),
	},
	Image: ansi.StylePrimitive{
		Color:           stringPtr("#8be9fd"),
		Underline:       boolPtr(true),
		BackgroundColor: stringPtr(Background.Dark),
	},
	ImageText: ansi.StylePrimitive{
		Color:           stringPtr("#ff79c6"),
		Format:          "Image: {{.text}} →",
		BackgroundColor: stringPtr(Background.Dark),
	},
	Code: ansi.StyleBlock{
		StylePrimitive: ansi.StylePrimitive{
			Color:           stringPtr("#50fa7b"),
			BackgroundColor: stringPtr(Background.Dark),
		},
	},
	Text: ansi.StylePrimitive{
		BackgroundColor: stringPtr(Background.Dark),
	},
	DefinitionList: ansi.StyleBlock{},
	CodeBlock: ansi.StyleCodeBlock{
		StyleBlock: ansi.StyleBlock{
			StylePrimitive: ansi.StylePrimitive{
				Color:           stringPtr(Blue.Dark),
				BackgroundColor: stringPtr(Background.Dark),
			},
			Margin: uintPtr(defaultMargin),
		},
		Chroma: &ansi.Chroma{
			NameOther: ansi.StylePrimitive{
				BackgroundColor: stringPtr(Background.Dark),
			},
			Literal: ansi.StylePrimitive{
				BackgroundColor: stringPtr(Background.Dark),
			},
			NameException: ansi.StylePrimitive{
				BackgroundColor: stringPtr(Background.Dark),
			},
			LiteralDate: ansi.StylePrimitive{
				BackgroundColor: stringPtr(Background.Dark),
			},
			Text: ansi.StylePrimitive{
				Color:           stringPtr(Forground.Dark),
				BackgroundColor: stringPtr(Background.Dark),
			},
			Error: ansi.StylePrimitive{
				Color:           stringPtr("#f8f8f2"),
				BackgroundColor: stringPtr("#ff5555"),
			},
			Comment: ansi.StylePrimitive{
				Color:           stringPtr("#6272A4"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			CommentPreproc: ansi.StylePrimitive{
				Color:           stringPtr("#ff79c6"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			Keyword: ansi.StylePrimitive{
				Color:           stringPtr("#ff79c6"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			KeywordReserved: ansi.StylePrimitive{
				Color:           stringPtr("#ff79c6"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			KeywordNamespace: ansi.StylePrimitive{
				Color:           stringPtr("#ff79c6"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			KeywordType: ansi.StylePrimitive{
				Color:           stringPtr("#8be9fd"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			Operator: ansi.StylePrimitive{
				Color:           stringPtr("#ff79c6"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			Punctuation: ansi.StylePrimitive{
				Color:           stringPtr(Forground.Dark),
				BackgroundColor: stringPtr(Background.Dark),
			},
			Name: ansi.StylePrimitive{
				Color:           stringPtr("#8be9fd"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			NameBuiltin: ansi.StylePrimitive{
				Color:           stringPtr("#8be9fd"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			NameTag: ansi.StylePrimitive{
				Color:           stringPtr("#ff79c6"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			NameAttribute: ansi.StylePrimitive{
				Color:           stringPtr("#50fa7b"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			NameClass: ansi.StylePrimitive{
				Color:           stringPtr("#8be9fd"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			NameConstant: ansi.StylePrimitive{
				Color:           stringPtr("#bd93f9"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			NameDecorator: ansi.StylePrimitive{
				Color:           stringPtr("#50fa7b"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			NameFunction: ansi.StylePrimitive{
				Color:           stringPtr("#50fa7b"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			LiteralNumber: ansi.StylePrimitive{
				Color:           stringPtr("#6EEFC0"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			LiteralString: ansi.StylePrimitive{
				Color:           stringPtr("#f1fa8c"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			LiteralStringEscape: ansi.StylePrimitive{
				Color:           stringPtr("#ff79c6"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			GenericDeleted: ansi.StylePrimitive{
				Color:           stringPtr("#ff5555"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			GenericEmph: ansi.StylePrimitive{
				Color:           stringPtr("#f1fa8c"),
				Italic:          boolPtr(true),
				BackgroundColor: stringPtr(Background.Dark),
			},
			GenericInserted: ansi.StylePrimitive{
				Color:           stringPtr("#50fa7b"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			GenericStrong: ansi.StylePrimitive{
				Color:           stringPtr("#ffb86c"),
				Bold:            boolPtr(true),
				BackgroundColor: stringPtr(Background.Dark),
			},
			GenericSubheading: ansi.StylePrimitive{
				Color:           stringPtr("#bd93f9"),
				BackgroundColor: stringPtr(Background.Dark),
			},
			Background: ansi.StylePrimitive{
				BackgroundColor: stringPtr(Background.Dark),
			},
		},
	},
	Table: ansi.StyleTable{
		StyleBlock: ansi.StyleBlock{
			StylePrimitive: ansi.StylePrimitive{
				BackgroundColor: stringPtr(Background.Dark),
			},
			IndentToken: stringPtr(BaseStyle.Render(" ")),
		},
	},
	DefinitionDescription: ansi.StylePrimitive{
		BlockPrefix:     "\n* ",
		BackgroundColor: stringPtr(Background.Dark),
	},
}

Functions

func CatppuccinMarkdownStyle

func CatppuccinMarkdownStyle() ansi.StyleConfig

CatppuccinMarkdownStyle is the Catppuccin Mocha style for Glamour markdown rendering.

func ForceReplaceBackgroundWithLipgloss

func ForceReplaceBackgroundWithLipgloss(input string, newBgColor lipgloss.TerminalColor) string

ForceReplaceBackgroundWithLipgloss replaces any ANSI background color codes in `input` with a single 24‑bit background (48;2;R;G;B).

func HuhTheme

func HuhTheme() *huh.Theme

func MarkdownTheme

func MarkdownTheme(focused bool) ansi.StyleConfig

Types

This section is empty.

Jump to

Keyboard shortcuts

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