public static string GetColorClass(this TablerColor colors, string type, TablerColorType colorType = TablerColorType.Default, string suffix = "") { var colorClass = $"{type}"; colorClass += colorType switch { TablerColorType.Default => "", _ => $"-{Enum.GetName(typeof(TablerColorType), colorType)?.ToLower()}" }; colorClass = colors switch { TablerColor.Default => "", TablerColor.GrayDark => $"{colorClass}-gray-dark", _ => $"{colorClass}-{Enum.GetName(typeof(TablerColor), colors)?.ToLower()}" }; if (!string.IsNullOrWhiteSpace(suffix) && !string.IsNullOrWhiteSpace(colorClass)) { colorClass += $"-{suffix}"; } return(colorClass); } } }
public static string GetColorClass(this TablerColor color, string type, ColorType colorType = ColorType.Default, string suffix = "") { var colorClass = $"{type}"; colorClass += colorType switch { ColorType.Default => "", _ => $"-{Enum.GetName(typeof(ColorType), colorType)?.ToLower()}" }; colorClass = color switch { TablerColor.Default => "", //TablerColor.GrayDark => $"{colorClass}-gray-dark", _ => $"{colorClass}-{Enum.GetName(typeof(TablerColor), color)?.ToLower()}" }; if (color != TablerColor.Light && colorClass.ToLower().EndsWith("light")) { colorClass = colorClass.Replace("light", "-lt", StringComparison.InvariantCultureIgnoreCase); } if (!string.IsNullOrWhiteSpace(suffix) && !string.IsNullOrWhiteSpace(colorClass)) { colorClass += $"-{suffix}"; } return(colorClass); } } }
protected string StatusClassNames(string position, TablerColor color) { return(ClassBuilder .Add($"card-status-{position}") .Add(color.GetColorClass("bg")) .ToString()); }