示例#1
0
        public static string ColorToString(SharpDX.Color4 color)
        {
            var rgba = color.ToRgba();
            var r    = (rgba) & 255;
            var g    = (rgba >> 8) & 255;
            var b    = (rgba >> 16) & 255;
            var hex  = $"#{r:X2}{g:X2}{b:X2}";

            return(hex);
        }
示例#2
0
 /// <summary>
 /// Creates a color formatter
 /// </summary>
 /// <param name="color">Initial color</param>
 /// <returns>Color formatter</returns>
 public ColorRGBA CreateColor(ref SharpDX.Color4 color)
 {
     return(this.CreateColor(color.ToRgba()));
 }