Mercurial > yakumo_izuru > aya
view vendor/github.com/alecthomas/chroma/v2/styles/api.go @ 66:787b5ee0289d draft
Use vendored modules
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>
author | yakumo.izuru |
---|---|
date | Sun, 23 Jul 2023 13:18:53 +0000 |
parents | |
children |
line wrap: on
line source
package styles import ( "sort" "github.com/alecthomas/chroma/v2" ) // Registry of Styles. var Registry = map[string]*chroma.Style{} // Fallback style. Reassign to change the default fallback style. var Fallback = SwapOff // Register a chroma.Style. func Register(style *chroma.Style) *chroma.Style { Registry[style.Name] = style return style } // Names of all available styles. func Names() []string { out := []string{} for name := range Registry { out = append(out, name) } sort.Strings(out) return out } // Get named style, or Fallback. func Get(name string) *chroma.Style { if style, ok := Registry[name]; ok { return style } return Fallback }