Exemplo n.º 1
0
        //=====================================================================

        /// <summary>
        /// This is used to get a Visual Studio theme color for the given theme color ID
        /// </summary>
        /// <param name="id">The theme color ID for which to get the Visual Studio theme color</param>
        /// <returns>The theme color to use</returns>
        /// <remarks>Theme colors do not appear to be available at design time.  As such, this will return
        /// related default system colors in their place.</remarks>
        private static Color GetColor(ThemeColorId id)
        {
#if !STANDALONEGUI
            Color? vsColor = GetVisualStudioColor(id);

            if(vsColor != null)
                return vsColor.Value;
#endif
            // Get colors for design time or if something failed or wasn't defined
            return GetDefaultColor(id);
        }
Exemplo n.º 2
0
        //=====================================================================

        /// <summary>
        /// This is used to get a Visual Studio theme color for the given theme color ID
        /// </summary>
        /// <param name="id">The theme color ID for which to get the Visual Studio theme color</param>
        /// <returns>The theme color to use</returns>
        /// <remarks>Theme colors do not appear to be available at design time.  As such, this will return
        /// related default system colors in their place.</remarks>
        private static Color GetColor(ThemeColorId id)
        {
            Color?vsColor = GetVisualStudioColor(id);

            if (vsColor != null)
            {
                return(vsColor.Value);
            }

            // Get colors for design time or if something failed or wasn't defined
            return(GetDefaultColor(id));
        }
