/// <summary>
        /// Sets the background color of the barcode.
        /// </summary>
        /// <param name="color">The background color.</param>
        public void SetBackgroundColor(BCGColor color)
        {
            this.colorBg = color;

            foreach (var label in this.labels)
            {
                label.SetBackgroundColor(this.colorBg);
            }
        }
 /// <summary>
 /// Saves RGB value into the classes.
 /// Given 1 parameter string hex value (#ff0000) (preceding with #), or
 /// Given 1 parameter string color code(white, black, orange...)
 /// </summary>
 /// <param name="color">The color.</param>
 public BCGColor(string color)
 {
     if (!string.IsNullOrEmpty(color))
     {
         if (color.Length == 7 && color.StartsWith("#", StringComparison.Ordinal))
         {
             this.vR = Int16.Parse(color.Substring(1, 2), System.Globalization.NumberStyles.AllowHexSpecifier, CultureInfo.CurrentCulture);
             this.vG = Int16.Parse(color.Substring(3, 2), System.Globalization.NumberStyles.AllowHexSpecifier, CultureInfo.CurrentCulture);
             this.vB = Int16.Parse(color.Substring(5, 2), System.Globalization.NumberStyles.AllowHexSpecifier, CultureInfo.CurrentCulture);
         }
         else
         {
             ParseHex(BCGColor.GetColor(color));
         }
     }
     else
     {
         ParseHex(0);
     }
 }
 /// <summary>
 /// Returns class of <see cref="BCGColor"/> depending of the string color.
 ///
 /// If the color doens't exist, it defaults to <paramref name="defaultColor"/>.
 /// </summary>
 /// <param name="color">The color name.</param>
 /// <param name="defaultColor">The default color name.</param>
 /// <returns>The color.</returns>
 public static int GetColor(string color, string defaultColor)
 {
     return((color.ToLower(CultureInfo.CurrentCulture)) switch
     {
         "" or "white" => 0xffffff,
         "black" => 0x000000,
         "maroon" => 0x800000,
         "red" => 0xff0000,
         "orange" => 0xffa500,
         "yellow" => 0xffff00,
         "olive" => 0x808000,
         "purple" => 0x800080,
         "fuchsia" => 0xff00ff,
         "lime" => 0x00ff00,
         "green" => 0x008000,
         "navy" => 0x000080,
         "blue" => 0x0000ff,
         "aqua" => 0x00ffff,
         "teal" => 0x008080,
         "silver" => 0xc0c0c0,
         "gray" => 0x808080,
         _ => BCGColor.GetColor(defaultColor, "white"),
     });
        // TODO, handle the exception here, throw something ourselves if the font does not exist.
        /// <summary>
        /// Cosntructor.
        /// </summary>
        /// <param name="pathOrFontFamily">Font Family or path to a font family.</param>
        /// <param name="size">The text size.</param>
        public BCGFont(string pathOrFontFamily, int size)
        {
            var typeFace = SKTypeface.FromFamilyName(pathOrFontFamily);

            if (typeFace == null && File.Exists(pathOrFontFamily))
            {
                typeFace = SKTypeface.FromFile(pathOrFontFamily);
            }

            if (typeFace == null)
            {
                throw new Exception();
            }

            font = new SKPaint
            {
                Typeface    = typeFace,
                TextSize    = size,
                IsAntialias = true
            };
            foregroundColor = new BCGColor("black");
            text            = string.Empty;
        }
 /// <summary>
 /// Returns class of <see cref="BCGColor"/> depending of the string color.
 ///
 /// If the color doens't exist, it defaults to white.
 /// </summary>
 /// <param name="color">The color name.</param>
 /// <returns>The color.</returns>
 public static int GetColor(string color)
 {
     return(BCGColor.GetColor(color, "white"));
 }
 /// <summary>
 /// Sets the foreground color of the barcode.
 /// </summary>
 /// <param name="color">The foreground color.</param>
 public void SetForegroundColor(BCGColor color)
 {
     this.colorFg = color;
 }
 /// <summary>
 /// Sets the foreground and background color.
 /// </summary>
 /// <param name="foregroundColor">The foreground color.</param>
 /// <param name="backgroundColor">The background color.</param>
 public void SetColor(BCGColor foregroundColor, BCGColor backgroundColor)
 {
     this.SetForegroundColor(foregroundColor);
     this.SetBackgroundColor(backgroundColor);
 }
 /**
  * Sets the foreground color.
  *
  * @param BCGColor $foregroundColor
  */
 public void SetForegroundColor(BCGColor foregroundColor)
 {
     this.foregroundColor = foregroundColor;
     this.font.SetForegroundColor(this.foregroundColor);
 }
 /**
  * Sets the background color in case of rotation.
  *
  * @param BCGColor $backgroundColor
  */
 public /*internal*/ void SetBackgroundColor(BCGColor backgroundColor)
 {
     this.backgroundColor = backgroundColor;
     this.font.SetBackgroundColor(this.backgroundColor);
 }
 /**
  * Sets the background color.
  *
  * @param BCGColor $backgroundColor
  */
 public void SetBackgroundColor(BCGColor backgroundColor)
 {
 }