Esempio n. 1
0
        public ThemeColorPanel(ThemeConfig theme, AccentColorsWidget colorSelector)
            : base(FlowDirection.TopToBottom)
        {
            this.colorSelector = colorSelector;
            this.theme         = theme;

            string currentProviderName = UserSettings.Instance.get(UserSettingsKey.ThemeName) ?? "";

            if (AppContext.ThemeProviders.TryGetValue(currentProviderName, out IColorTheme currentProvider))
            {
                _themeProvider = currentProvider;
            }
            else
            {
                _themeProvider = AppContext.ThemeProviders.Values.First();
            }

            accentPanelColor = theme.ResolveColor(theme.SectionBackgroundColor, theme.SlightShade);

            this.SelectionColor = theme.MinimalShade;

            this.AddChild(previewButtonPanel = new FlowLayoutWidget()
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit,
                //BackgroundColor = activeTheme.MinimalShade
            });

            this.CreateThemeModeButtons();
        }
Esempio n. 2
0
        public ThemeColorPanel(ThemeConfig activeTheme)
            : base(FlowDirection.TopToBottom)
        {
            string currentProviderName = UserSettings.Instance.get(UserSettingsKey.ThemeName) ?? "";

            if (AppContext.ThemeProviders.TryGetValue(currentProviderName, out IColorTheme currentProvider))
            {
                _themeProvider = currentProvider;
            }
            else
            {
                _themeProvider = AppContext.ThemeProviders.Values.First();
            }

            this.SelectionColor = activeTheme.GetBorderColor(80);

            // Add color selector
            this.AddChild(colorSelector = new AccentColorsWidget(this)
            {
                Margin = new BorderDouble(activeTheme.DefaultContainerPadding, 0)
            });

            this.AddChild(previewButtonPanel = new FlowLayoutWidget()
            {
                HAnchor         = HAnchor.Stretch,
                VAnchor         = VAnchor.Fit,
                BackgroundColor = this.SelectionColor,
                Padding         = new BorderDouble(left: colorSelector.ColorButtons.First().Border.Left)
            });

            this.CreateThemeModeButtons();
        }