Exemplo n.º 3
0
        /// <summary>
        /// This is used to return a default system color for the given theme color ID
        /// </summary>
        /// <param name="id">The theme color ID for which to get the default system color</param>
        /// <returns>The default system color to use</returns>
        private static Color GetDefaultColor(ThemeColorId id)
        {
            switch (id)
            {
            case ThemeColorId.ButtonBackgroundColor:
                return(SystemColors.ControlLightColor);

            case ThemeColorId.ButtonBorderColor:
            case ThemeColorId.ButtonDisabledBorderColor:
            case ThemeColorId.ComboBoxButtonMouseOverBackgroundColor:
            case ThemeColorId.LightBorderColor:
            case ThemeColorId.MenuBorderColor:
            case ThemeColorId.MenuSeparatorColor:
            case ThemeColorId.ToolWindowBorderColor:
            case ThemeColorId.TreeViewHoverGlyphColor:
                return(SystemColors.ControlDarkColor);

            case ThemeColorId.ButtonDisabledBackgroundColor:
            case ThemeColorId.ButtonHoverBackgroundColor:
            case ThemeColorId.ButtonPressedBackgroundColor:
            case ThemeColorId.MenuBackgroundColor:
            case ThemeColorId.ToolWindowBackgroundColor:
                return(SystemColors.ControlColor);

            case ThemeColorId.ButtonDisabledForegroundColor:
            case ThemeColorId.ButtonForegroundColor:
            case ThemeColorId.ButtonHoverForegroundColor:
            case ThemeColorId.ButtonPressedForegroundColor:
            case ThemeColorId.ComboBoxGlyphColor:
            case ThemeColorId.MenuTextColor:
            case ThemeColorId.TreeViewGlyphColor:
                return(SystemColors.ControlTextColor);

            case ThemeColorId.ButtonHoverBorderColor:
            case ThemeColorId.ButtonPressedBorderColor:
            case ThemeColorId.LinkTextColor:
            case ThemeColorId.LinkTextHoverColor:
                return(SystemColors.HotTrackColor);

            case ThemeColorId.ComboBoxDisabledGlyphColor:
            case ThemeColorId.DisabledTextColor:
                return(SystemColors.GrayTextColor);

            case ThemeColorId.ComboBoxPopupBackground:
            case ThemeColorId.ItemBorderColor:
            case ThemeColorId.ItemColor:
            case ThemeColorId.NotificationColor:
            case ThemeColorId.TextBoxColor:
                return(SystemColors.WindowColor);

            case ThemeColorId.ItemHoverColor:
            case ThemeColorId.ItemHoverBorderColor:
            case ThemeColorId.ItemSelectedNotFocusedColor:
                return(SystemColors.ControlLightColor);

            case ThemeColorId.ItemHoverTextColor:
            case ThemeColorId.ItemSelectedTextNotFocusedColor:
            case ThemeColorId.ItemTextColor:
            case ThemeColorId.NotificationTextColor:
            case ThemeColorId.TextBoxTextColor:
            case ThemeColorId.ToolWindowTextColor:
                return(SystemColors.WindowTextColor);

            case ThemeColorId.ItemSelectedBorderColor:
            case ThemeColorId.ItemSelectedBorderNotFocusedColor:
            case ThemeColorId.ItemSelectedColor:
            case ThemeColorId.MenuHoverBackgroundColor:
                return(SystemColors.HighlightColor);

            case ThemeColorId.ItemSelectedTextColor:
            case ThemeColorId.MenuHoverTextColor:
                return(SystemColors.HighlightTextColor);

            case ThemeColorId.TextBoxBorderColor:
                return(SystemColors.WindowFrameColor);

            default:
                return(SystemColors.ControlTextColor);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// This is used to return a Visual Studio theme color for the given theme color ID
        /// </summary>
        /// <param name="id">The theme color ID for which to get the Visual Studio theme color</param>
        /// <returns>The theme color to use or null if it could not be obtained was not recognized</returns>
        private static Color?GetVisualStudioColor(ThemeColorId id)
        {
            switch (id)
            {
            case ThemeColorId.ButtonBackgroundColor:
                return(GetThemeColor(TeamFoundationColors.ButtonColorKey));

            case ThemeColorId.ButtonBorderColor:
                return(GetThemeColor(TeamFoundationColors.ButtonBorderColorKey));

            case ThemeColorId.ButtonDisabledBackgroundColor:
                return(GetThemeColor(TeamFoundationColors.ButtonDisabledColorKey));

            case ThemeColorId.ButtonDisabledBorderColor:
                return(GetThemeColor(TeamFoundationColors.ButtonDisabledBorderColorKey));

            case ThemeColorId.ButtonDisabledForegroundColor:
                return(GetThemeColor(TeamFoundationColors.ButtonDisabledTextColorKey));

            case ThemeColorId.ButtonForegroundColor:
                return(GetThemeColor(TeamFoundationColors.ButtonTextColorKey));

            case ThemeColorId.ButtonHoverBackgroundColor:
                return(GetThemeColor(TeamFoundationColors.ButtonMouseOverColorKey));

            case ThemeColorId.ButtonHoverBorderColor:
                return(GetThemeColor(TeamFoundationColors.ButtonMouseOverBorderColorKey));

            case ThemeColorId.ButtonHoverForegroundColor:
                return(GetThemeColor(TeamFoundationColors.ButtonMouseOverTextColorKey));

            case ThemeColorId.ButtonPressedBackgroundColor:
                return(GetThemeColor(TeamFoundationColors.ButtonPressedColorKey));

            case ThemeColorId.ButtonPressedBorderColor:
                return(GetThemeColor(TeamFoundationColors.ButtonPressedBorderColorKey));

            case ThemeColorId.ButtonPressedForegroundColor:
                return(GetThemeColor(TeamFoundationColors.ButtonPressedTextColorKey));

            case ThemeColorId.ComboBoxButtonMouseOverBackgroundColor:
                return(GetThemeColor(EnvironmentColors.ComboBoxButtonMouseOverBackgroundColorKey));

            case ThemeColorId.ComboBoxDisabledGlyphColor:
                return(GetThemeColor(EnvironmentColors.ComboBoxDisabledGlyphColorKey));

            case ThemeColorId.ComboBoxGlyphColor:
                return(GetThemeColor(EnvironmentColors.ComboBoxGlyphColorKey));

            case ThemeColorId.ComboBoxPopupBackground:
                return(GetThemeColor(EnvironmentColors.ComboBoxPopupBackgroundBeginColorKey));

            case ThemeColorId.DisabledTextColor:
            case ThemeColorId.LightBorderColor:
                return(GetThemeColor(EnvironmentColors.SystemGrayTextColorKey));

            case ThemeColorId.ItemBorderColor:
            case ThemeColorId.ItemColor:
                return(GetThemeColor(TreeViewColors.BackgroundColorKey));

            case ThemeColorId.ItemHoverColor:
            case ThemeColorId.ItemHoverBorderColor:
                return(GetThemeColor(EnvironmentColors.CommandBarMouseOverBackgroundMiddle1ColorKey));

            case ThemeColorId.ItemHoverTextColor:
            case ThemeColorId.MenuHoverTextColor:
                return(GetThemeColor(EnvironmentColors.CommandBarTextHoverColorKey));

            case ThemeColorId.ItemSelectedBorderColor:
            case ThemeColorId.ItemSelectedColor:
                return(GetThemeColor(TreeViewColors.SelectedItemActiveColorKey));

            case ThemeColorId.ItemSelectedBorderNotFocusedColor:
            case ThemeColorId.ItemSelectedNotFocusedColor:
                return(GetThemeColor(TreeViewColors.SelectedItemInactiveColorKey));

            case ThemeColorId.ItemSelectedTextColor:
                return(GetThemeColor(TreeViewColors.SelectedItemActiveTextColorKey));

            case ThemeColorId.ItemSelectedTextNotFocusedColor:
                return(GetThemeColor(TreeViewColors.SelectedItemInactiveTextColorKey));

            case ThemeColorId.ItemTextColor:
                return(GetThemeColor(TreeViewColors.BackgroundTextColorKey));

            case ThemeColorId.LinkTextColor:
                return(GetThemeColor(EnvironmentColors.ControlLinkTextColorKey));

            case ThemeColorId.LinkTextHoverColor:
                return(GetThemeColor(EnvironmentColors.ControlLinkTextHoverColorKey));

            case ThemeColorId.MenuBackgroundColor:
                return(GetThemeColor(EnvironmentColors.CommandBarMenuBackgroundGradientBeginColorKey));

            case ThemeColorId.MenuBorderColor:
                return(GetThemeColor(EnvironmentColors.CommandBarMenuBorderColorKey));

            case ThemeColorId.MenuHoverBackgroundColor:
                return(GetThemeColor(EnvironmentColors.CommandBarMouseOverBackgroundBeginColorKey));

            case ThemeColorId.MenuSeparatorColor:
                return(GetThemeColor(EnvironmentColors.CommandBarMenuSeparatorColorKey));

            case ThemeColorId.MenuTextColor:
                return(GetThemeColor(EnvironmentColors.CommandBarTextActiveColorKey));

            case ThemeColorId.NotificationColor:
                return(GetThemeColor(EnvironmentColors.SystemInfoBackgroundColorKey));

            case ThemeColorId.NotificationTextColor:
                return(GetThemeColor(EnvironmentColors.SystemInfoTextColorKey));

            case ThemeColorId.TextBoxBorderColor:
                return(GetThemeColor(EnvironmentColors.ComboBoxBorderColorKey));

            case ThemeColorId.TextBoxColor:
                return(GetThemeColor(EnvironmentColors.ComboBoxBackgroundColorKey));

            case ThemeColorId.TextBoxTextColor:
                return(GetThemeColor(EnvironmentColors.ComboBoxItemTextColorKey));

            case ThemeColorId.ToolWindowBackgroundColor:
                return(GetThemeColor(EnvironmentColors.ToolWindowBackgroundColorKey));

            case ThemeColorId.ToolWindowBorderColor:
                return(GetThemeColor(EnvironmentColors.ToolWindowBorderColorKey));

            case ThemeColorId.ToolWindowTextColor:
                return(GetThemeColor(EnvironmentColors.ToolWindowTextColorKey));

            case ThemeColorId.TreeViewGlyphColor:
                return(GetThemeColor(TreeViewColors.GlyphColorKey));

            case ThemeColorId.TreeViewHoverGlyphColor:
                return(GetThemeColor(TreeViewColors.GlyphMouseOverColorKey));

            default:
                return(null);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// This is used to return a default system color for the given theme color ID
        /// </summary>
        /// <param name="id">The theme color ID for which to get the default system color</param>
        /// <returns>The default system color to use</returns>
        private static Color GetDefaultColor(ThemeColorId id)
        {
            switch(id)
            {
                case ThemeColorId.ButtonBackgroundColor:
                    return SystemColors.ControlLightColor;

                case ThemeColorId.ButtonBorderColor:
                case ThemeColorId.ButtonDisabledBorderColor:
                case ThemeColorId.ComboBoxButtonMouseOverBackgroundColor:
                case ThemeColorId.LightBorderColor:
                case ThemeColorId.MenuBorderColor:
                case ThemeColorId.MenuSeparatorColor:
                case ThemeColorId.ToolWindowBorderColor:
                case ThemeColorId.TreeViewHoverGlyphColor:
                    return SystemColors.ControlDarkColor;

                case ThemeColorId.ButtonDisabledBackgroundColor:
                case ThemeColorId.ButtonHoverBackgroundColor:
                case ThemeColorId.ButtonPressedBackgroundColor:
                case ThemeColorId.MenuBackgroundColor:
                case ThemeColorId.ToolWindowBackgroundColor:
                    return SystemColors.ControlColor;

                case ThemeColorId.ButtonDisabledForegroundColor:
                case ThemeColorId.ButtonForegroundColor:
                case ThemeColorId.ButtonHoverForegroundColor:
                case ThemeColorId.ButtonPressedForegroundColor:
                case ThemeColorId.ComboBoxGlyphColor:
                case ThemeColorId.MenuTextColor:
                case ThemeColorId.TreeViewGlyphColor:
                    return SystemColors.ControlTextColor;

                case ThemeColorId.ButtonHoverBorderColor:
                case ThemeColorId.ButtonPressedBorderColor:
                case ThemeColorId.LinkTextColor:
                case ThemeColorId.LinkTextHoverColor:
                    return SystemColors.HotTrackColor;

                case ThemeColorId.ComboBoxDisabledGlyphColor:
                case ThemeColorId.DisabledTextColor:
                    return SystemColors.GrayTextColor;

                case ThemeColorId.ComboBoxPopupBackground:
                case ThemeColorId.ItemBorderColor:
                case ThemeColorId.ItemColor:
                case ThemeColorId.NotificationColor:
                case ThemeColorId.TextBoxColor:
                    return SystemColors.WindowColor;

                case ThemeColorId.ItemHoverColor:
                case ThemeColorId.ItemHoverBorderColor:
                case ThemeColorId.ItemSelectedNotFocusedColor:
                    return SystemColors.ControlLightColor;

                case ThemeColorId.ItemHoverTextColor:
                case ThemeColorId.ItemSelectedTextNotFocusedColor:
                case ThemeColorId.ItemTextColor:
                case ThemeColorId.NotificationTextColor:
                case ThemeColorId.TextBoxTextColor:
                case ThemeColorId.ToolWindowTextColor:
                    return SystemColors.WindowTextColor;

                case ThemeColorId.ItemSelectedBorderColor:
                case ThemeColorId.ItemSelectedBorderNotFocusedColor:
                case ThemeColorId.ItemSelectedColor:
                case ThemeColorId.MenuHoverBackgroundColor:
                    return SystemColors.HighlightColor;

                case ThemeColorId.ItemSelectedTextColor:
                case ThemeColorId.MenuHoverTextColor:
                    return SystemColors.HighlightTextColor;

                case ThemeColorId.TextBoxBorderColor:
                    return SystemColors.WindowFrameColor;

                default:
                    return SystemColors.ControlTextColor;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// This is used to return a Visual Studio theme color for the given theme color ID
        /// </summary>
        /// <param name="id">The theme color ID for which to get the Visual Studio theme color</param>
        /// <returns>The theme color to use or null if it could not be obtained was not recognized</returns>
        private static Color? GetVisualStudioColor(ThemeColorId id)
        {
            switch(id)
            {
                case ThemeColorId.ButtonBackgroundColor:
                    return GetThemeColor(TeamFoundationColors.ButtonColorKey);

                case ThemeColorId.ButtonBorderColor:
                    return GetThemeColor(TeamFoundationColors.ButtonBorderColorKey);

                case ThemeColorId.ButtonDisabledBackgroundColor:
                    return GetThemeColor(TeamFoundationColors.ButtonDisabledColorKey);

                case ThemeColorId.ButtonDisabledBorderColor:
                    return GetThemeColor(TeamFoundationColors.ButtonDisabledBorderColorKey);

                case ThemeColorId.ButtonDisabledForegroundColor:
                    return GetThemeColor(TeamFoundationColors.ButtonDisabledTextColorKey);

                case ThemeColorId.ButtonForegroundColor:
                    return GetThemeColor(TeamFoundationColors.ButtonTextColorKey);

                case ThemeColorId.ButtonHoverBackgroundColor:
                    return GetThemeColor(TeamFoundationColors.ButtonMouseOverColorKey);

                case ThemeColorId.ButtonHoverBorderColor:
                    return GetThemeColor(TeamFoundationColors.ButtonMouseOverBorderColorKey);

                case ThemeColorId.ButtonHoverForegroundColor:
                    return GetThemeColor(TeamFoundationColors.ButtonMouseOverTextColorKey);

                case ThemeColorId.ButtonPressedBackgroundColor:
                    return GetThemeColor(TeamFoundationColors.ButtonPressedColorKey);

                case ThemeColorId.ButtonPressedBorderColor:
                    return GetThemeColor(TeamFoundationColors.ButtonPressedBorderColorKey);

                case ThemeColorId.ButtonPressedForegroundColor:
                    return GetThemeColor(TeamFoundationColors.ButtonPressedTextColorKey);

                case ThemeColorId.ComboBoxButtonMouseOverBackgroundColor:
                    return GetThemeColor(EnvironmentColors.ComboBoxButtonMouseOverBackgroundColorKey);

                case ThemeColorId.ComboBoxDisabledGlyphColor:
                    return GetThemeColor(EnvironmentColors.ComboBoxDisabledGlyphColorKey);

                case ThemeColorId.ComboBoxGlyphColor:
                    return GetThemeColor(EnvironmentColors.ComboBoxGlyphColorKey);

                case ThemeColorId.ComboBoxPopupBackground:
                    return GetThemeColor(EnvironmentColors.ComboBoxPopupBackgroundBeginColorKey);

                case ThemeColorId.DisabledTextColor:
                case ThemeColorId.LightBorderColor:
                    return GetThemeColor(EnvironmentColors.SystemGrayTextColorKey);

                case ThemeColorId.ItemBorderColor:
                case ThemeColorId.ItemColor:
                    return GetThemeColor(TreeViewColors.BackgroundColorKey);

                case ThemeColorId.ItemHoverColor:
                case ThemeColorId.ItemHoverBorderColor:
                    return GetThemeColor(EnvironmentColors.CommandBarMouseOverBackgroundMiddle1ColorKey);

                case ThemeColorId.ItemHoverTextColor:
                case ThemeColorId.MenuHoverTextColor:
                    return GetThemeColor(EnvironmentColors.CommandBarTextHoverColorKey);

                case ThemeColorId.ItemSelectedBorderColor:
                case ThemeColorId.ItemSelectedColor:
                    return GetThemeColor(TreeViewColors.SelectedItemActiveColorKey);

                case ThemeColorId.ItemSelectedBorderNotFocusedColor:
                case ThemeColorId.ItemSelectedNotFocusedColor:
                    return GetThemeColor(TreeViewColors.SelectedItemInactiveColorKey);

                case ThemeColorId.ItemSelectedTextColor:
                    return GetThemeColor(TreeViewColors.SelectedItemActiveTextColorKey);

                case ThemeColorId.ItemSelectedTextNotFocusedColor:
                    return GetThemeColor(TreeViewColors.SelectedItemInactiveTextColorKey);

                case ThemeColorId.ItemTextColor:
                    return GetThemeColor(TreeViewColors.BackgroundTextColorKey);

                case ThemeColorId.LinkTextColor:
                    return GetThemeColor(EnvironmentColors.ControlLinkTextColorKey);

                case ThemeColorId.LinkTextHoverColor:
                    return GetThemeColor(EnvironmentColors.ControlLinkTextHoverColorKey);

                case ThemeColorId.MenuBackgroundColor:
                    return GetThemeColor(EnvironmentColors.CommandBarMenuBackgroundGradientBeginColorKey);

                case ThemeColorId.MenuBorderColor:
                    return GetThemeColor(EnvironmentColors.CommandBarMenuBorderColorKey);

                case ThemeColorId.MenuHoverBackgroundColor:
                    return GetThemeColor(EnvironmentColors.CommandBarMouseOverBackgroundBeginColorKey);

                case ThemeColorId.MenuSeparatorColor:
                    return GetThemeColor(EnvironmentColors.CommandBarMenuSeparatorColorKey);

                case ThemeColorId.MenuTextColor:
                    return GetThemeColor(EnvironmentColors.CommandBarTextActiveColorKey);

                case ThemeColorId.NotificationColor:
                    return GetThemeColor(EnvironmentColors.SystemInfoBackgroundColorKey);

                case ThemeColorId.NotificationTextColor:
                    return GetThemeColor(EnvironmentColors.SystemInfoTextColorKey);

                case ThemeColorId.TextBoxBorderColor:
                    return GetThemeColor(EnvironmentColors.ComboBoxBorderColorKey);

                case ThemeColorId.TextBoxColor:
                    return GetThemeColor(EnvironmentColors.ComboBoxBackgroundColorKey);

                case ThemeColorId.TextBoxTextColor:
                    return GetThemeColor(EnvironmentColors.ComboBoxItemTextColorKey);

                case ThemeColorId.ToolWindowBackgroundColor:
                    return GetThemeColor(EnvironmentColors.ToolWindowBackgroundColorKey);

                case ThemeColorId.ToolWindowBorderColor:
                    return GetThemeColor(EnvironmentColors.ToolWindowBorderColorKey);

                case ThemeColorId.ToolWindowTextColor:
                    return GetThemeColor(EnvironmentColors.ToolWindowTextColorKey);

                case ThemeColorId.TreeViewGlyphColor:
                    return GetThemeColor(TreeViewColors.GlyphColorKey);

                case ThemeColorId.TreeViewHoverGlyphColor:
                    return GetThemeColor(TreeViewColors.GlyphMouseOverColorKey);

                default:
                    return null;
            }
        }
Exemplo n.º 7
0
        //=====================================================================

        /// <summary>
        /// This is used to get a Visual Studio theme color for the given theme color ID
        /// </summary>
        /// <param name="id">The theme color ID for which to get the Visual Studio theme color</param>
        /// <returns>The theme color to use</returns>
        /// <remarks>Theme colors do not appear to be available at design time.  As such, this will return
        /// related default system colors in their place.</remarks>
        private static Color GetColor(ThemeColorId id)
        {
            Color? vsColor = GetVisualStudioColor(id);

            if(vsColor != null)
                return vsColor.Value;

            // Get colors for design time or if something failed or wasn't defined
            return GetDefaultColor(id);
        }