use crate::{
platform::prelude::*,
settings::{Color, Gradient, SemanticColor},
};
use alloc::borrow::Cow;
use serde::{Deserialize, Serialize};
#[derive(Default, Serialize, Deserialize)]
pub struct State {
pub background: Gradient,
pub key_color: Option<Color>,
pub value_color: Option<Color>,
pub semantic_color: SemanticColor,
pub key: String,
pub value: String,
pub key_abbreviations: Vec<Cow<'static, str>>,
pub display_two_rows: bool,
pub updates_frequently: bool,
}
#[cfg(feature = "std")]
impl State {
pub fn write_json<W>(&self, writer: W) -> serde_json::Result<()>
where
W: std::io::Write,
{
serde_json::to_writer(writer, self)
}
}
pub(super) const DEFAULT_GRADIENT: Gradient = Gradient::Vertical(
Color {
red: 1.0,
green: 1.0,
blue: 1.0,
alpha: 0.06,
},
Color {
red: 1.0,
green: 1.0,
blue: 1.0,
alpha: 0.005,
},
);