using GGJ.Models;
using UnityEngine;

namespace GGJ
{
    public static class Utils
    {
        public static Color NextColor(Color previous, LightProperties props, Color filterColor)
        {
            if (props == LightProperties.Normal)
            {
                return previous;
            }
            return previous * filterColor;
        }

        public static bool IsColorSimilar(Color color, Color expected, float threshold)
        {
            var max = expected + new Color(threshold, threshold, threshold, threshold);
            var min = expected - new Color(threshold, threshold, threshold, threshold);
            return color.r > min.r && color.r < max.r &&
                   color.g > min.g && color.g < max.g &&
                   color.b > min.b && color.b < max.b;
        }
    }
}