Exemplo n.º 1
0
        public ThemeSetterJob(ISetting<GeneralOptions> setting, ISchedulerProvider schedulerProvider)
        {
            _cleanUp =  setting.Value.Select(options => options.Theme)
                .ObserveOn(schedulerProvider.MainThread)
                .Subscribe(theme =>
                {
                    var dark = theme == Theme.Dark;
                    var paletteHelper = new PaletteHelper();

                    paletteHelper.SetLightDark(dark);
                    paletteHelper.ReplaceAccentColor(theme.GetAccentColor());

                });
        }
        /// <summary>
        /// Set material design color
        /// </summary>
        private void SetMaterialDesignAccentColor()
        {
            var swatch = this.Swatches.Where(s => s.Name.ToUpper().Equals(this.SelectedAccentColor.Name.ToUpper())).FirstOrDefault();

            if (swatch != null)
            {
                var ph = new PaletteHelper();
                ph.ReplacePrimaryColor(swatch, true);
                ph.ReplaceAccentColor(swatch);
            }
        }