PowerToys/src/common/utils/color.h
Jaime Bernardo 46244e8e84
[FindMyMouse]Add additional settings (#14590)
* [FindMyMouse]Add additional settings

* Add setting for Spotlight Initial Zoom

* PR feedback: lowercase settings names

* PR feedback: settings descriptions

* PR feedback: change opacity to percentage

* PR feedback: increase maximum zoom factor

* PR feedback: group spotlight settings

* PR feedback: Expanders start collapsed initially

* Remove extra settings file save in dllmain

* PR feedback: change initial zoom description

* PR feedback: Add warning for photo sensitive users

* PR feedback: remove warning and add description instead

* PR feedback: size->factor in initial zoom description

* Feedback PR: remove opacity description

* PR feedback: remove photo sensitivity warning
2021-11-23 16:52:17 +00:00

22 lines
512 B
C++

#pragma once
// helper function to get the RGB from a #FFFFFF string.
inline bool checkValidRGB(std::wstring_view hex, uint8_t* R, uint8_t* G, uint8_t* B)
{
if (hex.length() != 7)
return false;
hex = hex.substr(1, 6); // remove #
for (auto& c : hex)
{
if (!((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')))
{
return false;
}
}
if (swscanf_s(hex.data(), L"%2hhx%2hhx%2hhx", R, G, B) != 3)
{
return false;
}
return true;
}