From 595fffe039c9631bcff870b09d0ad3eb283c6ad8 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Mon, 27 Nov 2023 11:43:30 -0500 Subject: [PATCH] docs: fix styles example (#92) Fixes: https://github.com/charmbracelet/log/issues/92 --- examples/styles/styles.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/styles/styles.go b/examples/styles/styles.go index 3f51dfe..9e75e09 100644 --- a/examples/styles/styles.go +++ b/examples/styles/styles.go @@ -9,17 +9,17 @@ import ( ) func main() { - log.ErrorLevelStyle = lipgloss.NewStyle(). + // Set up our custom styles + styles := log.DefaultStyles() + styles.Levels[log.ErrorLevel] = lipgloss.NewStyle(). SetString("ERROR!!"). Padding(0, 1, 0, 1). - Background(lipgloss.AdaptiveColor{ - Light: "203", - Dark: "204", - }). + Background(lipgloss.Color("204")). Foreground(lipgloss.Color("0")) - log.KeyStyles["err"] = lipgloss.NewStyle().Foreground(lipgloss.Color("204")) - log.ValueStyles["err"] = lipgloss.NewStyle().Bold(true) + styles.Keys["err"] = lipgloss.NewStyle().Foreground(lipgloss.Color("204")) + styles.Values["err"] = lipgloss.NewStyle().Bold(true) logger := log.New(os.Stderr) + logger.SetStyles(styles) logger.Error("Whoops!", "err", "kitchen on fire") time.Sleep(3 * time.Second) }