Example #1
0
        public override string ToString()
        {
            return(String.Format(
                       @"RGBA (Red, Green, Blue, Alpha) = {0}, {1}, {2}, {3}
HSB (Hue, Saturation, Brightness) = {4:0.0}°, {5:0.0}%, {6:0.0}%
CMYK (Cyan, Magenta, Yellow, Key) = {7:0.0}%, {8:0.0}%, {9:0.0}%, {10:0.0}%
Hex (RGB, RGBA, ARGB) = #{11}, #{12}, #{13}
Decimal (RGB, RGBA, ARGB) = {14}, {15}, {16}",
                       RGBA.Red, RGBA.Green, RGBA.Blue, RGBA.Alpha,
                       HSB.Hue360, HSB.Saturation100, HSB.Brightness100,
                       CMYK.Cyan100, CMYK.Magenta100, CMYK.Yellow100, CMYK.Key100,
                       ColorHelpers.ColorToHex(this), ColorHelpers.ColorToHex(this, ColorFormat.RGBA), ColorHelpers.ColorToHex(this, ColorFormat.ARGB),
                       ColorHelpers.ColorToDecimal(this), ColorHelpers.ColorToDecimal(this, ColorFormat.RGBA), ColorHelpers.ColorToDecimal(this, ColorFormat.ARGB)));
        }
Example #2
0
        private void UpdateControls(MyColor color, ColorType type)
        {
            DrawPreviewColors();
            controlChangingColor = true;

            if (type != ColorType.HSB)
            {
                nudHue.Value        = (decimal)Math.Round(color.HSB.Hue360);
                nudSaturation.Value = (decimal)Math.Round(color.HSB.Saturation100);
                nudBrightness.Value = (decimal)Math.Round(color.HSB.Brightness100);
            }

            if (type != ColorType.RGBA)
            {
                nudRed.Value   = color.RGBA.Red;
                nudGreen.Value = color.RGBA.Green;
                nudBlue.Value  = color.RGBA.Blue;
                nudAlpha.Value = color.RGBA.Alpha;
            }

            if (type != ColorType.CMYK)
            {
                nudCyan.Value    = (decimal)color.CMYK.Cyan100;
                nudMagenta.Value = (decimal)color.CMYK.Magenta100;
                nudYellow.Value  = (decimal)color.CMYK.Yellow100;
                nudKey.Value     = (decimal)color.CMYK.Key100;
            }

            if (type != ColorType.Hex)
            {
                txtHex.Text = ColorHelpers.ColorToHex(color);
            }

            if (type != ColorType.Decimal)
            {
                txtDecimal.Text = ColorHelpers.ColorToDecimal(color).ToString();
            }

            controlChangingColor = false;
        }
Example #3
0
 public int ToDecimal(ColorFormat format = ColorFormat.RGB)
 {
     return(ColorHelpers.ColorToDecimal(this, format));
 }