2026-03-08 15:48:10 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
using System.Windows.Media;
|
2026-03-08 15:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
namespace Flow.Launcher.Core.Resource;
|
|
|
|
|
|
|
|
|
|
|
|
public static class ThemeHelper
|
|
|
|
|
|
{
|
2026-03-08 15:48:10 +00:00
|
|
|
|
public static void CopyStyle(Style originalStyle, Style targetStyle)
|
|
|
|
|
|
{
|
|
|
|
|
|
// If the style is based on another style, copy the base style first
|
|
|
|
|
|
if (originalStyle.BasedOn != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
CopyStyle(originalStyle.BasedOn, targetStyle);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Copy the setters from the original style
|
|
|
|
|
|
foreach (var setter in originalStyle.Setters.OfType<Setter>())
|
|
|
|
|
|
{
|
|
|
|
|
|
targetStyle.Setters.Add(new Setter(setter.Property, setter.Value));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-08 15:49:09 +00:00
|
|
|
|
public static SolidColorBrush GetFrozenSolidColorBrush(Color color)
|
2026-03-08 15:46:08 +00:00
|
|
|
|
{
|
|
|
|
|
|
var brush = new SolidColorBrush(color);
|
|
|
|
|
|
brush.Freeze();
|
|
|
|
|
|
return brush;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|