catppuccin

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: 4 Imported by: 0

README

Catppuccin for log

catppuccin latte catppuccin frappe catppuccin macchiato catppuccin mocha

Package catppuccin consists of 4 beautiful pastel color palettes, named flavors. The theme comes in one light and three dark variants.

  • 🌻 Latte is the lightest theme harmoniously inverting the essence of Catppuccin's dark themes.

  • 🪴 Frappé is a less vibrant alternative using subdued colors for a muted aesthetic.

  • 🌺 Macchiato has medium contrast with gentle colors creating a soothing atmosphere.

  • 🌿 Mocha is the original and the darkest variant, offering a cozy feeling with color-rich accents.

Usage

Use go get to download the dependency.

go get github.com/op/redlog/pkg/catppuccin@latest

Then, import it in Go files:

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

To make use of one light and one dark theme, you can create an adaptive style which automatically switch to the most suitable style based on the terminal's mode.

theme := catppuccin.Adaptive(catppuccin.Latte, catppuccin.Mocha)
log.SetStyles(catppuccin.Styles(theme))

To use a specific variant, use it as-is.

log.SetStyles(catppuccin.Styles(catppuccin.Mocha))
slog.SetDefault(slog.New(log.Default()))

Documentation

Overview

Package catppuccin consists of 4 beautiful pastel color palettes, named flavors. The theme comes in one light and three dark variants.

Example
logger := log.New(os.Stdout) // use os.Stderr in your application
// TODO: submit pr to add Styles to the Options struct
logger.SetStyles(Styles(Adaptive(Latte, Mocha)))
logger.Info("purrr 🐾")

log.SetDefault(logger)
log.Info("purrr 🐱")

slog.SetDefault(slog.New(logger))
slog.Info("purrr 😸")
Output:

INFO purrr 🐾
INFO purrr 🐱
INFO purrr 😸

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	// Latte is the lightest theme harmoniously inverting the essence of
	// Catppuccin's dark themes.
	Latte = FromFlavour(catppuccin.Latte)
	// Frappe is a less vibrant alternative using subdued colors for a muted
	// aesthetic.
	Frappe = FromFlavour(catppuccin.Frappe)
	// Macchiato has medium contrast with gentle colors creating a soothing
	// atmosphere.
	Macchiato = FromFlavour(catppuccin.Macchiato)
	// Mocha is the original and the darkest variant, offering a cozy feeling
	// with color-rich accents.
	Mocha = FromFlavour(catppuccin.Mocha)
)

Functions

func Styles

func Styles(f Flavour) *log.Styles

Styles creates new log styles based the provided flavor of Catppuccin.

For information about the different flavors and style guide, see: https://catppuccin.com/

Types

type AdaptiveOption

type AdaptiveOption func(a *adaptive)

func WithRenderer

func WithRenderer(r *lipgloss.Renderer) AdaptiveOption

type Flavour

Flavour is an interface implemented by all Catppuccin flavours.

This is the catppuccin.Flavour interface but with lipgloss.TerminalColor.

func Adaptive

func Adaptive(light, dark Flavour, opts ...AdaptiveOption) Flavour

Adaptive creates an adaptive variant based on the provided flavours.

The Catppuccin theme comes with one light and three dark flavours. Use this function to create your own adaptive variants.

Latte has the lightest palette and is a light flavour, followed by Frappe, Macchiato, and Mocha -- which all are dark flavours.

func FromFlavour

func FromFlavour(c catppuccin.Flavour) Flavour

FromFlavour converts a catppuccin flavour to the Variant in this package.

Jump to

Keyboard shortcuts

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