redlog

package module
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 2 Imported by: 0

README

Red Log

Latest Release Go Docs Build Status Go Report Card

Gloss styles for logs. 🪵

It contains a set of styles that can be used with the log package. The following themes are provided:

🚧 This is a work in progress. Sorry for the inconvenience and odd v1. 🚧

Catppuccin Latte

catppuccin latte

Catppuccin Frappé

catppuccin frappe

Catppuccin Macchiato

catppuccin macchiato

Catppuccin Mocha

catppuccin mocha

Usage

Use go get to download the dependency.

go get github.com/op/redlog@latest

Then, import it in Go files:

import (
  "github.com/charmbracelet/log"
  "github.com/op/redlog"
)

The Red Log package comes with a select few styles of the themes listed above. These are ready to be used straight away.

log.SetStyles(redlog.Catppuccin.Mocha)
slog.SetDefault(slog.New(log.Default()))

Specific theme

If you want to limit the number of dependencies, or make some customisation of the theme yourself, you can directly import and use the theme.

import (
  "github.com/charmbracelet/log"
  "github.com/op/redlog/pkg/catppuccin"
)

Then initiate the theme the way that suits your needs.

// use an adaptive theme that switches between light and dark depending on the
// terminal's color scheme
variant := catppuccin.Adaptive(catppuccin.Latte, catppuccin.Mocha)
log.SetStyles(catppuccin.Styles(variant))

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Catppuccin = struct {
	// Frappe is an less vibrant alternative using subdued colors for a muted
	// aesthetic. It is an adaptive variant using Latte in light mode and Frappe
	// elsewhere.
	Frappe *log.Styles

	// Macchiato has medium contrast with gentle colors creating a soothing
	// atmosphere. It is an adaptive variant using Latte in light mode
	// and Macchiato elsewhere.
	Macchiato *log.Styles

	// Mocha is the original and the darkest variant, offering a cozy feeling
	// with color-rich accents. It is an adaptive variant using Latte in light
	// mode and Mocha elsewhere.
	Mocha *log.Styles
}{
	Frappe:    newCatppuccin(catppuccin.Latte, catppuccin.Frappe),
	Macchiato: newCatppuccin(catppuccin.Latte, catppuccin.Macchiato),
	Mocha:     newCatppuccin(catppuccin.Latte, catppuccin.Mocha),
}

Catppuccin consists of three adaptive variants mixed from Catppuccin's beautiful pastel palettes.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
internal
logtheme Module
themes Module
pkg
catppuccin Module

Jump to

Keyboard shortcuts

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