Categorygithub.com/codefly-dev/golor
modulepackage
0.1.3
Repository: https://github.com/codefly-dev/golor.git
Documentation: pkg.go.dev

# README

hygge/golor

workflow Go Report Card Go Reference

Turns github.com/fatih/color into HTML. Just kidding!

It is just a very convenient way of dealing with colors in the terminal to get some fancy output.

Just a tag based approach to write some nice text, supporting text/template.

Usage

From simple

golor.Println(`This is a #red[part of text with #bold[some] in bold] word.
Possible to #(blue,italic)[combine]`)

simple

To more interesting

	golor.Println(`#(blue)[Welcome to #(red)[hygge-io/golor]!]
#(green,italic)[{{.FromTemplate}} in italic]
#(cyan,bold)[<some brackets> in bold]
{{- range .Items}}
#(yellow,bold)[{{.}}]{{end}}
Notice the #(white,bold,italic)[trick] to not have lines between the range items!`, map[string]any{
		"FromTemplate": "Hello from template",
		"Items":        []string{"Item 1", "Item 2"},
	})
}

output

Changing the syntax for the style tags!

Depending on the text you want to format, it can be necessary to change how the parsing is done:

s := `In Markdown, @(bold)<a new paragraph> uses the # tag
while links are written as @green<[link](url)>`

renderer := golor.New().WithTagMarker('@').WithTextLimiter('<', '>')
fmt.Println(renderer.Render(s))

output

# Packages

No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author