[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:
hayatogh
2023-07-26 23:48:00 +09:00
committed by GitHub
parent a99b2e0bc0
commit a71411d931
12 changed files with 331 additions and 74 deletions

View File

@@ -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";
}
}
}
}