TailBlazer.Views.Formatting.ColourProvider.GetAccent C# (CSharp) Method

GetAccent() public method

public GetAccent ( Theme theme ) : TailBlazer.Domain.Formatting.Hue
theme Theme
return TailBlazer.Domain.Formatting.Hue
        public Hue GetAccent(Theme theme)
        {
            var colour = theme.GetAccentColor();
            var swatch = Swatches.Lookup(colour);

            return swatch.Convert(s=> new Hue(s.Name, s.AccentExemplarHue.Name, s.AccentExemplarHue.Foreground, s.AccentExemplarHue.Color))
                        .ValueOrThrow(()=> new ArgumentOutOfRangeException(colour));
        }

Usage Example

        public void ColourProviderGetAccentShouldSupportAllThemes()
        {
            var provider = new ColourProvider();

            foreach (var theme in Enum.GetValues(typeof(Theme)))
            {
                provider.GetAccent((Theme)theme).Should().NotBeNull();
            }
        }