Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Theme"/> class.
 /// </summary>
 /// <param name="type">The type of this theme.</param>
 /// <param name="identifier">A unique identifier for this theme.</param>
 /// <param name="name">The friendly name for this theme, or <c>null</c> if no friendly name is specified.</param>
 /// <param name="backgroundColor">The background color of the window.</param>
 /// <param name="progressBarColor">The color of the progress bar.</param>
 /// <param name="progressBackgroundColor">The background color of the progress bar.</param>
 /// <param name="expirationFlashColor">The color that is flashed on expiration.</param>
 /// <param name="primaryTextColor">The color of the primary text.</param>
 /// <param name="primaryHintColor">The color of the watermark in the primary text box.</param>
 /// <param name="secondaryTextColor">The color of any secondary text.</param>
 /// <param name="secondaryHintColor">The color of the watermark in any secondary text box.</param>
 /// <param name="buttonColor">The color of the button text.</param>
 /// <param name="buttonHoverColor">The color of the button text when the user hovers over the button.</param>
 public Theme(
     ThemeType type,
     string identifier,
     string name,
     string backgroundColor,
     string progressBarColor,
     string progressBackgroundColor,
     string expirationFlashColor,
     string primaryTextColor,
     string primaryHintColor,
     string secondaryTextColor,
     string secondaryHintColor,
     string buttonColor,
     string buttonHoverColor)
     : this(
         type,
         identifier,
         name,
         ColorExtensions.FromString(backgroundColor),
         ColorExtensions.FromString(progressBarColor),
         ColorExtensions.FromString(progressBackgroundColor),
         ColorExtensions.FromString(expirationFlashColor),
         ColorExtensions.FromString(primaryTextColor),
         ColorExtensions.FromString(primaryHintColor),
         ColorExtensions.FromString(secondaryTextColor),
         ColorExtensions.FromString(secondaryHintColor),
         ColorExtensions.FromString(buttonColor),
         ColorExtensions.FromString(buttonHoverColor))
 {
 }
Example #2
0
        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            var str = (string)value;

            try
            {
                return(ColorExtensions.FromString(str));
            }
            catch (ArgumentException)
            {
                return(new Color());
            }
        }
Example #3
0
 public LabeledColorDesignData(string name, string color)
 {
     Name  = name;
     Color = ColorExtensions.FromString(color);
 }
Example #4
0
        public HSLColor(string hex)
        {
            var color = ColorExtensions.FromString(hex);

            SetRGB(color.A, color.R, color.G, color.B);
        }
Example #5
0
 private void ChangeResource(string resName, string newValue)
 {
     if (!string.IsNullOrEmpty(newValue))
     {
         if (Application.Current.Resources.Contains(resName))
         {
             Application.Current.Resources.Remove(resName);
         }
         if (resName.Contains("Size"))
         {
             int newSize = 0;
             if (int.TryParse(newValue, out newSize))
             {
                 Application.Current.Resources.Add(resName, newSize);
             }
         }
         else
         {
             // first, check for the system resources
             if (App.Current.Resources.Contains(newValue))
             {
                 Application.Current.Resources.Add(resName, Application.Current.Resources[newValue]);
             }
             // try to parse color
             else
             {
                 try { Application.Current.Resources.Add(resName, new SolidColorBrush(ColorExtensions.FromString(newValue))); }
                 catch { }
             }
         }
     }
 }