1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! Function to resolve the effective theme variant.
use crateThemeVariant;
/// Get the effective color scheme based on variant and terminal detection.
///
/// Resolves a [`ThemeVariant`] to its effective value. For `Dark` and `Light`
/// variants, returns them unchanged. For `Auto`, attempts to detect the
/// terminal's color scheme.
///
/// # Arguments
///
/// * `variant` - The [`ThemeVariant`] to resolve
///
/// # Returns
///
/// The effective [`ThemeVariant`] after resolution. Note that `Auto` will
/// be resolved to either `Dark` or `Light`.
///
/// # Features
///
/// When the `termenv` feature is enabled, auto-detection will use the
/// terminal environment to determine the color scheme. Without this feature,
/// `Auto` defaults to `Dark`.
///
/// # Example
///
/// ```rust,ignore
/// use ratatui_toolkit::markdown_widget::extensions::theme::{ThemeVariant, get_effective_theme_variant};
///
/// // Explicit variant is returned unchanged
/// assert_eq!(
/// get_effective_theme_variant(ThemeVariant::Dark),
/// ThemeVariant::Dark
/// );
///
/// // Auto resolves to Dark or Light based on terminal
/// let effective = get_effective_theme_variant(ThemeVariant::Auto);
/// assert!(matches!(effective, ThemeVariant::Dark | ThemeVariant::Light));
/// ```