Esempio n. 1
0
        private static void AddSurfaceCaption(ICollection <SurfaceCaptions> themeItems, string title, string caption, Color captionColor,
                                              Color backgroundColor, SurfaceCaption errorCaption)
        {
            var surfaceCaption = new SurfaceCaptions(
                title,
                CreateGeneralCaptions(caption, captionColor, backgroundColor)
                .Concat(new[] { errorCaption })
                .ToList()
                );

            themeItems.Add(surfaceCaption);
        }
Esempio n. 2
0
        private static void PopulateSurfaceCaptions(ICollection <SurfaceCaptions> themeItems, IThemeColors themeColors, ElevationLevel elevation)
        {
            var errorCaption = new SurfaceCaption
            {
                Caption            = "Sample Error Text",
                CaptionColor       = themeColors.OnError,
                BackgroundColor    = themeColors.Error,
                ContrastRatio      = ColorHelper.GetContrastRatio(themeColors.OnError, themeColors.Error),
                ContrastRatioColor = themeColors.OnError
            };

            var surfaceElevation = new SurfaceElevation(themeColors, elevation);

            AddSurfaceCaption(themeItems, $"Default Surface at {elevation}", "OnSurface Text", themeColors.OnSurface, surfaceElevation.SurfaceColor, errorCaption);
            AddSurfaceCaption(themeItems, $"Default Surface at {elevation}", "Branded Text", themeColors.Primary, surfaceElevation.SurfaceColor, errorCaption);
            AddSurfaceCaption(themeItems, $"Branded Surface at {elevation}", "OnSurface Text", themeColors.OnSurface, surfaceElevation.BrandedSurfaceColor, errorCaption);
            AddSurfaceCaption(themeItems, $"Branded Surface at {elevation}", "Branded Text", themeColors.Primary, surfaceElevation.BrandedSurfaceColor, errorCaption);
        }