diff --git a/color-module/src/schemes/q_style/mod.rs b/color-module/src/schemes/q_style/mod.rs index df027ca..f204a45 100644 --- a/color-module/src/schemes/q_style/mod.rs +++ b/color-module/src/schemes/q_style/mod.rs @@ -4,7 +4,7 @@ use baseline::Baseline; use linked_hash_set::LinkedHashSet; use palette::FromColor; use serde::Serialize; -use wasm_bindgen::{prelude::wasm_bindgen, JsValue}; +use wasm_bindgen::{JsValue, prelude::wasm_bindgen}; use crate::{errors, parse_option_to_oklch, parse_to_oklch}; @@ -16,7 +16,7 @@ mod neutral_swatch; mod scheme_setting; pub use neutral_swatch::NeutralSwatch; -pub use scheme_setting::{ColorExpand, ColorShifting, SchemeSetting, WACGSetting}; +pub use scheme_setting::{ColorExpand, ColorShifting, SchemeSelect, SchemeSetting, WACGSetting}; #[derive(Debug, Clone, Serialize)] pub struct QScheme { @@ -221,6 +221,20 @@ pub fn q_scheme_wacg_settings() -> Result { serde_wasm_bindgen::to_value(&settings).map_err(|e| e.to_string()) } +#[wasm_bindgen] +pub fn q_scheme_select_options() -> Result { + let options = enum_iterator::all::() + .map(|option| { + serde_json::json!({ + "label": option.label(), + "value": option as u8, + }) + }) + .collect::>(); + + serde_wasm_bindgen::to_value(&options).map_err(|e| e.to_string()) +} + #[wasm_bindgen] pub fn q_scheme_default_settings() -> SchemeSetting { SchemeSetting::default()