public static AlertPalette ToPaletteColor(AlertPaletteConfig config)
        {
            var tonalOffset = config.TonalOffset ?? 0.2m;

            var contrastThreshold = config.ContrastThreshold ?? 3;

            return(new AlertPalette
            {
                Success = PaletteFactory.AugmentColor(config.Success ?? new PaletteColorConfig
                {
                    Light = PaletteColors.Green.X300,

                    Main = PaletteColors.Green.X500,

                    Dark = PaletteColors.Green.X700
                }, tonalOffset, contrastThreshold),

                Warning = PaletteFactory.AugmentColor(config.Warning ?? new PaletteColorConfig
                {
                    Light = PaletteColors.Orange.X300,

                    Main = PaletteColors.Orange.X500,

                    Dark = PaletteColors.Orange.X700
                }, tonalOffset, contrastThreshold),

                Info = PaletteFactory.AugmentColor(config.Info ?? new PaletteColorConfig
                {
                    Light = PaletteColors.Blue.X300,

                    Main = PaletteColors.Blue.X500,

                    Dark = PaletteColors.Blue.X700
                }, tonalOffset, contrastThreshold),
            });
        }
        // TODO: would be removed once integrated with Material.Component
        public AlertStyleProducer(AlertPaletteConfig light, AlertPaletteConfig dark)
        {
            Light = ToPaletteColor(light ?? new AlertPaletteConfig());

            Dark = ToPaletteColor(dark ?? new AlertPaletteConfig());
        }
Beispiel #3
0
        public static void TryAddAlertServices(this IServiceCollection services, IMaterialConfig config, AlertPaletteConfig light = null, AlertPaletteConfig dark = null)
        {
            services.TryAddButtonServices(config);

            services.TryAddIconServices(config);

            services.TryAddPaperServices(config);

            services.TryAddTypographyServices(config);

            services.TryAddStyleTypeProvider <AlertStyleProvider>();

            // services.TryAddStyleProducer<AlertStyleProducer>();

            // TODO: would be removed once integrated with Material.Component
            services.TryAddStyleProducer <AlertStyleProducer>(sp => new AlertStyleProducer(light, dark));
        }