use serde::{Deserialize, Serialize};
use std::path::PathBuf;
pub mod theme;
#[cfg(feature = "io")]
pub mod io;
pub use theme::{Colors, Palette, Theme};
pub use serde_json;
#[cfg(feature = "palette")]
pub use palette;
#[cfg(not(feature = "palette"))]
pub mod palette {
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Srgb<T = f32> {
pub red: T,
pub green: T,
pub blue: T,
}
impl<T> Srgb<T> {
pub const fn new(red: T, green: T, blue: T) -> Self {
Self { red, green, blue }
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Directories {
pub config: PathBuf,
pub output: PathBuf,
pub cache: PathBuf,
pub data: PathBuf,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Input {
#[serde(rename = "pipe")]
pub pipe_path: Option<PathBuf>,
pub directories: Directories,
pub name: String,
pub options: serde_json::Value,
pub theme: Theme,
}
pub fn get_input() -> Option<Input> {
serde_json::from_reader(&mut std::io::stdin()).ok()
}