Flow.Launcher/Flow.Launcher.Plugin/SharedModels/ThemeData.cs

78 lines
1.9 KiB
C#
Raw Permalink Normal View History

2025-04-04 12:15:47 +00:00
using System;
2025-04-08 07:56:54 +00:00
namespace Flow.Launcher.Plugin.SharedModels;
2025-04-04 12:10:39 +00:00
/// <summary>
/// Theme data model
/// </summary>
public class ThemeData
{
/// <summary>
/// Theme file name without extension
/// </summary>
public string FileNameWithoutExtension { get; private init; }
/// <summary>
/// Theme name
/// </summary>
public string Name { get; private init; }
/// <summary>
2025-04-04 12:23:36 +00:00
/// Indicates whether the theme supports dark mode
2025-04-04 12:10:39 +00:00
/// </summary>
public bool? IsDark { get; private init; }
/// <summary>
/// Indicates whether the theme supports blur effects
2025-04-04 12:10:39 +00:00
/// </summary>
public bool? HasBlur { get; private init; }
/// <summary>
/// Theme data constructor
/// </summary>
public ThemeData(string fileNameWithoutExtension, string name, bool? isDark = null, bool? hasBlur = null)
{
FileNameWithoutExtension = fileNameWithoutExtension;
Name = name;
IsDark = isDark;
HasBlur = hasBlur;
}
/// <inheritdoc />
public static bool operator ==(ThemeData left, ThemeData right)
{
2025-04-08 08:01:46 +00:00
if (left is null && right is null)
return true;
if (left is null || right is null)
return false;
2025-04-04 12:10:39 +00:00
return left.Equals(right);
}
/// <inheritdoc />
public static bool operator !=(ThemeData left, ThemeData right)
{
return !(left == right);
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (obj is not ThemeData other)
return false;
return FileNameWithoutExtension == other.FileNameWithoutExtension &&
Name == other.Name;
}
/// <inheritdoc />
public override int GetHashCode()
{
2025-04-04 12:15:47 +00:00
return HashCode.Combine(FileNameWithoutExtension, Name);
2025-04-04 12:10:39 +00:00
}
/// <inheritdoc />
public override string ToString()
{
return Name;
}
}