use crossterm::style::Color; use serde::{Serialize, Deserialize}; use serde_json::{to_string_pretty, from_str}; #[derive(Serialize, Deserialize, Debug)] struct cscheme { a: Color, asharp: Color, b: Color, } fn main() { let val = Color::Rgb {r: 110, g: 255, b: 220}; let val2 = Color::AnsiValue(51); let val3 = Color::DarkMagenta; let scheme = cscheme {a: val, asharp: val2, b: val3}; let json = to_string_pretty(&scheme).unwrap(); println!("{}", json); let result: cscheme = from_str(&json).unwrap(); println!("{:?}", result); //println!("{} {}", to_string_pretty }