- use css colors to convert color names into rgb values
This commit is contained in:
11
src/py.rs
11
src/py.rs
@@ -183,7 +183,7 @@ impl PyIJTiffFile {
|
||||
return Err(PyValueError::new_err(format!(
|
||||
"Unknown compression {}",
|
||||
compression
|
||||
)))
|
||||
)));
|
||||
}
|
||||
};
|
||||
if let Some(ref mut ijtifffile) = self.ijtifffile {
|
||||
@@ -203,14 +203,9 @@ impl PyIJTiffFile {
|
||||
}
|
||||
|
||||
#[setter]
|
||||
fn set_colors(&mut self, colors: PyReadonlyArray2<u8>) -> PyResult<()> {
|
||||
fn set_colors(&mut self, colors: Vec<String>) -> PyResult<()> {
|
||||
if let Some(ijtifffile) = &mut self.ijtifffile {
|
||||
let a = colors.to_owned_array();
|
||||
ijtifffile.colors = Colors::Colors(
|
||||
(0..a.shape()[0])
|
||||
.map(|i| Vec::from(a.slice(s![i, ..]).as_slice().unwrap()))
|
||||
.collect(),
|
||||
);
|
||||
ijtifffile.set_colors(&colors)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user