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