Files
comaps/libs/kml/color_parser.hpp
cyber-toad fd342c2a17 [gpx] Save bookmark color to gpx export (#11238)
* [gpx] Save bookmark color to gpx export
* [gpx] Code-review fixes
* [gpx] Use m_rgba to store initial color, reset on predefined color change
* [gpx] Move MapPredefinedColor to color parser
* [gpx] Adjust naming

Signed-off-by: cyber-toad <the.cyber.toad@proton.me>
2025-09-14 12:32:53 +07:00

27 lines
699 B
C++

#pragma once
#include <cstdint>
#include <optional>
#include <string_view>
#include "types.hpp"
namespace kml
{
template <typename Channel>
constexpr uint32_t ToRGBA(Channel red, Channel green, Channel blue, Channel alpha = Channel(255))
{
return static_cast<uint8_t>(red) << 24 | static_cast<uint8_t>(green) << 16 | static_cast<uint8_t>(blue) << 8 |
static_cast<uint8_t>(alpha);
}
std::optional<uint32_t> ParseHexColor(std::string_view c);
std::optional<uint32_t> ParseGarminColor(std::string_view c);
std::optional<uint32_t> ParseOSMColor(std::string_view c);
PredefinedColor MapPredefinedColor(uint32_t rgba);
std::string_view MapGarminColor(uint32_t rgba);
} // namespace kml