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:
0HyperCube
2021-05-07 02:47:34 -07:00
committed by Keavon Chambers
parent 9ffbb4ce39
commit c04a0227f1
26 changed files with 689 additions and 407 deletions
+2 -2
View File
@@ -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()),
}
}
}