pub struct SyntaxPalette {
pub keyword: Color,
pub string: Color,
pub number: Color,
pub function: Color,
pub macro_: Color,
pub type_: Color,
pub constant: Color,
pub property: Color,
pub tag: Color,
}Expand description
Per-token-category colors for syntax highlighting, resolved through the Theme.
Tree-sitter highlight capture names are mapped onto these nine categories so
that code blocks adopt the active theme’s palette instead of a hardcoded
One Dark scheme. Neutral tokens (comments, operators, plain variables,
punctuation) continue to resolve through Theme::text/Theme::text_dim
and are not represented here.
§Example
use slt::{SyntaxPalette, Theme};
let theme = Theme::nord();
// `keyword`-class tokens render with Nord's mauve, not One Dark purple.
let kw: slt::Color = theme.syntax.keyword;
assert_eq!(kw, SyntaxPalette::nord().keyword);Fields§
§keyword: ColorKeywords (fn, let, if, return, …).
string: ColorString and char literals.
number: ColorNumeric literals.
function: ColorFunction and method names.
macro_: ColorMacro invocations (e.g. println!).
type_: ColorType names, builtins, and constructors.
constant: ColorConstants, builtin constants, and attribute values.
property: ColorObject/struct properties and fields.
tag: ColorMarkup tags and tag-like builtin variables.
Implementations§
Source§impl SyntaxPalette
impl SyntaxPalette
Sourcepub const fn one_dark() -> Self
pub const fn one_dark() -> Self
One Dark (Atom) palette — the historical default used by
Theme::dark and Theme::one_dark.
Sourcepub const fn one_light() -> Self
pub const fn one_light() -> Self
One Light palette — the historical light-variant default used by
Theme::light and Theme::solarized_light.
Sourcepub const fn catppuccin() -> Self
pub const fn catppuccin() -> Self
Catppuccin Mocha palette.
Sourcepub const fn solarized_dark() -> Self
pub const fn solarized_dark() -> Self
Solarized Dark palette.
Sourcepub const fn solarized_light() -> Self
pub const fn solarized_light() -> Self
Solarized Light palette.
Sourcepub const fn tokyo_night() -> Self
pub const fn tokyo_night() -> Self
Tokyo Night palette.
Sourcepub const fn gruvbox_dark() -> Self
pub const fn gruvbox_dark() -> Self
Gruvbox Dark palette.
Trait Implementations§
Source§impl Clone for SyntaxPalette
impl Clone for SyntaxPalette
Source§fn clone(&self) -> SyntaxPalette
fn clone(&self) -> SyntaxPalette
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SyntaxPalette
Source§impl Debug for SyntaxPalette
impl Debug for SyntaxPalette
Source§impl Default for SyntaxPalette
impl Default for SyntaxPalette
Source§impl<'de> Deserialize<'de> for SyntaxPalette
impl<'de> Deserialize<'de> for SyntaxPalette
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for SyntaxPalette
Source§impl Hash for SyntaxPalette
impl Hash for SyntaxPalette
Source§impl PartialEq for SyntaxPalette
impl PartialEq for SyntaxPalette
Source§fn eq(&self, other: &SyntaxPalette) -> bool
fn eq(&self, other: &SyntaxPalette) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for SyntaxPalette
impl Serialize for SyntaxPalette
impl StructuralPartialEq for SyntaxPalette
Auto Trait Implementations§
impl Freeze for SyntaxPalette
impl RefUnwindSafe for SyntaxPalette
impl Send for SyntaxPalette
impl Sync for SyntaxPalette
impl Unpin for SyntaxPalette
impl UnsafeUnpin for SyntaxPalette
impl UnwindSafe for SyntaxPalette
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.