private ExcelColor ToExcelColor([CanBeNull] ColorType color) { if (color == null) { return(null); } if (color.Rgb?.HasValue == true) { return(RgbStringToExcelColor(color.Rgb.Value)); } if (color.Theme?.HasValue == true) { var theme = color.Theme.Value; var tint = color.Tint?.Value ?? 0; return(ThemeToExcelColor(theme, tint)); } return(null); }
private static void MapColor(OpenXml.ColorType destination, Color origin) { destination.Rgb = origin.Argb; if (origin.Auto.HasValue) { destination.Auto = origin.Auto.Value; } if (origin.Indexed.HasValue) { destination.Indexed = origin.Indexed.Value; } if (origin.Theme.HasValue) { destination.Theme = origin.Theme.Value; } if (origin.Tint.HasValue) { destination.Tint = origin.Tint.Value; } }