改进枚举内容的序列化输出。

This commit is contained in:
徐涛
2025-02-07 09:00:06 +08:00
parent 2bc250fc3d
commit 41788c4944
5 changed files with 18 additions and 16 deletions

View File

@@ -13,6 +13,7 @@ palette = { version = "0.7.6", features = ["serde"] }
serde = { version = "1.0.216", features = ["derive"] }
serde-wasm-bindgen = "0.6.5"
serde_json = "1.0.134"
serde_repr = "0.1.19"
strum = { version = "0.26.3", features = ["derive", "strum_macros"] }
strum_macros = "0.26.4"
thiserror = "2.0.9"

View File

@@ -3,6 +3,7 @@ use std::ops::{Div, Mul};
use enum_iterator::Sequence;
use palette::Oklch;
use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
use strum::Display;
use wasm_bindgen::{prelude::wasm_bindgen, JsError, JsValue};
@@ -104,7 +105,7 @@ pub struct SchemeSetting {
pub wacg_follows: WACGSetting,
}
#[derive(Debug, Clone, Copy, Display, Sequence, Serialize, Deserialize)]
#[derive(Debug, Clone, Copy, Display, Sequence, Serialize_repr, Deserialize_repr)]
#[wasm_bindgen]
#[repr(u8)]
pub enum ColorExpand {
@@ -131,7 +132,7 @@ impl ColorExpand {
}
}
#[derive(Debug, Clone, Copy, Display, Sequence, Serialize, Deserialize)]
#[derive(Debug, Clone, Copy, Display, Sequence, Serialize_repr, Deserialize_repr)]
#[wasm_bindgen]
#[repr(u8)]
pub enum WACGSetting {