mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[MouseHighlighter]Add always-on pointer (#27186)
* [MouseHighlighter]Add always pointer Make color pick UI ARGB Delete Opacity setting * Fix opacity and color Fix "always color" incorrectly initialized Revert default opacity to 65%, which was unintentionally lowered to 25% when changing to percent * Fix crash when opening MouseUtils settings page Migration code was bugged, made malformed json and led to settings page crash. * Implement migration in module side
This commit is contained in:
@@ -35,5 +35,33 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Helpers
|
||||
return "#FFFFFF";
|
||||
}
|
||||
}
|
||||
|
||||
public static string ToARGBHex(string color)
|
||||
{
|
||||
if (color == null)
|
||||
{
|
||||
return "#FFFFFFFF";
|
||||
}
|
||||
|
||||
// Using InvariantCulture as these are expected to be hex codes.
|
||||
bool success = int.TryParse(
|
||||
color.Replace("#", string.Empty),
|
||||
System.Globalization.NumberStyles.HexNumber,
|
||||
CultureInfo.InvariantCulture,
|
||||
out int argb);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Color clr = Color.FromArgb(argb);
|
||||
return "#" + clr.A.ToString("X2", CultureInfo.InvariantCulture) +
|
||||
clr.R.ToString("X2", CultureInfo.InvariantCulture) +
|
||||
clr.G.ToString("X2", CultureInfo.InvariantCulture) +
|
||||
clr.B.ToString("X2", CultureInfo.InvariantCulture);
|
||||
}
|
||||
else
|
||||
{
|
||||
return "#FFFFFFFF";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user