Files
aistudio-wpf-diagram/AIStudio.Wpf.Mind/Helpers/MindThemeHelper.cs
2023-03-11 22:27:23 +08:00

584 lines
21 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using AIStudio.Wpf.DiagramDesigner.Geometrys;
using AIStudio.Wpf.Mind.ViewModels;
namespace AIStudio.Wpf.Mind.Helpers
{
public static class MindThemeHelper
{
public static MindThemeModel GetTheme(string theme)
{
switch (theme)
{
case "SkyBlue": return GetSkyBlueTheme();
case "SkyBlueMini": return GetSkyBlueMiniTheme();
case "LiteratureGreen": return GetLiteratureGreenTheme();
case "LiteratureGreenMini": return GetLiteratureGreenMiniTheme();
case "BrainDeadPink": return GetBrainDeadPinkTheme();
case "BrainDeadPinkMini": return GetBrainDeadPinkMiniTheme();
case "RomanticPurple": return GetRomanticPurpleTheme();
case "RomanticPurpleMini": return GetRomanticPurpleMiniTheme();
case "FreshRed": return GetFreshRedTheme();
case "FreshRedMini": return GetFreshRedMiniTheme();
case "EarthyYellow": return GetEarthyYellowTheme();
case "EarthyYellowMini": return GetEarthyYellowMiniTheme();
case "CoolLightYellow": return GetCoolLightYellowTheme();
case "CoolLightYellowMini": return GetCoolLightYellowMiniTheme();
default: return GetSkyBlueTheme();
}
}
public static MindThemeModel GetSkyBlueTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetSkyBlueMiniTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetLiteratureGreenTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetLiteratureGreenMiniTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetBrainDeadPinkTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetBrainDeadPinkMiniTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetRomanticPurpleTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetRomanticPurpleMiniTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetFreshRedTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetFreshRedMiniTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetEarthyYellowTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetEarthyYellowMiniTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetCoolLightYellowTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xe9, 0xdf, 0x98),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xe9, 0xdf, 0x98),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xe9, 0xdf, 0x98),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetCoolLightYellowMiniTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xe9, 0xdf, 0x98),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xe9, 0xdf, 0x98),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xe9, 0xdf, 0x98),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static void ThemeChange(MindNode mindNode, MindThemeModel mindThemeModel)
{
switch (mindNode.NodeLevel)
{
case 0:
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel1.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel1.ItemHeight;
mindNode.ColorViewModel.FillColor.Color = mindThemeModel.MindThemeLevel1.FillColor;
mindNode.ColorViewModel.LineColor.Color = mindThemeModel.MindThemeLevel1.FillColor;
mindNode.FontViewModel.FontColor = mindThemeModel.MindThemeLevel1.FontColor;
mindNode.FontViewModel.FontSize = mindThemeModel.MindThemeLevel1.FontSize;
mindNode.Spacing = mindThemeModel.MindThemeLevel1.Spacing;
break;
}
case 1:
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel2.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel2.ItemHeight;
mindNode.ColorViewModel.FillColor.Color = mindThemeModel.MindThemeLevel2.FillColor;
mindNode.ColorViewModel.LineColor.Color = mindThemeModel.MindThemeLevel2.FillColor;
mindNode.FontViewModel.FontColor = mindThemeModel.MindThemeLevel2.FontColor;
mindNode.FontViewModel.FontSize = mindThemeModel.MindThemeLevel2.FontSize;
mindNode.Spacing = mindThemeModel.MindThemeLevel2.Spacing;
break;
}
default:
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel3.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel3.ItemHeight;
mindNode.ColorViewModel.FillColor.Color = mindThemeModel.MindThemeLevel3.FillColor;
mindNode.ColorViewModel.LineColor.Color = mindThemeModel.MindThemeLevel3.FillColor;
mindNode.FontViewModel.FontColor = mindThemeModel.MindThemeLevel3.FontColor;
mindNode.FontViewModel.FontSize = mindThemeModel.MindThemeLevel3.FontSize;
mindNode.Spacing = mindThemeModel.MindThemeLevel3.Spacing;
break;
}
}
}
}
public class MindTheme
{
public double ItemWidth
{
get; set;
}
public double ItemHeight
{
get; set;
}
public Color FillColor
{
get; set;
}
public Color FontColor
{
get; set;
}
public double FontSize
{
get; set;
}
public SizeBase Spacing
{
get; set;
}
}
public class MindThemeModel
{
public MindTheme MindThemeLevel1
{
get; set;
}
public MindTheme MindThemeLevel2
{
get; set;
}
public MindTheme MindThemeLevel3
{
get; set;
}
}
}