pub struct Theme {
pub name: String,
pub version: String,
pub colors: ThemeColors,
pub syntax: SyntaxColors,
pub ui: UiColors,
}Fields§
§name: String§version: String§colors: ThemeColors§syntax: SyntaxColors§ui: UiColorsImplementations§
Source§impl Theme
impl Theme
Sourcepub fn resolve(config: &Config, cwd: &Path) -> Self
pub fn resolve(config: &Config, cwd: &Path) -> Self
Resolve the active theme for the given config/cwd.
- If
config.themeis unset/empty, defaults toTheme::dark. - If set to
dark,light, orsolarized, uses built-in defaults. - Otherwise, attempts to resolve a theme spec:
- discovered theme name (from user/project theme dirs)
- theme JSON file path (absolute or cwd-relative, supports
~/...)
Falls back to dark on error.
Sourcepub fn resolve_spec(spec: &str, cwd: &Path) -> Result<Self>
pub fn resolve_spec(spec: &str, cwd: &Path) -> Result<Self>
Resolve a theme spec into a theme.
Supported specs:
- Built-ins:
dark,light,solarized - Theme name: resolves via
Self::load_by_name - File path: resolves via
Self::load(absolute or cwd-relative, supports~/...)
pub fn is_light(&self) -> bool
pub fn tui_styles(&self) -> TuiStyles
pub fn glamour_style_config(&self) -> GlamourStyleConfig
Sourcepub fn discover_themes(cwd: &Path) -> Vec<PathBuf>
pub fn discover_themes(cwd: &Path) -> Vec<PathBuf>
Discover available theme JSON files.
Sourcepub fn discover_themes_with_roots(roots: &ThemeRoots) -> Vec<PathBuf>
pub fn discover_themes_with_roots(roots: &ThemeRoots) -> Vec<PathBuf>
Discover available theme JSON files using explicit roots.
Sourcepub fn load_by_name(name: &str, cwd: &Path) -> Result<Self>
pub fn load_by_name(name: &str, cwd: &Path) -> Result<Self>
Load a theme by name, searching global and project theme directories.
Sourcepub fn load_by_name_with_roots(name: &str, roots: &ThemeRoots) -> Result<Self>
pub fn load_by_name_with_roots(name: &str, roots: &ThemeRoots) -> Result<Self>
Load a theme by name using explicit roots.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Theme
impl<'de> Deserialize<'de> for Theme
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnsafeUnpin for Theme
impl UnwindSafe for Theme
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).
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 moreSource§impl<T> ModelDump for Twhere
T: Serialize,
impl<T> ModelDump for Twhere
T: Serialize,
Source§fn model_dump(&self, options: DumpOptions) -> Result<Value, Error>
fn model_dump(&self, options: DumpOptions) -> Result<Value, Error>
Serialize a model to a JSON value. Read more
Source§fn model_dump_json(&self) -> Result<String, Error>
fn model_dump_json(&self) -> Result<String, Error>
Serialize a model to a JSON string with default options.
Source§fn model_dump_json_pretty(&self) -> Result<String, Error>
fn model_dump_json_pretty(&self) -> Result<String, Error>
Serialize a model to a pretty-printed JSON string.
Source§fn model_dump_json_with_options(
&self,
options: DumpOptions,
) -> Result<String, Error>
fn model_dump_json_with_options( &self, options: DumpOptions, ) -> Result<String, Error>
Serialize a model to a JSON string with full options support. Read more
Source§impl<T> ModelValidate for Twhere
T: DeserializeOwned,
impl<T> ModelValidate for Twhere
T: DeserializeOwned,
Source§fn model_validate(
input: impl Into<ValidateInput>,
options: ValidateOptions,
) -> Result<T, ValidationError>
fn model_validate( input: impl Into<ValidateInput>, options: ValidateOptions, ) -> Result<T, ValidationError>
Create and validate a model from input. Read more
Source§fn model_validate_json(json: &str) -> Result<Self, ValidationError>
fn model_validate_json(json: &str) -> Result<Self, ValidationError>
Create and validate a model from JSON string with default options.
Source§fn model_validate_dict(
dict: HashMap<String, Value>,
) -> Result<Self, ValidationError>
fn model_validate_dict( dict: HashMap<String, Value>, ) -> Result<Self, ValidationError>
Create and validate a model from a HashMap with default options.