ComponentFactory.Krypton.Toolkit.AccentColorService.GetColorByTypeName C# (CSharp) Method

GetColorByTypeName() static private method

static private GetColorByTypeName ( string name ) : Color
name string
return Color
        internal static Color GetColorByTypeName(string name)
        {
            var colorSet = Interop.GetImmersiveUserColorSetPreference(false, false);
            var colorType = Interop.GetImmersiveColorTypeFromName(name);

            var rawColor = Interop.GetImmersiveColorFromColorSetEx(colorSet, colorType, false, 0);

            return FromABGR((int)rawColor);
        }

Usage Example

        //public static void UpdateThemeResources(ResourceDictionary dictionary)
        //{
        //    dictionary["WindowBackground"] = new SolidColorBrush(GetWindowBackgroundColor());

        //    SetBrush(dictionary, "WindowForeground", "ImmersiveApplicationTextDarkTheme");
        //    ReplaceBrush(dictionary, "CottonSwabSliderThumb", "ImmersiveSystemAccent");
        //    ReplaceBrush(dictionary, "CottonSwabSliderTrackBackground", SystemParameters.HighContrast ? "ImmersiveSystemAccentLight1" : "ImmersiveControlDarkSliderTrackBackgroundRest");
        //    SetBrushWithOpacity(dictionary, "CottonSwabSliderTrackBackgroundHover", SystemParameters.HighContrast ? "ImmersiveSystemAccentLight1" : "ImmersiveDarkBaseMediumHigh", SystemParameters.HighContrast ? 1.0 : 0.25);
        //    SetBrush(dictionary, "CottonSwabSliderTrackBackgroundPressed", "ImmersiveControlDarkSliderTrackBackgroundRest");
        //    ReplaceBrush(dictionary, "CottonSwabSliderTrackFill", "ImmersiveSystemAccentLight1");
        //    SetBrush(dictionary, "CottonSwabSliderThumbHover", "ImmersiveControlDarkSliderThumbHover");
        //    SetBrush(dictionary, "CottonSwabSliderThumbPressed", "ImmersiveControlDarkSliderThumbHover");
        //}

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static Color GetWindowBackgroundColor()
        {
            string resource;

            if (SystemInformation.HighContrast)
            {
                resource = "ImmersiveApplicationBackground";
            }
            else if (UserSystemPreferencesService.UseAccentColor)
            {
                resource = IsWindowTransparencyEnabled ? "ImmersiveSystemAccentDark2" : "ImmersiveSystemAccentDark1";
            }
            else
            {
                resource = "ImmersiveDarkChromeMedium";
            }

            Color color = AccentColorService.GetColorByTypeName(resource);

            //return color;
            //color.A = (byte)(IsWindowTransparencyEnabled ? 190 : 255);
            return(Color.FromArgb(IsWindowTransparencyEnabled ? 190 : 255, color.R, color.G, color.B));
        }
All Usage Examples Of ComponentFactory.Krypton.Toolkit.AccentColorService::GetColorByTypeName