Example #1
0
        /// <summary>
        /// The to hex string.
        /// </summary>
        /// <param name="color">
        /// The color.
        /// </param>
        /// <param name="includeAlpha">
        /// The include alpha.
        /// </param>
        /// <returns>
        /// Color as hex string.
        /// </returns>
        public static string ToHexString(this Color color, bool includeAlpha)
        {
            var result = $"#{color.ToHex()}";

            return(includeAlpha ? result : result[0..6]);
Example #2
0
 public static System.Drawing.Color ToSysDrawingColor(this SixLabors.ImageSharp.Color color)
 => System.Drawing.ColorTranslator.FromHtml("#" + color.ToHex().Substring(0, 6));