diff options
Diffstat (limited to 'vendor/github.com/alecthomas/chroma/v2/styles/api.go')
| -rw-r--r-- | vendor/github.com/alecthomas/chroma/v2/styles/api.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/vendor/github.com/alecthomas/chroma/v2/styles/api.go b/vendor/github.com/alecthomas/chroma/v2/styles/api.go new file mode 100644 index 0000000..8c0dbe0 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/v2/styles/api.go @@ -0,0 +1,37 @@ +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 +} |
