public bool ValidateColor(LabColor color) { var hcl = color.ToHcl(); return((hcl.H >= this.HueMin) && (hcl.H <= this.HueMin) && (hcl.C >= this.ChromaMin) && (hcl.C <= this.ChromaMax) && (hcl.L >= this.LightMin) && (hcl.L <= this.LightMax)); }
private static bool CheckColor(LabColor color, PaletteOptions options) { var rgb = color.ToRgb(); var hcl = color.ToHcl(); var compLab = rgb.ToLab(); var labTolerance = 7; return( hcl.H >= options.HueMin && hcl.H <= options.HueMax && hcl.C >= options.ChromaMin && hcl.C <= options.ChromaMax && hcl.L >= options.LightMin && hcl.L <= options.LightMax && compLab.L >= (color.L - labTolerance) && compLab.L <= (color.L + labTolerance) && compLab.A >= (color.A - labTolerance) && compLab.A <= (color.A + labTolerance) && compLab.B >= (color.B - labTolerance) && compLab.B <= (color.B + labTolerance) ); }