diff --git a/styles/LICENSE b/styles/LICENSE new file mode 100644 index 0000000..92dc39f --- /dev/null +++ b/styles/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2017 Alec Thomas + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/styles/abap.xml b/styles/abap.xml new file mode 100644 index 0000000..36ea2f1 --- /dev/null +++ b/styles/abap.xml @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/styles/algol.xml b/styles/algol.xml new file mode 100644 index 0000000..e8a6dc1 --- /dev/null +++ b/styles/algol.xml @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/styles/algol_nu.xml b/styles/algol_nu.xml new file mode 100644 index 0000000..7fa340f --- /dev/null +++ b/styles/algol_nu.xml @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/styles/api.go b/styles/api.go new file mode 100644 index 0000000..e26d6f0 --- /dev/null +++ b/styles/api.go @@ -0,0 +1,65 @@ +package styles + +import ( + "embed" + "io/fs" + "sort" + + "github.com/alecthomas/chroma/v2" +) + +//go:embed *.xml +var embedded embed.FS + +// Registry of Styles. +var Registry = func() map[string]*chroma.Style { + registry := map[string]*chroma.Style{} + // Register all embedded styles. + files, err := fs.ReadDir(embedded, ".") + if err != nil { + panic(err) + } + for _, file := range files { + if file.IsDir() { + continue + } + r, err := embedded.Open(file.Name()) + if err != nil { + panic(err) + } + style, err := chroma.NewXMLStyle(r) + if err != nil { + panic(err) + } + registry[style.Name] = style + _ = r.Close() + } + return registry +}() + +// Fallback style. Reassign to change the default fallback style. +var Fallback = Registry["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 +} diff --git a/styles/arduino.xml b/styles/arduino.xml new file mode 100644 index 0000000..d9891dc --- /dev/null +++ b/styles/arduino.xml @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/styles/autumn.xml b/styles/autumn.xml new file mode 100644 index 0000000..74d2eae --- /dev/null +++ b/styles/autumn.xml @@ -0,0 +1,36 @@ + \ No newline at end of file diff --git a/styles/average.xml b/styles/average.xml new file mode 100644 index 0000000..79bdb95 --- /dev/null +++ b/styles/average.xml @@ -0,0 +1,74 @@ + \ No newline at end of file diff --git a/styles/base16-snazzy.xml b/styles/base16-snazzy.xml new file mode 100644 index 0000000..a05ba24 --- /dev/null +++ b/styles/base16-snazzy.xml @@ -0,0 +1,74 @@ + \ No newline at end of file diff --git a/styles/borland.xml b/styles/borland.xml new file mode 100644 index 0000000..0d8f574 --- /dev/null +++ b/styles/borland.xml @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/styles/bw.xml b/styles/bw.xml new file mode 100644 index 0000000..fb0e868 --- /dev/null +++ b/styles/bw.xml @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/styles/catppuccin-frappe.xml b/styles/catppuccin-frappe.xml new file mode 100644 index 0000000..0adf1ba --- /dev/null +++ b/styles/catppuccin-frappe.xml @@ -0,0 +1,83 @@ + \ No newline at end of file diff --git a/styles/catppuccin-latte.xml b/styles/catppuccin-latte.xml new file mode 100644 index 0000000..3ea767f --- /dev/null +++ b/styles/catppuccin-latte.xml @@ -0,0 +1,83 @@ + \ No newline at end of file diff --git a/styles/catppuccin-macchiato.xml b/styles/catppuccin-macchiato.xml new file mode 100644 index 0000000..6b50028 --- /dev/null +++ b/styles/catppuccin-macchiato.xml @@ -0,0 +1,83 @@ + \ No newline at end of file diff --git a/styles/catppuccin-mocha.xml b/styles/catppuccin-mocha.xml new file mode 100644 index 0000000..9a40191 --- /dev/null +++ b/styles/catppuccin-mocha.xml @@ -0,0 +1,83 @@ + \ No newline at end of file diff --git a/styles/colorful.xml b/styles/colorful.xml new file mode 100644 index 0000000..32442d7 --- /dev/null +++ b/styles/colorful.xml @@ -0,0 +1,52 @@ + \ No newline at end of file diff --git a/styles/compat.go b/styles/compat.go new file mode 100644 index 0000000..4a6aaa6 --- /dev/null +++ b/styles/compat.go @@ -0,0 +1,66 @@ +package styles + +// Present for backwards compatibility. +// +// Deprecated: use styles.Get(name) instead. +var ( + Abap = Registry["abap"] + Algol = Registry["algol"] + AlgolNu = Registry["algol_nu"] + Arduino = Registry["arduino"] + Autumn = Registry["autumn"] + Average = Registry["average"] + Base16Snazzy = Registry["base16-snazzy"] + Borland = Registry["borland"] + BlackWhite = Registry["bw"] + CatppuccinFrappe = Registry["catppuccin-frappe"] + CatppuccinLatte = Registry["catppuccin-latte"] + CatppuccinMacchiato = Registry["catppuccin-macchiato"] + CatppuccinMocha = Registry["catppuccin-mocha"] + Colorful = Registry["colorful"] + DoomOne = Registry["doom-one"] + DoomOne2 = Registry["doom-one2"] + Dracula = Registry["dracula"] + Emacs = Registry["emacs"] + Friendly = Registry["friendly"] + Fruity = Registry["fruity"] + GitHubDark = Registry["github-dark"] + GitHub = Registry["github"] + GruvboxLight = Registry["gruvbox-light"] + Gruvbox = Registry["gruvbox"] + HrDark = Registry["hrdark"] + HrHighContrast = Registry["hr_high_contrast"] + Igor = Registry["igor"] + Lovelace = Registry["lovelace"] + Manni = Registry["manni"] + ModusOperandi = Registry["modus-operandi"] + ModusVivendi = Registry["modus-vivendi"] + Monokai = Registry["monokai"] + MonokaiLight = Registry["monokailight"] + Murphy = Registry["murphy"] + Native = Registry["native"] + Nord = Registry["nord"] + OnesEnterprise = Registry["onesenterprise"] + ParaisoDark = Registry["paraiso-dark"] + ParaisoLight = Registry["paraiso-light"] + Pastie = Registry["pastie"] + Perldoc = Registry["perldoc"] + Pygments = Registry["pygments"] + RainbowDash = Registry["rainbow_dash"] + RosePineDawn = Registry["rose-pine-dawn"] + RosePineMoon = Registry["rose-pine-moon"] + RosePine = Registry["rose-pine"] + Rrt = Registry["rrt"] + SolarizedDark = Registry["solarized-dark"] + SolarizedDark256 = Registry["solarized-dark256"] + SolarizedLight = Registry["solarized-light"] + SwapOff = Registry["swapoff"] + Tango = Registry["tango"] + Trac = Registry["trac"] + Vim = Registry["vim"] + VisualStudio = Registry["vs"] + Vulcan = Registry["vulcan"] + WitchHazel = Registry["witchhazel"] + XcodeDark = Registry["xcode-dark"] + Xcode = Registry["xcode"] +) diff --git a/styles/doom-one.xml b/styles/doom-one.xml new file mode 100644 index 0000000..1f5127e --- /dev/null +++ b/styles/doom-one.xml @@ -0,0 +1,51 @@ + \ No newline at end of file diff --git a/styles/doom-one2.xml b/styles/doom-one2.xml new file mode 100644 index 0000000..f47deba --- /dev/null +++ b/styles/doom-one2.xml @@ -0,0 +1,64 @@ + \ No newline at end of file diff --git a/styles/dracula.xml b/styles/dracula.xml new file mode 100644 index 0000000..9df7da1 --- /dev/null +++ b/styles/dracula.xml @@ -0,0 +1,74 @@ + \ No newline at end of file diff --git a/styles/emacs.xml b/styles/emacs.xml new file mode 100644 index 0000000..981ce8e --- /dev/null +++ b/styles/emacs.xml @@ -0,0 +1,44 @@ + \ No newline at end of file diff --git a/styles/evergarden.xml b/styles/evergarden.xml new file mode 100644 index 0000000..da1d9b8 --- /dev/null +++ b/styles/evergarden.xml @@ -0,0 +1,33 @@ + \ No newline at end of file diff --git a/styles/friendly.xml b/styles/friendly.xml new file mode 100644 index 0000000..f498010 --- /dev/null +++ b/styles/friendly.xml @@ -0,0 +1,44 @@ + \ No newline at end of file diff --git a/styles/fruity.xml b/styles/fruity.xml new file mode 100644 index 0000000..bcc06aa --- /dev/null +++ b/styles/fruity.xml @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/styles/github-dark.xml b/styles/github-dark.xml new file mode 100644 index 0000000..711aeaf --- /dev/null +++ b/styles/github-dark.xml @@ -0,0 +1,45 @@ + \ No newline at end of file diff --git a/styles/github.xml b/styles/github.xml new file mode 100644 index 0000000..e7caee7 --- /dev/null +++ b/styles/github.xml @@ -0,0 +1,44 @@ + \ No newline at end of file diff --git a/styles/gruvbox-light.xml b/styles/gruvbox-light.xml new file mode 100644 index 0000000..8c4f064 --- /dev/null +++ b/styles/gruvbox-light.xml @@ -0,0 +1,33 @@ + \ No newline at end of file diff --git a/styles/gruvbox.xml b/styles/gruvbox.xml new file mode 100644 index 0000000..2f6a0a2 --- /dev/null +++ b/styles/gruvbox.xml @@ -0,0 +1,33 @@ + \ No newline at end of file diff --git a/styles/hr_high_contrast.xml b/styles/hr_high_contrast.xml new file mode 100644 index 0000000..61cde20 --- /dev/null +++ b/styles/hr_high_contrast.xml @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/styles/hrdark.xml b/styles/hrdark.xml new file mode 100644 index 0000000..bc7a6f3 --- /dev/null +++ b/styles/hrdark.xml @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/styles/igor.xml b/styles/igor.xml new file mode 100644 index 0000000..773c83b --- /dev/null +++ b/styles/igor.xml @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/styles/lovelace.xml b/styles/lovelace.xml new file mode 100644 index 0000000..e336c93 --- /dev/null +++ b/styles/lovelace.xml @@ -0,0 +1,53 @@ + \ No newline at end of file diff --git a/styles/manni.xml b/styles/manni.xml new file mode 100644 index 0000000..99324bd --- /dev/null +++ b/styles/manni.xml @@ -0,0 +1,44 @@ + \ No newline at end of file diff --git a/styles/modus-operandi.xml b/styles/modus-operandi.xml new file mode 100644 index 0000000..023137a --- /dev/null +++ b/styles/modus-operandi.xml @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/styles/modus-vivendi.xml b/styles/modus-vivendi.xml new file mode 100644 index 0000000..8da663d --- /dev/null +++ b/styles/modus-vivendi.xml @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/styles/monokai.xml b/styles/monokai.xml new file mode 100644 index 0000000..1a789dd --- /dev/null +++ b/styles/monokai.xml @@ -0,0 +1,29 @@ + \ No newline at end of file diff --git a/styles/monokailight.xml b/styles/monokailight.xml new file mode 100644 index 0000000..85cd23e --- /dev/null +++ b/styles/monokailight.xml @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/styles/murphy.xml b/styles/murphy.xml new file mode 100644 index 0000000..112d620 --- /dev/null +++ b/styles/murphy.xml @@ -0,0 +1,52 @@ + \ No newline at end of file diff --git a/styles/native.xml b/styles/native.xml new file mode 100644 index 0000000..43eea7f --- /dev/null +++ b/styles/native.xml @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/styles/nord.xml b/styles/nord.xml new file mode 100644 index 0000000..1c1d1ff --- /dev/null +++ b/styles/nord.xml @@ -0,0 +1,46 @@ + diff --git a/styles/nordic.xml b/styles/nordic.xml new file mode 100644 index 0000000..4c36b8e --- /dev/null +++ b/styles/nordic.xml @@ -0,0 +1,46 @@ + diff --git a/styles/onedark.xml b/styles/onedark.xml new file mode 100644 index 0000000..6921eb5 --- /dev/null +++ b/styles/onedark.xml @@ -0,0 +1,25 @@ + diff --git a/styles/onesenterprise.xml b/styles/onesenterprise.xml new file mode 100644 index 0000000..ce86db3 --- /dev/null +++ b/styles/onesenterprise.xml @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/styles/paraiso-dark.xml b/styles/paraiso-dark.xml new file mode 100644 index 0000000..788db3f --- /dev/null +++ b/styles/paraiso-dark.xml @@ -0,0 +1,37 @@ + \ No newline at end of file diff --git a/styles/paraiso-light.xml b/styles/paraiso-light.xml new file mode 100644 index 0000000..06a63ba --- /dev/null +++ b/styles/paraiso-light.xml @@ -0,0 +1,37 @@ + \ No newline at end of file diff --git a/styles/pastie.xml b/styles/pastie.xml new file mode 100644 index 0000000..a3b0abd --- /dev/null +++ b/styles/pastie.xml @@ -0,0 +1,45 @@ + \ No newline at end of file diff --git a/styles/perldoc.xml b/styles/perldoc.xml new file mode 100644 index 0000000..9e5564c --- /dev/null +++ b/styles/perldoc.xml @@ -0,0 +1,37 @@ + \ No newline at end of file diff --git a/styles/pygments.xml b/styles/pygments.xml new file mode 100644 index 0000000..a3d0d8b --- /dev/null +++ b/styles/pygments.xml @@ -0,0 +1,42 @@ + \ No newline at end of file diff --git a/styles/rainbow_dash.xml b/styles/rainbow_dash.xml new file mode 100644 index 0000000..5b0fe49 --- /dev/null +++ b/styles/rainbow_dash.xml @@ -0,0 +1,40 @@ + \ No newline at end of file diff --git a/styles/rose-pine-dawn.xml b/styles/rose-pine-dawn.xml new file mode 100644 index 0000000..788bd6f --- /dev/null +++ b/styles/rose-pine-dawn.xml @@ -0,0 +1,29 @@ + diff --git a/styles/rose-pine-moon.xml b/styles/rose-pine-moon.xml new file mode 100644 index 0000000..f67b804 --- /dev/null +++ b/styles/rose-pine-moon.xml @@ -0,0 +1,29 @@ + diff --git a/styles/rose-pine.xml b/styles/rose-pine.xml new file mode 100644 index 0000000..3fb70a5 --- /dev/null +++ b/styles/rose-pine.xml @@ -0,0 +1,29 @@ + diff --git a/styles/rrt.xml b/styles/rrt.xml new file mode 100644 index 0000000..5f1daaa --- /dev/null +++ b/styles/rrt.xml @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/styles/solarized-dark.xml b/styles/solarized-dark.xml new file mode 100644 index 0000000..a3cf46f --- /dev/null +++ b/styles/solarized-dark.xml @@ -0,0 +1,39 @@ + \ No newline at end of file diff --git a/styles/solarized-dark256.xml b/styles/solarized-dark256.xml new file mode 100644 index 0000000..977cfbe --- /dev/null +++ b/styles/solarized-dark256.xml @@ -0,0 +1,41 @@ + \ No newline at end of file diff --git a/styles/solarized-light.xml b/styles/solarized-light.xml new file mode 100644 index 0000000..4fbc1d4 --- /dev/null +++ b/styles/solarized-light.xml @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/styles/swapoff.xml b/styles/swapoff.xml new file mode 100644 index 0000000..8a398df --- /dev/null +++ b/styles/swapoff.xml @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/styles/tango.xml b/styles/tango.xml new file mode 100644 index 0000000..5ca46bb --- /dev/null +++ b/styles/tango.xml @@ -0,0 +1,72 @@ + \ No newline at end of file diff --git a/styles/tokyonight-day.xml b/styles/tokyonight-day.xml new file mode 100644 index 0000000..c20d9a4 --- /dev/null +++ b/styles/tokyonight-day.xml @@ -0,0 +1,83 @@ + \ No newline at end of file diff --git a/styles/tokyonight-moon.xml b/styles/tokyonight-moon.xml new file mode 100644 index 0000000..3312f02 --- /dev/null +++ b/styles/tokyonight-moon.xml @@ -0,0 +1,83 @@ + diff --git a/styles/tokyonight-night.xml b/styles/tokyonight-night.xml new file mode 100644 index 0000000..c798bad --- /dev/null +++ b/styles/tokyonight-night.xml @@ -0,0 +1,83 @@ + \ No newline at end of file diff --git a/styles/tokyonight-storm.xml b/styles/tokyonight-storm.xml new file mode 100644 index 0000000..c081152 --- /dev/null +++ b/styles/tokyonight-storm.xml @@ -0,0 +1,83 @@ + \ No newline at end of file diff --git a/styles/trac.xml b/styles/trac.xml new file mode 100644 index 0000000..9f1d266 --- /dev/null +++ b/styles/trac.xml @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/styles/vim.xml b/styles/vim.xml new file mode 100644 index 0000000..fec6934 --- /dev/null +++ b/styles/vim.xml @@ -0,0 +1,29 @@ + \ No newline at end of file diff --git a/styles/vs.xml b/styles/vs.xml new file mode 100644 index 0000000..5643501 --- /dev/null +++ b/styles/vs.xml @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/styles/vulcan.xml b/styles/vulcan.xml new file mode 100644 index 0000000..4e69094 --- /dev/null +++ b/styles/vulcan.xml @@ -0,0 +1,74 @@ + diff --git a/styles/witchhazel.xml b/styles/witchhazel.xml new file mode 100644 index 0000000..52f2299 --- /dev/null +++ b/styles/witchhazel.xml @@ -0,0 +1,31 @@ + \ No newline at end of file diff --git a/styles/xcode-dark.xml b/styles/xcode-dark.xml new file mode 100644 index 0000000..9343979 --- /dev/null +++ b/styles/xcode-dark.xml @@ -0,0 +1,31 @@ + \ No newline at end of file diff --git a/styles/xcode.xml b/styles/xcode.xml new file mode 100644 index 0000000..523d746 --- /dev/null +++ b/styles/xcode.xml @@ -0,0 +1,22 @@ + \ No newline at end of file