pub struct Base16Palette {Show 19 fields
pub name: &'static str,
pub author: &'static str,
pub slug: &'static str,
pub base00: Color,
pub base01: Color,
pub base02: Color,
pub base03: Color,
pub base04: Color,
pub base05: Color,
pub base06: Color,
pub base07: Color,
pub base08: Color,
pub base09: Color,
pub base0a: Color,
pub base0b: Color,
pub base0c: Color,
pub base0d: Color,
pub base0e: Color,
pub base0f: Color,
}Expand description
A Base16Palette defines a color palette based on the Base16 styling
guidelines. These color codes are typically used to create themes for syntax
highlighting, terminal emulators, and other developer tools. Each field
represents a different element of the user interface that can be customized.
Base16 aims to group similar language constructs with a single colour. For
example, floats, ints, and doubles would belong to the same colour group.
The colours for the default theme were chosen to be easily separable, but
scheme designers should pick whichever colours they desire, e.g. base0B
(green by default) could be replaced with red. There are, however, some
general guidelines below that stipulate which base0B should be used to
highlight each construct when designing templates for editors.
Colours base00 to base07 are typically variations of a shade and run from darkest to lightest. These colours are used for foreground and background, status bars, line highlighting and such. colours base08 to base0F are typically individual colours used for types, operators, names and variables. In order to create a dark theme, colours base00 to base07 should span from dark to light. For a light theme, these colours should span from light to dark.
Fields§
§name: &'static strName
Author
slug: &'static strDefault Background
base00: ColorDefault Background
base01: ColorLighter Background (Used for status bars, line number and folding marks)
base02: ColorSelection Background (Settings where you need to highlight text, such as find results)
base03: ColorComments, Invisibles, Line Highlighting
base04: ColorDark Foreground (Used for status bars)
base05: ColorDefault Foreground, Caret, Delimiters, Operators
base06: ColorLight Foreground (Not often used, could be used for hover states or dividers)
base07: ColorLight Background (Probably at most for cursor line background color)
base08: ColorVariables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted
base09: ColorIntegers, Boolean, Constants, XML Attributes, Markup Link Url
base0a: ColorClasses, Markup Bold, Search Text Background
base0b: ColorStrings, Inherited Class, Markup Code, Diff Inserted
base0c: ColorSupport, Regular Expressions, Escape Characters, Markup Quotes
base0d: ColorFunctions, Methods, Attribute IDs, Headings
base0e: ColorKeywords, Storage, Selector, Markup Bold, Diff Changed
base0f: ColorDeprecated, Opening/Closing Embedded Language Tags, e.g. `
Implementations§
Source§impl Base16Palette
impl Base16Palette
Sourcepub fn from_yaml(file: impl Into<PathBuf>) -> Result<Self, Base16PaletteError>
pub fn from_yaml(file: impl Into<PathBuf>) -> Result<Self, Base16PaletteError>
Loads a Base16Palette instance from a YAML file.
Given a file path, this function uses Figment’s Yaml provider to read
and parse the YAML content into a Base16Palette instance. This
allows for loading the color palette configuration from a
YAML-formatted file.
§Arguments
file: The file path pointing to the YAML configuration file. The file path type is generic and can be any type that implementsInto<PathBuf>.
§Returns
If the function is successful, it returns Ok(Base16Palette), the
loaded palette instance. If an error occurs during reading or
parsing the file, it returns a Base16PaletteError.
§Examples
let palette_result = Base16Palette::from_yaml("path_to_file.yaml");Sourcepub fn from_toml(file: impl Into<PathBuf>) -> Result<Self, Base16PaletteError>
pub fn from_toml(file: impl Into<PathBuf>) -> Result<Self, Base16PaletteError>
Loads a Base16Palette instance from a TOML file.
Given a file path, this function uses Figment’s Toml provider to read
and parse the TOML content into a Base16Palette instance. This
allows for loading the color palette configuration from a
TOML-formatted file.
§Arguments
file: The file path pointing to the TOML configuration file. The file path type is generic and can be any type that implementsInto<PathBuf>.
§Returns
If the function is successful, it returns Ok(Base16Palette), the
loaded palette instance. If an error occurs during reading or
parsing the file, it returns a Base16PaletteError.
§Examples
let palette_result = Base16Palette::from_toml("path_to_file.toml");Trait Implementations§
Source§impl Clone for Base16Palette
impl Clone for Base16Palette
Source§fn clone(&self) -> Base16Palette
fn clone(&self) -> Base16Palette
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Base16Palette
impl Debug for Base16Palette
Source§impl Default for Base16Palette
impl Default for Base16Palette
Source§impl<'de> Deserialize<'de> for Base16Palette
impl<'de> Deserialize<'de> for Base16Palette
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>,
Auto Trait Implementations§
impl Freeze for Base16Palette
impl RefUnwindSafe for Base16Palette
impl Send for Base16Palette
impl Sync for Base16Palette
impl Unpin for Base16Palette
impl UnwindSafe for Base16Palette
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,
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>
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>
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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);