Source File
api.go
Belonging Package
github.com/alecthomas/chroma/v2/styles
package stylesimport ()//go:embed *.xmlvar embedded embed.FS// Registry of Styles.var Registry = func() map[string]*chroma.Style {:= map[string]*chroma.Style{}// Register all embedded styles., := fs.ReadDir(embedded, ".")if != nil {panic()}for , := range {if .IsDir() {continue}, := embedded.Open(.Name())if != nil {panic()}, := chroma.NewXMLStyle()if != nil {panic()}[.Name] =_ = .Close()}return}()// Fallback style. Reassign to change the default fallback style.var Fallback = Registry["swapoff"]// Register a chroma.Style.func ( *chroma.Style) *chroma.Style {Registry[.Name] =return}// Names of all available styles.func () []string {:= []string{}for := range Registry {= append(, )}sort.Strings()return}// Get named style, or Fallback.func ( string) *chroma.Style {if , := Registry[]; {return}return Fallback}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |