public static PaletteColor AugmentColor(PaletteColorConfig color, Func <PaletteColorConfig, string> mainShade, Func <PaletteColorConfig, string> lightShade, Func <PaletteColorConfig, string> darkShade, decimal tonalOffset = 0.2m, decimal contrastThreshold = 3) { var main = color.Main ?? mainShade(color); var light = color.Light ?? lightShade(color) ?? main.Lighten(tonalOffset); var dark = color.Dark ?? darkShade(color) ?? main.Darken(tonalOffset * 1.5m); var contrastText = color.ContrastText ?? main.ToContrastText(contrastThreshold); var custom = color.Custom ?? new Dictionary <string, string>(); return(new PaletteColor { Main = main, Light = light, Dark = dark, ContrastText = contrastText, Custom = custom, }); }
public PaletteColorConfig(PaletteColorConfig color) : base(color) { Main = color.Main; Light = color.Light; Dark = color.Dark; ContrastText = color.ContrastText; }
public static PaletteColor AugmentColor(PaletteColorConfig colorConfig, decimal tonalOffset = 0.2m, decimal contrastThreshold = 3) { return(AugmentColor(colorConfig, p => p.X500, p => p.X300, p => p.X700, tonalOffset, contrastThreshold)); }