mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-07 13:03:54 +00:00
[android] Fix predefined colors again
Signed-off-by: Andrei Shkrob <github@shkrob.dev>
This commit is contained in:
committed by
Konstantin Pastbin
parent
4052f0481e
commit
ac453e36ac
@@ -66,6 +66,21 @@ static_assert(kOrderedPredefinedColors.size() == static_cast<size_t>(PredefinedC
|
||||
"kOrderedPredefinedColors size must match PredefinedColor::Count");
|
||||
static_assert(base::HasUniqueElements(kOrderedPredefinedColors), "All values must be unique");
|
||||
|
||||
/**
|
||||
* @brief Maps PredefinedColor to its index in kOrderedPredefinedColors.
|
||||
*
|
||||
* @code
|
||||
* kOrderedPredefinedColors[kColorIndexMap[base::E2I(PredefinedColor::Red)]] == PredefinedColor::Red
|
||||
* @endcode
|
||||
*/
|
||||
std::array constexpr kColorIndexMap = [] consteval
|
||||
{
|
||||
std::array<int, static_cast<std::size_t>(PredefinedColor::Count)> map{};
|
||||
for (std::size_t i = 0; i < kOrderedPredefinedColors.size(); ++i)
|
||||
map[static_cast<std::size_t>(kOrderedPredefinedColors[i])] = static_cast<int>(i);
|
||||
return map;
|
||||
}();
|
||||
|
||||
inline std::string DebugPrint(PredefinedColor color)
|
||||
{
|
||||
switch (color)
|
||||
|
||||
Reference in New Issue
Block a user