纠正颜色对比时相减的操作顺序。
This commit is contained in:
parent
44023fed29
commit
a980db505b
|
@ -16,9 +16,9 @@ impl ColorDifference for Cam16Jch<f32> {
|
|||
type Difference = HctDiffference;
|
||||
|
||||
fn difference(&self, other: &Self) -> Self::Difference {
|
||||
let hue = self.hue.into_positive_degrees() - other.hue.into_positive_degrees();
|
||||
let chroma = self.chroma - other.chroma;
|
||||
let lightness = self.lightness - other.lightness;
|
||||
let hue = other.hue.into_positive_degrees() - self.hue.into_positive_degrees();
|
||||
let chroma = other.chroma - self.chroma;
|
||||
let lightness = other.lightness - self.lightness;
|
||||
|
||||
HctDiffference {
|
||||
hue: Differ {
|
||||
|
|
|
@ -16,9 +16,9 @@ impl ColorDifference for Hsl {
|
|||
type Difference = HSLDifference;
|
||||
|
||||
fn difference(&self, other: &Self) -> Self::Difference {
|
||||
let hue = self.hue.into_positive_degrees() - other.hue.into_positive_degrees();
|
||||
let saturation = self.saturation - other.saturation;
|
||||
let lightness = self.lightness - other.lightness;
|
||||
let hue = other.hue.into_positive_degrees() - self.hue.into_positive_degrees();
|
||||
let saturation = other.saturation - self.saturation;
|
||||
let lightness = other.lightness - self.lightness;
|
||||
|
||||
HSLDifference {
|
||||
hue: Differ {
|
||||
|
|
|
@ -16,9 +16,9 @@ impl ColorDifference for Oklch {
|
|||
type Difference = OklchDifference;
|
||||
|
||||
fn difference(&self, other: &Self) -> Self::Difference {
|
||||
let hue = self.hue.into_positive_degrees() - other.hue.into_positive_degrees();
|
||||
let chroma = self.chroma - other.chroma;
|
||||
let lightness = self.l - other.l;
|
||||
let hue = other.hue.into_positive_degrees() - self.hue.into_positive_degrees();
|
||||
let chroma = other.chroma - self.chroma;
|
||||
let lightness = other.l - self.l;
|
||||
|
||||
OklchDifference {
|
||||
hue: Differ {
|
||||
|
|
|
@ -16,9 +16,9 @@ impl ColorDifference for Srgb {
|
|||
type Difference = RGBDifference;
|
||||
|
||||
fn difference(&self, other: &Self) -> Self::Difference {
|
||||
let r = self.red - other.red;
|
||||
let g = self.green - other.green;
|
||||
let b = self.blue - other.blue;
|
||||
let r = other.red - self.red;
|
||||
let g = other.green - self.green;
|
||||
let b = other.blue - self.blue;
|
||||
|
||||
RGBDifference {
|
||||
r: Differ {
|
||||
|
|
Loading…
Reference in New Issue
Block a user