Source File
writer.go
Belonging Package
charm.land/lipgloss/v2
package lipglossimport ()// Writer is the default writer that prints to stdout, automatically// downsampling colors when necessary.var Writer = colorprofile.NewWriter(os.Stdout, os.Environ())// Println to stdout, automatically downsampling colors when necessary, ending// with a trailing newline.//// Example://// str := NewStyle().// Foreground(lipgloss.Color("#6a00ff")).// Render("breakfast")//// Println("Time for a", str, "sandwich!")func ( ...any) (int, error) {return fmt.Fprintln(Writer, ...) //nolint:wrapcheck}// Printf prints formatted text to stdout, automatically downsampling colors// when necessary.//// Example://// str := NewStyle().// Foreground(lipgloss.Color("#6a00ff")).// Render("knuckle")//// Printf("Time for a %s sandwich!\n", str)func ( string, ...any) (int, error) {return fmt.Fprintf(Writer, , ...) //nolint:wrapcheck}// Print to stdout, automatically downsampling colors when necessary.//// Example://// str := NewStyle().// Foreground(lipgloss.Color("#6a00ff")).// Render("Who wants marmalade?\n")//// Print(str)func ( ...any) (int, error) {return fmt.Fprint(Writer, ...) //nolint:wrapcheck}// Fprint pritnts to the given writer, automatically downsampling colors when// necessary.//// Example://// str := NewStyle().// Foreground(lipgloss.Color("#6a00ff")).// Render("guzzle")//// Fprint(os.Stderr, "I %s horchata pretty much all the time.\n", str)func ( io.Writer, ...any) (int, error) {return fmt.Fprint(colorprofile.NewWriter(, os.Environ()), ...) //nolint:wrapcheck}// Fprintln prints to the given writer, automatically downsampling colors when// necessary, and ending with a trailing newline.//// Example://// str := NewStyle().// Foreground(lipgloss.Color("#6a00ff")).// Render("Sandwich time!")//// Fprintln(os.Stderr, str)func ( io.Writer, ...any) (int, error) {return fmt.Fprintln(colorprofile.NewWriter(, os.Environ()), ...) //nolint:wrapcheck}// Fprintf prints text to a writer, against the given format, automatically// downsampling colors when necessary.//// Example://// str := NewStyle().// Foreground(lipgloss.Color("#6a00ff")).// Render("artichokes")//// Fprintf(os.Stderr, "I really love %s!\n", food)func ( io.Writer, string, ...any) (int, error) {return fmt.Fprintf(colorprofile.NewWriter(, os.Environ()), , ...) //nolint:wrapcheck}// Sprint returns a string for stdout, automatically downsampling colors when// necessary.//// Example://// str := NewStyle().// Faint(true).// Foreground(lipgloss.Color("#6a00ff")).// Render("I love to eat")//// str = Sprint(str)func ( ...any) string {var bytes.Buffer:= colorprofile.Writer{Forward: &,Profile: Writer.Profile,}fmt.Fprint(&, ...) //nolint:errcheckreturn .String()}// Sprintln returns a string for stdout, automatically downsampling colors when// necessary, and ending with a trailing newline.//// Example://// str := NewStyle().// Bold(true).// Foreground(lipgloss.Color("#6a00ff")).// Render("Yummy!")//// str = Sprintln(str)func ( ...any) string {var bytes.Buffer:= colorprofile.Writer{Forward: &,Profile: Writer.Profile,}fmt.Fprintln(&, ...) //nolint:errcheckreturn .String()}// Sprintf returns a formatted string for stdout, automatically downsampling// colors when necessary.//// Example://// str := NewStyle().// Bold(true).// Foreground(lipgloss.Color("#fccaee")).// Render("Cantaloupe")//// str = Sprintf("I really love %s!", str)func ( string, ...any) string {var bytes.Buffer:= colorprofile.Writer{Forward: &,Profile: Writer.Profile,}fmt.Fprintf(&, , ...) //nolint:errcheckreturn .String()}
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64)