File: System\Drawing\SystemColors.cs
Web Access
Project: src\src\libraries\System.Drawing.Primitives\src\System.Drawing.Primitives.csproj (System.Drawing.Primitives)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
using System.Diagnostics.CodeAnalysis;
 
namespace System.Drawing
{
    public static class SystemColors
    {
        internal static bool s_useAlternativeColorSet;
 
        public static Color ActiveBorder => Color.FromKnownColor(KnownColor.ActiveBorder);
        public static Color ActiveCaption => Color.FromKnownColor(KnownColor.ActiveCaption);
        public static Color ActiveCaptionText => Color.FromKnownColor(KnownColor.ActiveCaptionText);
        public static Color AppWorkspace => Color.FromKnownColor(KnownColor.AppWorkspace);
 
        public static Color ButtonFace => Color.FromKnownColor(KnownColor.ButtonFace);
        public static Color ButtonHighlight => Color.FromKnownColor(KnownColor.ButtonHighlight);
        public static Color ButtonShadow => Color.FromKnownColor(KnownColor.ButtonShadow);
 
        public static Color Control => Color.FromKnownColor(KnownColor.Control);
        public static Color ControlDark => Color.FromKnownColor(KnownColor.ControlDark);
        public static Color ControlDarkDark => Color.FromKnownColor(KnownColor.ControlDarkDark);
        public static Color ControlLight => Color.FromKnownColor(KnownColor.ControlLight);
        public static Color ControlLightLight => Color.FromKnownColor(KnownColor.ControlLightLight);
        public static Color ControlText => Color.FromKnownColor(KnownColor.ControlText);
 
        public static Color Desktop => Color.FromKnownColor(KnownColor.Desktop);
 
        public static Color GradientActiveCaption => Color.FromKnownColor(KnownColor.GradientActiveCaption);
        public static Color GradientInactiveCaption => Color.FromKnownColor(KnownColor.GradientInactiveCaption);
        public static Color GrayText => Color.FromKnownColor(KnownColor.GrayText);
 
        public static Color Highlight => Color.FromKnownColor(KnownColor.Highlight);
        public static Color HighlightText => Color.FromKnownColor(KnownColor.HighlightText);
        public static Color HotTrack => Color.FromKnownColor(KnownColor.HotTrack);
 
        public static Color InactiveBorder => Color.FromKnownColor(KnownColor.InactiveBorder);
        public static Color InactiveCaption => Color.FromKnownColor(KnownColor.InactiveCaption);
        public static Color InactiveCaptionText => Color.FromKnownColor(KnownColor.InactiveCaptionText);
        public static Color Info => Color.FromKnownColor(KnownColor.Info);
        public static Color InfoText => Color.FromKnownColor(KnownColor.InfoText);
 
        public static Color Menu => Color.FromKnownColor(KnownColor.Menu);
        public static Color MenuBar => Color.FromKnownColor(KnownColor.MenuBar);
        public static Color MenuHighlight => Color.FromKnownColor(KnownColor.MenuHighlight);
        public static Color MenuText => Color.FromKnownColor(KnownColor.MenuText);
 
        public static Color ScrollBar => Color.FromKnownColor(KnownColor.ScrollBar);
 
        public static Color Window => Color.FromKnownColor(KnownColor.Window);
        public static Color WindowFrame => Color.FromKnownColor(KnownColor.WindowFrame);
        public static Color WindowText => Color.FromKnownColor(KnownColor.WindowText);
 
        /// <summary>
        /// When <see langword="true"/>, system <see cref="KnownColor"/> values will return
        /// the alternative color set (as returned by <see cref="SystemColors"/> statics or
        /// <see cref="Color.FromKnownColor(KnownColor)"/>). This is currently "dark mode"
        /// variants of the system colors.
        /// </summary>
        /// <remarks>
        /// <para>
        /// <see cref="KnownColor"/> <see cref="Color"/> values are always looked up every
        /// time you use them and do not retain any other context. As such, existing
        /// <see cref="Color"/> values will change when this property is set.
        /// </para>
        /// <para>
        /// On Windows, system <see cref="KnownColor"/> values will always return the current
        /// Windows color when the OS has a high contrast theme enabled.
        /// </para>
        /// </remarks>
        [Experimental(Experimentals.SystemColorsDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
        public static bool UseAlternativeColorSet
        {
            get => s_useAlternativeColorSet;
            set => s_useAlternativeColorSet = value;
        }
    }
}