| 1 | using Core; |
| 2 | using System; |
| 3 | using System.Collections.Generic; |
| 4 | using System.Text; |
| 5 | using System.Windows.Media; |
| 6 | |
| 7 | namespace UI.Base.Color |
| 8 | { |
| 9 | public class Colors |
| 10 | { |
| 11 | public struct IColor |
| 12 | { |
| 13 | ///<summary> |
| 14 | /// |
| 15 | ///</summary> |
| 16 | public string Name; |
| 17 | ///<summary> |
| 18 | /// |
| 19 | ///</summary> |
| 20 | public string Color; |
| 21 | } |
| 22 | public static Dictionary<ColorTypes, IColor> ColorList = new Dictionary<ColorTypes, IColor>() { |
| 23 | {ColorTypes.Aquamarine,new IColor{Name="碧绿", Color="#00AA90"} }, |
| 24 | {ColorTypes.Black,new IColor{Name="暗黑", Color="#080808"} }, |
| 25 | {ColorTypes.Blue,new IColor{Name="蓝色", Color="#0078d4"} }, |
| 26 | {ColorTypes.Cyan,new IColor{Name="青色", Color="#51A8DD"} }, |
| 27 | {ColorTypes.Gold,new IColor{Name="金色", Color="#EFBB24"} }, |
| 28 | {ColorTypes.Gray,new IColor{Name="灰色", Color="#828282"} }, |
| 29 | {ColorTypes.Green,new IColor{Name="绿色", Color="#56C773"} }, |
| 30 | {ColorTypes.Orange,new IColor{Name="橙色", Color="#E98B2A"} }, |
| 31 | {ColorTypes.Pink,new IColor{Name="粉红", Color="#B5495B"} }, |
| 32 | {ColorTypes.Red,new IColor{Name="赤红", Color="#F3221B"} }, |
| 33 | {ColorTypes.Violet,new IColor{Name="紫色", Color="#77428D"} }, |
| 34 | {ColorTypes.Yellow,new IColor{Name="黄色", Color="#FFC408"} }, |
| 35 | {ColorTypes.White,new IColor{Name="白色", Color="#FFFFFF"} }, |
| 36 | |
| 37 | }; |
| 38 | |
| 39 | public static string[] MainColors = { "#00FFAB", "#A761FF", "#ff587f", "#fff323", "#DAEAF1", "#2B20D9", "#FF5C01", "#9EB23C", "#FF9999", "#998CEB", "#77E4D4", "#FD5E5E", "#B4FF9F", "#07FF01", "#FFE162", "#C70B80", "#590696", "#97DBAE", "#ff1801" }; |
| 40 | |
| 41 | public static IColor Get(ColorTypes color) |
| 42 | { |
| 43 | return ColorList[color]; |
| 44 | } |
| 45 | public static SolidColorBrush GetColor(ColorTypes color, double opacity = 1) |
| 46 | { |
| 47 | return GetFromString(ColorList[color].Color, opacity); |
| 48 | } |
| 49 | public static SolidColorBrush GetFromString(string color, double opacity = 1) |
| 50 | { |
| 51 | if (string.IsNullOrEmpty(color)) |
| 52 | { |
| 53 | color = StateData.ThemeColor; |
| 54 | } |
| 55 | return new SolidColorBrush((System.Windows.Media.Color)ColorConverter.ConvertFromString(color)) |
| 56 | { |
| 57 | Opacity = opacity |
| 58 | }; |
| 59 | } |
| 60 | } |
| 61 | } |