public static Swatch?GetCurrentSwatch(this PaletteHelper self) { ITheme theme = self.GetTheme(); foreach (Swatch swatch in self.GetSwatches()) { if (theme.PrimaryMid.Color == swatch.ExemplarHue.Color && theme.SecondaryMid.Color == swatch.AccentExemplarHue?.Color) { return(swatch); } } return(null); }
public static void Apply(this PaletteHelper self, Swatch swatch, bool dark) { ITheme theme = self.GetTheme(); theme.SetBaseTheme(dark ? Theme.Dark : Theme.Light); if (swatch != null) { theme.SetPrimaryColor(swatch.ExemplarHue.Color); if (swatch.AccentExemplarHue != null) { theme.SetSecondaryColor(swatch.AccentExemplarHue.Color); } } self.SetTheme(theme); }
public static bool IsDark(this PaletteHelper self) { ITheme theme = self.GetTheme(); return(theme.Background == Theme.Dark.MaterialDesignBackground); }