// constructor - takes a Color
        public LABColor(Color col)
        {
            LABColor temp = FromColor(col);

            l = temp.l;
            a = temp.a;
            b = temp.b;
        }
        // static function for interpolation between two Unity Colors through normalized colorspace
        public static Color Lerp(Color ca, Color cb, float t)
        {
            LABColor a = LABColor.FromColor(ca);
            LABColor b = LABColor.FromColor(cb);

            float al = a.l;
            float aa = a.a;
            float ab = a.b;
            float bl = b.l - al;
            float ba = b.a - aa;
            float bb = b.b - ab;

            LABColor ret = new LABColor(al + bl * t, aa + ba * t, ab + bb * t);

            return(ret.ToColor());
        }
        // static function for converting from LABColor to Color
        public static Color ToColor(LABColor lab)
        {
            float y = (lab.l + 16f) / 116f;
            float x = y + lab.a / 500f;
            float z = y - lab.b / 200f;

            x = d3_lab_xyz(x) * d3_lab_X;
            y = d3_lab_xyz(y) * d3_lab_Y;
            z = d3_lab_xyz(z) * d3_lab_Z;


            return(Color.FromArgb(
                       255,
                       (byte)d3_xyz_rgb(3.2404542f * x - 1.5371385f * y - 0.4985314f * z),
                       (byte)d3_xyz_rgb(-0.9692660f * x + 1.8760108f * y + 0.0415560f * z),
                       (byte)d3_xyz_rgb(0.0556434f * x - 0.2040259f * y + 1.0572252f * z)
                       ));
        }
 // static function for returning the color difference in a normalized colorspace (Delta-E)
 public static float Distance(LABColor a, LABColor b)
 {
     return((float)Math.Sqrt((float)Math.Pow((a.l - b.l), 2f) + (float)Math.Pow((a.a - b.a), 2f) + (float)Math.Pow((a.b - b.b), 2f)));
 }
 // static function for linear interpolation between two LABColors
 public static LABColor Lerp(LABColor a, LABColor b, float t)
 {
     return(new LABColor(LABColor.Lerp(a.l, b.l, t), LABColor.Lerp(a.a, b.a, t), LABColor.Lerp(a.b, b.b, t)));
 }
 // function for converting an instance of LABColor to Color
 public Color ToColor()
 {
     return(LABColor.ToColor(this));
 }