blob: 02b42e41836defd5f87710b0192e56ce4e89862d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
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
}
|