using System; using System.Windows; using System.Windows.Media; namespace VPet_Simulator.Core { public static partial class Function { /// /// HEX值转颜色 /// /// HEX值 /// 颜色 public static Color HEXToColor(string HEX) => (Color)ColorConverter.ConvertFromString(HEX); /// /// 颜色转HEX值 /// /// 颜色 /// HEX值 public static string ColorToHEX(Color color) => "#" + color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2"); public static Random Rnd = new Random(); /// /// 获取资源笔刷 /// /// /// public static Brush ResourcesBrush(BrushType name) { return (Brush)Application.Current.Resources[name.ToString()]; } public enum BrushType { Primary, PrimaryTrans, PrimaryTrans4, PrimaryTransA, PrimaryTransE, PrimaryLight, PrimaryLighter, PrimaryDark, PrimaryDarker, PrimaryText, Secondary, SecondaryTrans, SecondaryTrans4, SecondaryTransA, SecondaryTransE, SecondaryLight, SecondaryLighter, SecondaryDark, SecondaryDarker, SecondaryText, DARKPrimary, DARKPrimaryTrans, DARKPrimaryTrans4, DARKPrimaryTransA, DARKPrimaryTransE, DARKPrimaryLight, DARKPrimaryLighter, DARKPrimaryDark, DARKPrimaryDarker, DARKPrimaryText, } ///// ///// 翻译文本 ///// ///// 翻译文件 ///// 翻译内容 ///// 翻译后的文本 //public static string Translate(this LPS_D TranFile, string Name) => TranFile.GetString(Name, Name); } }