pub struct SyntaxPalette {
pub keyword: Hsla,
pub string: Hsla,
pub function: Hsla,
pub type_name: Hsla,
pub comment: Hsla,
pub number: Hsla,
pub meta: Hsla,
pub link: Hsla,
}Expand description
Colors for each TokenKind.
Fields§
§keyword: Hsla§string: Hsla§function: Hsla§type_name: Hsla§comment: Hsla§number: Hsla§meta: Hsla§link: HslaImplementations§
Source§impl SyntaxPalette
impl SyntaxPalette
Sourcepub fn from_scheme(s: &Scheme, dark: bool) -> Self
pub fn from_scheme(s: &Scheme, dark: bool) -> Self
The reference design’s M3 Expressive syntax colors: keywords in the primary color, strings in the success color, types in the tertiary color, comments in the outline color, numbers in the warning color, plus a fixed orange for functions and blue for meta.
Sourcepub fn of(cx: &App) -> Self
pub fn of(cx: &App) -> Self
The override set with SyntaxPalette::set, or the colors derived from the current theme.
Sourcepub fn set(palette: Option<SyntaxPalette>, cx: &mut App)
pub fn set(palette: Option<SyntaxPalette>, cx: &mut App)
Uses your own syntax colors (e.g. another visual style’s tokens); None goes back to the
theme’s.
pub fn color(&self, kind: TokenKind) -> Hsla
Sourcepub fn style(&self, kind: TokenKind) -> HighlightStyle
pub fn style(&self, kind: TokenKind) -> HighlightStyle
Text style for a token: its color, italic comments, bold headings and underlined links.
Sourcepub fn highlights(
&self,
tokens: &[(Range<usize>, TokenKind)],
) -> Vec<(Range<usize>, HighlightStyle)>
pub fn highlights( &self, tokens: &[(Range<usize>, TokenKind)], ) -> Vec<(Range<usize>, HighlightStyle)>
Highlights for a gpui::StyledText from token ranges.
Trait Implementations§
Source§impl Clone for SyntaxPalette
impl Clone for SyntaxPalette
impl Copy for SyntaxPalette
Source§impl Debug for SyntaxPalette
impl Debug for SyntaxPalette
Source§impl PartialEq for SyntaxPalette
impl PartialEq for SyntaxPalette
impl StructuralPartialEq for SyntaxPalette
Auto Trait Implementations§
impl Forget for SyntaxPalette
impl Freeze for SyntaxPalette
impl Move 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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more