private static ThemeOption GetCurrentThemeOption()
        {
            Options options = Settings.Get <Options>();

            ThemeOption theme = options.Themes.CustomThemes
                                .FirstOrDefault(t => t.Name == options.Themes.CurrentTheme)
                                ?? options.Themes.DefaultTheme;

            return(theme);
        }
示例#2
0
        private void LoadThemeBranchColors(ThemeOption themeOption)
        {
            foreach (string hexColor in themeOption.BranchColors.Colors)
            {
                SolidColorBrush brush = Converter.BrushFromHex(hexColor);

                SolidColorBrush darkerBrush         = DarkBrush(brush);
                SolidColorBrush lighterBrush        = LightBrush(brush);
                SolidColorBrush lighterLighterBrush = LightBrush(lighterBrush);

                brushes.Add(brush);
                darkBrushes.Add(darkerBrush);
                lighterBrushes.Add(lighterBrush);
                lighterLighterBrushes.Add(lighterLighterBrush);
            }
        }
        private bool LoadTheme()
        {
            try
            {
                ThemeOption themeOption = GetCurrentThemeOption();

                currentTheme = new Theme(themeOption);
                return(true);
            }
            catch (Exception e)
            {
                Log.Exception(e, "Error in theme option");
                currentTheme = new Theme(new ThemeOption());
                return(false);
            }
        }
示例#4
0
        public Theme(ThemeOption option)
        {
            BackgroundBrush         = FromHex(option.BackgroundColor);
            ForegroundBrush         = FromHex(option.ForegroundColor);
            TitlebarBackgroundBrush = FromHex(option.TitlebarBackgroundColor);

            BorderBrush                 = FromHex(option.BorderColor);
            TextBrush                   = FromHex(option.TextColor);
            TextLowBrush                = FromHex(option.TextLowColor);
            HoverBrush                  = FromHex(option.HoverColor);
            ErrorBrush                  = FromHex(option.ErrorColor);
            UndoBrush                   = FromHex(option.UndoColor);
            SubjectBrush                = FromHex(option.SubjectColors.SubjectColor);
            LocalAheadBrush             = FromHex(option.SubjectColors.LocalAheadColor);
            RemoteAheadBrush            = FromHex(option.SubjectColors.RemoteAheadColor);
            ConflictBrush               = FromHex(option.SubjectColors.ConflictColor);
            MergeBrush                  = FromHex(option.SubjectColors.MergeColor);
            UnCommittedBrush            = FromHex(option.SubjectColors.UnCommittedColor);
            BranchTipsBrush             = FromHex(option.SubjectColors.BranchTipColor);
            DimBrush                    = FromHex(option.SubjectColors.DimColor);
            CurrentCommitIndicatorBrush = FromHex(option.SubjectColors.CurrentCommitIndicatorBrush);

            TagBrush              = FromHex(option.SubjectColors.TagColor);
            TagBackgroundBrush    = FromHex(option.SubjectColors.TagBackgroundColor);
            TicketBrush           = FromHex(option.SubjectColors.TicketColor);
            TicketBackgroundBrush = FromHex(option.SubjectColors.TicketBackgroundColor);

            BusyBrush      = FromHex(option.BusyColor);
            ScrollbarBrush = FromHex(option.ScrollbarColor);

            ItemBackgroundBrush         = FromHex(option.ItemBackgroundColor);
            SelectedItemBorderBrush     = FromHex(option.SelectedItemBorderColor);
            SelectedItemBackgroundBrush = FromHex(option.SelectedItemBackgroundColor);
            HoverItemBrush = FromHex(option.HoverItemColor);

            NeonEffect = option.NeonEffect;

            LoadThemeBranchColors(option);
        }