Example #1
0
        public ColorD GetColor(double index, double maximum)
        {
            double z = index / maximum;

            GradientColour(z, Grad, out double r, out double g, out double b, out double a);
            return(ColorD.FromArgb(a, r, g, b));
        }
Example #2
0
        static ColorD FindColorFromRange(double min, double max, double val)
        {
            //iterate HSL L=[0 to 1] S=1 H[0 to 360]
            double range    = max - min;
            double spacemax = 256.0 * 360.0;             //L * H
            double pos      = (val - min) / range * spacemax;

            //basically map 2D HxL space into one dimension
            double s = 1.0;
            //double l = (pos / spacemax) * 0.9 + 0.05; //clip the edges by 5%
            double l = pos / spacemax;
            double h = (pos % (360.0 * 4)) / (360.0 * 4);             //4 slows down the cycle 4x

            ColorHelpers.HSLToRGB(h, s, l, out double r, out double g, out double b);
            return(ColorD.FromArgb(1.0, r, g, b));
        }
Example #3
0
        public ColorD GetColor(double index, double maximum)
        {
            double pct = Math.Log(1 + index) / Math.Log(1 + maximum);

            return(ColorD.FromArgb(1.0, pct, pct, pct));
        }