feat(serializer): 添加将Oklch颜色序列化为十六进制字符串的功能

This commit is contained in:
徐涛 2025-07-20 07:24:55 +08:00
parent a77fb3f18b
commit f82575c49b

View File

@ -0,0 +1,12 @@
use palette::Oklch;
use serde::Serializer;
use crate::convert::map_oklch_to_srgb_hex;
pub fn serialize_oklch_to_hex<S>(color: &Oklch, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let hex_color = map_oklch_to_srgb_hex(color);
serializer.serialize_str(&hex_color)
}