diff --git a/iphone/Maps/UI/EditBookmark/legacy_bookmark_colors.h b/iphone/Maps/UI/EditBookmark/legacy_bookmark_colors.h index 73649714b7..af87af2f0f 100644 --- a/iphone/Maps/UI/EditBookmark/legacy_bookmark_colors.h +++ b/iphone/Maps/UI/EditBookmark/legacy_bookmark_colors.h @@ -11,27 +11,8 @@ inline UIColor * UIColorForRGB(int red, int green, int blue) inline UIColor * UIColorForBookmarkColor(kml::PredefinedColor color) { - switch (color) - { - case kml::PredefinedColor::Red: return UIColorForRGB(229, 27, 35); - case kml::PredefinedColor::Pink: return UIColorForRGB(255, 65, 130); - case kml::PredefinedColor::Purple: return UIColorForRGB(155, 36, 178); - case kml::PredefinedColor::DeepPurple: return UIColorForRGB(102, 57, 191); - case kml::PredefinedColor::Blue: return UIColorForRGB(0, 102, 204); - case kml::PredefinedColor::LightBlue: return UIColorForRGB(36, 156, 242); - case kml::PredefinedColor::Cyan: return UIColorForRGB(20, 190, 205); - case kml::PredefinedColor::Teal: return UIColorForRGB(0, 165, 140); - case kml::PredefinedColor::Green: return UIColorForRGB(60, 140, 60); - case kml::PredefinedColor::Lime: return UIColorForRGB(147, 191, 57); - case kml::PredefinedColor::Yellow: return UIColorForRGB(255, 200, 0); - case kml::PredefinedColor::Orange: return UIColorForRGB(255, 150, 0); - case kml::PredefinedColor::DeepOrange: return UIColorForRGB(240, 100, 50); - case kml::PredefinedColor::Brown: return UIColorForRGB(128, 70, 51); - case kml::PredefinedColor::Gray: return UIColorForRGB(115, 115, 115); - case kml::PredefinedColor::BlueGray: return UIColorForRGB(89, 115, 128); - case kml::PredefinedColor::None: - case kml::PredefinedColor::Count: return UIColorForBookmarkColor(kml::PredefinedColor::Red); - } + auto const dpColor = kml::ColorFromPredefinedColor(color); + return UIColorForRGB(dpColor.red, dpColor.green, dpColor.blue); } inline UIImage * ImageForBookmark(kml::PredefinedColor color, kml::BookmarkIcon icon) diff --git a/kml/types.hpp b/kml/types.hpp index fcdd5f68c4..43f739c839 100644 --- a/kml/types.hpp +++ b/kml/types.hpp @@ -8,6 +8,8 @@ #include "base/internal/message.hpp" // DebugPrint(Timestamp) #include "base/visitor.hpp" +#include "drape/color.hpp" + #include #include @@ -65,6 +67,31 @@ inline std::string DebugPrint(PredefinedColor color) UNREACHABLE(); } +inline dp::Color ColorFromPredefinedColor(PredefinedColor color) +{ + switch (color) + { + case kml::PredefinedColor::Red: return dp::Color(229, 27, 35, 255); + case kml::PredefinedColor::Pink: return dp::Color(255, 65, 130, 255); + case kml::PredefinedColor::Purple: return dp::Color(155, 36, 178, 255); + case kml::PredefinedColor::DeepPurple: return dp::Color(102, 57, 191, 255); + case kml::PredefinedColor::Blue: return dp::Color(0, 102, 204, 255); + case kml::PredefinedColor::LightBlue: return dp::Color(36, 156, 242, 255); + case kml::PredefinedColor::Cyan: return dp::Color(20, 190, 205, 255); + case kml::PredefinedColor::Teal: return dp::Color(0, 165, 140, 255); + case kml::PredefinedColor::Green: return dp::Color(60, 140, 60, 255); + case kml::PredefinedColor::Lime: return dp::Color(147, 191, 57, 255); + case kml::PredefinedColor::Yellow: return dp::Color(255, 200, 0, 255); + case kml::PredefinedColor::Orange: return dp::Color(255, 150, 0, 255); + case kml::PredefinedColor::DeepOrange: return dp::Color(240, 100, 50, 255); + case kml::PredefinedColor::Brown: return dp::Color(128, 70, 51, 255); + case kml::PredefinedColor::Gray: return dp::Color(115, 115, 115, 255); + case kml::PredefinedColor::BlueGray: return dp::Color(89, 115, 128, 255); + case kml::PredefinedColor::None: + case kml::PredefinedColor::Count: return ColorFromPredefinedColor(kml::PredefinedColor::Red); + } +} + enum class AccessRules : uint8_t { // Do not change the order because of binary serialization.