symcode_webapp/helper.rs
1use visioncortex::ColorHsv;
2
3/// Check Saturation and Value in HSV
4pub(crate) fn is_black_hsv(color: &ColorHsv) -> bool {
5 const BLACK_LIMIT: f64 = 0.125;
6 //console_log_util(&format!("{:?}", color));
7 if color.s != 0.0 && color.v != 0.0 {
8 color.s*color.v <= BLACK_LIMIT
9 } else { // Either s or v is 0.0
10 (if color.s > 0.0 {color.s} else {color.v}) <= BLACK_LIMIT
11 }
12}