Files
NebulaLauncher/Nebula.Launcher/Utils/ColorUtils.cs

20 lines
496 B
C#
Raw Normal View History

2025-08-06 21:29:00 +03:00
using System;
using System.Security.Cryptography;
using System.Text;
using Avalonia.Media;
2025-12-11 21:47:54 +03:00
namespace Nebula.Launcher.Utils;
2025-08-06 21:29:00 +03:00
public static class ColorUtils
{
public static Color GetColorFromString(string input)
{
var hash = MD5.HashData(Encoding.UTF8.GetBytes(input));
var r = byte.Clamp(hash[0], 10, 200);
var g = byte.Clamp(hash[1], 10, 100);
var b = byte.Clamp(hash[2], 10, 100);
return Color.FromArgb(Byte.MaxValue, r, g, b);
}
}