public bool Equals(ColorRandomizer other)
 {
     return(BaseColor.Equals(other.BaseColor) &&
            HueRange.Equals(other.HueRange) &&
            SaturationRange.Equals(other.SaturationRange) &&
            ValueRange.Equals(other.ValueRange));
 }
        public override int GetHashCode()
        {
            var hashCode = 1165054906;

            hashCode = hashCode * -1521134295 + BaseColor.GetHashCode();
            hashCode = hashCode * -1521134295 + HueRange.GetHashCode();
            hashCode = hashCode * -1521134295 + SaturationRange.GetHashCode();
            hashCode = hashCode * -1521134295 + ValueRange.GetHashCode();
            return(hashCode);
        }
Example #3
0
        public double InRangeFactor(Color color)
        {
            double result = 1.0;

            result *= RedRange?.InRangeFactor(color.Red) ?? 1;
            result *= GreenRange?.InRangeFactor(color.Green) ?? 1;
            result *= BlueRange?.InRangeFactor(color.Blue) ?? 1;
            result *= LightnessRange?.InRangeFactor(color.Lightness) ?? 1;
            result *= SaturationRange?.InRangeFactor(color.Saturation) ?? 1;
            result *= HueRange?.InRangeFactor(color.Hue) ?? 1;
            result *= ValueRange?.InRangeFactor(color.Value) ?? 1;
            result *= BrightnessRange?.InRangeFactor(color.GetBrightness()) ?? 1;
            return(result);
        }