Registry / utility / alecthomas-chroma

alecthomas-chroma

JSON →
library0.10.0gogounverified

Package chroma takes source code and other structured text and converts it into syntax highlighted HTML, ANSI-coloured text, etc.

go get github.com/alecthomas/chroma
INSTALL
IMPORT
SIG · ALECTHOMAS-CHROMA
A
alecthomas-chroma
utilitygov0.10.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

chroma
github.com/alecthomas/chroma

Syntax highlights Go source code for terminal output

package main import ( "fmt" "github.com/alecthomas/chroma" "github.com/alecthomas/chroma/lexers" "github.com/alecthomas/chroma/formatters" "github.com/alecthomas/chroma/styles" ) func main() { code := `package main func main() { println("hello") }` lexer := lexers.Get("go") formatter := formatters.Get("terminal") style := styles.Get("monokai") highlighted, _ := formatter.Format(nil, style, lexer.Tokenise(nil, code)) fmt.Println(highlighted) }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.10.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
30 hits · last 30 days
node
26
OpenAI (training)
1
Resources
alecthomas-chroma — go get alecthomas-chroma · libregistry