Example #1
0
        private void UpdateColor(ColorProvider provider)
        {
            Color     = provider?.Color;
            ColorName = Color != null?ColorProvider.GetColorName(Color) : "[???]";

            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Color)));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ColorName)));
        }
        private void UpdateColor(ColorProvider provider)
        {
            if (provider?.Color != null)
            {
                var inputColorName = ColorProvider.GetColorName(provider.Color);

                if (!LightOutputProvider.UpdateColor($"Light{inputColorName}"))
                {
                    LightOutputProvider.UpdateColor(ChangeColorBrightness(provider.Color, 0.5f));
                }

                if (!DarkOutputProvider.UpdateColor($"Dark{inputColorName}"))
                {
                    DarkOutputProvider.UpdateColor(ChangeColorBrightness(provider.Color, -0.5f));
                }
            }
            else
            {
                LightOutputProvider.RemoveColor();
                DarkOutputProvider.RemoveColor();
            }
        }