You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: palette/src/color_difference.rs
+76-14
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,13 @@
2
2
//!
3
3
//! ## Selecting an algorithm
4
4
//!
5
-
//! Different distance/difference algorithms and formulae are good for different
5
+
//! Different distance/difference algorithms and formulas are good for different
6
6
//! situations. Some are faster but less accurate and some may only be suitable
7
7
//! for certain color spaces. This table may help navigating the options a bit
8
8
//! by summarizing the difference between the traits in this module.
9
9
//!
10
-
//! **Disclaimer:** _This is not an actual benchmark! It's always best to test and
11
-
//! evaluate the differences in an actual application, when possible._
10
+
//! **Disclaimer:** _This is not an actual benchmark! It's always best to test
11
+
//! and evaluate the differences in an actual application, when possible._
12
12
//!
13
13
//! Property explanations:
14
14
//! - **Complexity:** Low complexity options are generally faster than high
@@ -19,18 +19,22 @@
19
19
//! | Trait | Complexity | Accuracy | Notes |
20
20
//! |-------|------------|----------|-------|
21
21
//! | [`Ciede2000`] | High | High for small differences, lower for large differences | The de-facto standard, but requires complex calculations to compensate for increased errors in certain areas of the CIE L\*a\*b\* (CIELAB) space.
22
+
//! | [`ImprovedCiede2000`] | High | High for small differences, lower for large differences | A general improvement of [`Ciede2000`], using a formula by Huang et al.
23
+
//! | [`DeltaE`] | Usually low | Medium to high | The formula differs between color spaces and may not always be the best. Other formulas, such as [`Ciede2000`], may be preferred for some spaces.
24
+
//! | [`ImprovedDeltaE`] | Usually low | Medium to high | A general improvement of [`DeltaE`], using a formula by Huang et al.
22
25
//! | [`EuclideanDistance`] | Low | Medium to high for perceptually uniform spaces, otherwise low | Can be good enough for perceptually uniform spaces or as a "quick and dirty" check.
23
26
//! | [`HyAb`] | Low | High accuracy for medium to large differences. Less accurate than CIEDE2000 for small differences, but still performs well and is much less computationally expensive. | Similar to Euclidean distance, but separates lightness and chroma more. Limited to Cartesian spaces with a lightness axis and a chroma plane.
24
27
//! | [`Wcag21RelativeContrast`] | Low | Low and only compares lightness | Meant for checking contrasts in computer graphics (such as between text and background colors), assuming sRGB. Mostly useful as a hint or for checking WCAG 2.1 compliance, considering the criticism it has received.
0 commit comments