mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-20 23:18:13 +08:00
Add colors in Rust (#78)
* 🎨 Add colors in Rust * 🌿 Use an option for the properties and #[repr(C)] * ❌ Remove WASM dependency on document. * 😎 Wrap Fill and stroke in a style struct. * 📦 Use crate::Color * Merge Add transactions for temporary modifications to the document * Run cargo fmt * Color without a 'U'
This commit is contained in:
committed by
Keavon Chambers
parent
2849b99b59
commit
46c9ef02ca
@@ -12,8 +12,8 @@ impl Color {
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new(red: f32, green: f32, blue: f32, alpha: f32) -> Result<Color, JsValue> {
|
||||
match InnerColor::from_rgbaf32(red, green, blue, alpha) {
|
||||
Ok(v) => Ok(Self(v)),
|
||||
Err(e) => Err(Error::new(&e.to_string()).into()),
|
||||
Some(v) => Ok(Self(v)),
|
||||
None => Err(Error::new("invalid color").into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user