[][src]Trait dialect::Theme

pub trait Theme {
    fn default_style(&self) -> ResolvedStyle;
fn style(&self, group: HighlightGroup) -> Style; }

A trait for defining syntax highlighting themes.

Required methods

fn default_style(&self) -> ResolvedStyle

The style for unhighlighted text. To understand why this must be a fully resolved style, consider the following example:

  • default_style returns a Style which omits a foreground colour - at some point a highlighter returns a HighlightedSpan without a highlight group
  • when render is called, what is the foreground colour of this unhighlighted HighlightedSpan?

To prevent situations like this, default_style acts as a fallback for all cases by forcing the implementor to define all of the style’s fields.

fn style(&self, group: HighlightGroup) -> Style

Provides a mapping from HighlightGroups to Styles. As HighlightGroups contain a variant for unhighlighted text, this thereby defines the appearance of the whole text field.

Loading content...

Implementors

impl Theme for DarkPlus[src]

impl Theme for Dracula[src]

impl Theme for Gruvbox[src]

impl Theme for Monokai[src]

impl Theme for Nord[src]

impl Theme for Seoul[src]

impl Theme for SolarizedDark[src]

impl Theme for SolarizedLight[src]

Loading content...