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
//! Load theme from a JSON file path.
use fs;
use Path;
use crateAppTheme;
use crateload_theme_str;
use crateThemeVariant;
/// Loads an [`AppTheme`] from a JSON file path.
///
/// Reads the file contents and delegates to [`load_theme_str`] for parsing.
///
/// # Arguments
///
/// * `path` - Path to the JSON theme file
/// * `variant` - Which theme variant (dark/light) to use
///
/// # Returns
///
/// `Ok(AppTheme)` if the file can be read and parsed successfully,
/// `Err` with a description if reading or parsing fails.
///
/// # Errors
///
/// Returns an error if:
/// - The file cannot be read
/// - The JSON is malformed
/// - Required color keys are missing
/// - Color values cannot be resolved
///
/// # Example
///
/// ```rust,no_run
/// use ratatui_toolkit::services::theme::{loader, ThemeVariant};
///
/// let theme = loader::load_theme_file("themes/gruvbox.json", ThemeVariant::Dark)
/// .expect("Failed to load theme");
/// ```