#[non_exhaustive]pub enum ColorInitStrategy {
Configure(ColorSupport, TermBgLuma, Option<[u8; 3]>),
Default,
Match,
}Expand description
Strategies for initializing terminal color attributes and theme selection
This enum defines different approaches for determining the appropriate color support and theme based on terminal capabilities, configuration, or defaults.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Configure(ColorSupport, TermBgLuma, Option<[u8; 3]>)
Use explicitly configured color support, background luminance, and optional background RGB
Parameters:
ColorSupport: The configured color support levelTermBgLuma: The configured background luminance (light/dark)Option<[u8; 3]>: Optional RGB values for the background color
Default
Use safe default values without detection or configuration
Falls back to basic color support with dark background theme
Match
Automatically detect terminal capabilities and match appropriate theme
Uses terminal detection to determine color support and background luminance, then selects the best matching theme
Implementations§
Source§impl ColorInitStrategy
impl ColorInitStrategy
Sourcepub fn determine() -> Self
pub fn determine() -> Self
Determines the appropriate color initialization strategy based on available features and configuration.
This method evaluates the current environment and available features to select the most appropriate strategy for initializing terminal color attributes:
- With
color_detectfeature: Uses auto-detection unless in test environment - With
configfeature only: Uses configuration values or falls back to defaults - Neither feature: Always uses safe defaults
§Returns
A static reference to the determined ColorInitStrategy
§Behavior
- In test environments (
TEST_ENVset): Always returnsDefaultstrategy - On Windows with
color_detect: UsesConfigurestrategy with detected values - Other platforms with
color_detect: UsesMatchstrategy for auto-detection - With config only: Uses
ConfigureorMatchbased on configuration completeness - No features: Uses
Defaultstrategy
Trait Implementations§
Source§impl Clone for ColorInitStrategy
impl Clone for ColorInitStrategy
Source§fn clone(&self) -> ColorInitStrategy
fn clone(&self) -> ColorInitStrategy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ColorInitStrategy
impl RefUnwindSafe for ColorInitStrategy
impl Send for ColorInitStrategy
impl Sync for ColorInitStrategy
impl Unpin for ColorInitStrategy
impl UnwindSafe for ColorInitStrategy
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 more