UColor.cs 1.1 KB

12345678910111213141516171819202122232425262728
  1. using System;
  2. using System.Windows.Media;
  3. namespace SHJX.Service.Common.UserColor
  4. {
  5. public static class UColor
  6. {
  7. public static SolidColorBrush SpringGreen => "#66CC99".ConvertToBrush();
  8. public static SolidColorBrush DarkOrange => "#FF9933".ConvertToBrush();
  9. public static SolidColorBrush DoderBlue => "#1296DB".ConvertToBrush();
  10. public static SolidColorBrush DeepSkyBlue => "#C800B2FF".ConvertToBrush();
  11. public static SolidColorBrush SteelBlue => "#2281D1".ConvertToBrush();
  12. public static SolidColorBrush LightOrange => "#FF6600".ConvertToBrush();
  13. public static SolidColorBrush OrangeRed=> "#FF4500".ConvertToBrush();
  14. private static readonly BrushConverter BrushConverter = new();
  15. public static SolidColorBrush ConvertToBrush(this string colorRgb)
  16. {
  17. if (string.IsNullOrWhiteSpace(colorRgb))
  18. {
  19. throw new ArgumentNullException(colorRgb);
  20. }
  21. return (SolidColorBrush)BrushConverter.ConvertFromString(colorRgb);
  22. }
  23. }
  24. }