@@ -8,7 +8,11 @@ use syntect::highlighting::{Theme, ThemeSet};
88
99/// Returns an [`EmbeddedLazyThemeSet`] with more popular theme definitions
1010///
11- /// Note: This includes all of `syntect`'s embedded theme definitions
11+ /// These themes cover a variety of use-cases, so it's very likely that you'll only want to expose
12+ /// a subset or tweak the values for specific themes depending on your usage. E.g.
13+ /// `EmbeddedThemeName::{Ansi, Base16, Base16_256}` are all terminal related themes,
14+ /// `EmbeddedThemeName::InspiredGithub` uses a full-white background which wouldn't be a good fit
15+ /// for a static site generator, etc.
1216///
1317/// # Example
1418///
@@ -60,12 +64,22 @@ impl EmbeddedLazyThemeSet {
6064 /// ```
6165 pub fn theme_names ( ) -> & ' static [ EmbeddedThemeName ] {
6266 & [
63- EmbeddedThemeName :: Leet ,
67+ EmbeddedThemeName :: Ansi ,
68+ EmbeddedThemeName :: Base16 ,
69+ EmbeddedThemeName :: Base16EightiesDark ,
70+ EmbeddedThemeName :: Base16MochaDark ,
71+ EmbeddedThemeName :: Base16OceanDark ,
72+ EmbeddedThemeName :: Base16OceanLight ,
73+ EmbeddedThemeName :: Base16_256 ,
6474 EmbeddedThemeName :: ColdarkCold ,
6575 EmbeddedThemeName :: ColdarkDark ,
6676 EmbeddedThemeName :: DarkNeon ,
6777 EmbeddedThemeName :: Dracula ,
6878 EmbeddedThemeName :: Github ,
79+ EmbeddedThemeName :: GruvboxDark ,
80+ EmbeddedThemeName :: GruvboxLight ,
81+ EmbeddedThemeName :: InspiredGithub ,
82+ EmbeddedThemeName :: Leet ,
6983 EmbeddedThemeName :: MonokaiExtended ,
7084 EmbeddedThemeName :: MonokaiExtendedBright ,
7185 EmbeddedThemeName :: MonokaiExtendedLight ,
@@ -78,11 +92,6 @@ impl EmbeddedLazyThemeSet {
7892 EmbeddedThemeName :: SubmlimeSnazzy ,
7993 EmbeddedThemeName :: TwoDark ,
8094 EmbeddedThemeName :: VisualStudioDarkPlus ,
81- EmbeddedThemeName :: Ansi ,
82- EmbeddedThemeName :: Base16 ,
83- EmbeddedThemeName :: Base16_256 ,
84- EmbeddedThemeName :: GruvboxDark ,
85- EmbeddedThemeName :: GruvboxLight ,
8695 EmbeddedThemeName :: Zenburn ,
8796 ]
8897 }
@@ -100,17 +109,26 @@ impl From<&EmbeddedLazyThemeSet> for ThemeSet {
100109 }
101110}
102111
103- // TODO: include syntect's defaults in the dump too
104112/// An enum that represents all themes included in [`EmbeddedLazyThemeSet`]
105113#[ derive( Clone , Copy , Debug , PartialEq , Eq , PartialOrd , Ord ) ]
106114#[ cfg_attr( test, derive( strum:: EnumIter ) ) ]
107115pub enum EmbeddedThemeName {
108- Leet ,
116+ Ansi ,
117+ Base16 ,
118+ Base16EightiesDark ,
119+ Base16MochaDark ,
120+ Base16OceanDark ,
121+ Base16OceanLight ,
122+ Base16_256 ,
109123 ColdarkCold ,
110124 ColdarkDark ,
111125 DarkNeon ,
112126 Dracula ,
113127 Github ,
128+ GruvboxDark ,
129+ GruvboxLight ,
130+ InspiredGithub ,
131+ Leet ,
114132 MonokaiExtended ,
115133 MonokaiExtendedBright ,
116134 MonokaiExtendedLight ,
@@ -123,23 +141,31 @@ pub enum EmbeddedThemeName {
123141 SubmlimeSnazzy ,
124142 TwoDark ,
125143 VisualStudioDarkPlus ,
126- Ansi ,
127- Base16 ,
128- Base16_256 ,
129- GruvboxDark ,
130- GruvboxLight ,
131144 Zenburn ,
132145}
133146
134147impl EmbeddedThemeName {
148+ /// The name of each embedded theme
149+ ///
150+ /// This matches the key used for each theme in [`ThemeSet`]'s `themes`
135151 pub fn as_name ( self ) -> & ' static str {
136152 match self {
137- Self :: Leet => "1337" ,
153+ Self :: Ansi => "ansi" ,
154+ Self :: Base16 => "base16" ,
155+ Self :: Base16EightiesDark => "base16-eighties.dark" ,
156+ Self :: Base16MochaDark => "base16-mocha.dark" ,
157+ Self :: Base16OceanDark => "base16-ocean.dark" ,
158+ Self :: Base16OceanLight => "base16-ocean.light" ,
159+ Self :: Base16_256 => "base16-256" ,
138160 Self :: ColdarkCold => "Coldark-Cold" ,
139161 Self :: ColdarkDark => "Coldark-Dark" ,
140162 Self :: DarkNeon => "DarkNeon" ,
141163 Self :: Dracula => "Dracula" ,
142164 Self :: Github => "GitHub" ,
165+ Self :: GruvboxDark => "gruvbox-dark" ,
166+ Self :: GruvboxLight => "gruvbox-light" ,
167+ Self :: InspiredGithub => "InspiredGitHub" ,
168+ Self :: Leet => "1337" ,
143169 Self :: MonokaiExtended => "Monokai Extended" ,
144170 Self :: MonokaiExtendedBright => "Monokai Extended Bright" ,
145171 Self :: MonokaiExtendedLight => "Monokai Extended Light" ,
@@ -152,11 +178,6 @@ impl EmbeddedThemeName {
152178 Self :: SubmlimeSnazzy => "Sublime Snazzy" ,
153179 Self :: TwoDark => "TwoDark" ,
154180 Self :: VisualStudioDarkPlus => "Visual Studio Dark+" ,
155- Self :: Ansi => "ansi" ,
156- Self :: Base16 => "base16" ,
157- Self :: Base16_256 => "base16-256" ,
158- Self :: GruvboxDark => "gruvbox-dark" ,
159- Self :: GruvboxLight => "gruvbox-light" ,
160181 Self :: Zenburn => "zenburn" ,
161182 }
162183 }
0 commit comments