Exemple #1
0
 public static SKColor ToSKColor(IColor color)
 {
     return(color switch
     {
         IArgbColor argbColor => new SKColor(argbColor.R, argbColor.G, argbColor.B, argbColor.A),
         _ => throw new NotSupportedException($"The {color.GetType()} color type is not supported."),
     });
Exemple #2
0
 public CStyleApplier SetFont(string fontName, short size, IArgbColor color)
 {
     Font.FontName  = fontName;
     Font.FontSize  = size;
     Font.FontColor = color;
     return(this);
 }
Exemple #3
0
 public static XSSFColor GetXSSFColor(IArgbColor color)
 {
     if (color.Alpha == 0)
     {
         return(null);
     }
     return(new XSSFColor(new[] { color.Red, color.Green, color.Blue }));
 }
Exemple #4
0
 private SolidColorBrush ToSolidColorBrush(IArgbColor color)
 {
     if (color == null)
     {
         throw new ArgumentNullException("color");
     }
     return(new SolidColorBrush(Color.FromArgb(color.Alpha, color.Red, color.Green, color.Blue)));
 }
Exemple #5
0
 /// <summary>
 /// Clones color.
 /// </summary>
 /// <param name="argbColor">The argb color to clone.</param>
 /// <returns>The new instance of the <see cref="ArgbColor"/> class.</returns>
 public static IArgbColor Clone(this IArgbColor argbColor)
 {
     return(new ArgbColor()
     {
         A = argbColor.A,
         R = argbColor.R,
         G = argbColor.G,
         B = argbColor.B
     });
 }
Exemple #6
0
        public CStyleApplier CellColor(IArgbColor foregroundColor, IArgbColor backgroundColor, FillPattern pattern)
        {
            FillForegroundColor = foregroundColor;
            FillBackgroundColor = backgroundColor;

            if (ExcelColor.GetIndex(foregroundColor) == ExcelColor.AutomaticIndex &&
                ExcelColor.GetIndex(backgroundColor) == ExcelColor.AutomaticIndex)
            {
                FillPattern = FillPattern.NoFill;
            }
            else
            {
                FillPattern = pattern;
            }

            return(this);
        }
Exemple #7
0
 public CStyleApplier CellColor(IArgbColor foregroundColor) => CellColor(foregroundColor, ExcelColor.Automatic, FillPattern.SolidForeground);
Exemple #8
0
 public static AM.Color ToColor(IArgbColor argbColor)
 {
     return(AM.Color.FromArgb(argbColor.A, argbColor.R, argbColor.G, argbColor.B));
 }