コード例 #1
0
 public Color GetColorFor(News item)
 {
     if (colors.TryGetValue(item.GetNewsType(), out Color result))
     {
         return(result);
     }
     return(Color.white);
 }
コード例 #2
0
        public static SolidColorBrush GetColorBrush(string key, int opacity = 255)
        {
            Color color;

            color = ColorDict.TryGetValue(key, out color) ? color : ColorDict["coin_NULL"];

            if (opacity != 255)
            {
                color.A = (byte)opacity;
            }

            return(new SolidColorBrush(color));
        }
コード例 #3
0
        public static SolidColorBrush GetCoinBrush(string crypto, int opacity = 255)
        {
            Color color;

            crypto = crypto.ToUpperInvariant();

            color = ColorDict.TryGetValue($"coin_{crypto}", out color) ? color : ColorDict["coin_NULL"];

            //var localSettings = new LocalSettings();
            //if (localSettings.Get<bool>(UserSettings.Monochrome)) {
            //    var darkTheme = CurrentThemeIsDark();
            //    color = (darkTheme) ? ParseHex("#f0f0f0") : ParseHex("#101010");
            //}

            if (opacity != 255)
            {
                color.A = (byte)opacity;
            }

            return(new SolidColorBrush(color));
        }