diff --git a/ReactCommon/fabric/graphics/Color.cpp b/ReactCommon/fabric/graphics/Color.cpp index ba6c897b4..151e2923a 100644 --- a/ReactCommon/fabric/graphics/Color.cpp +++ b/ReactCommon/fabric/graphics/Color.cpp @@ -13,11 +13,17 @@ namespace facebook { namespace react { -SharedColor colorFromComponents(float red, float green, float blue, float alpha) { - const CGFloat components[] = {red, green, blue, alpha}; +SharedColor colorFromComponents(ColorComponents components) { + const CGFloat componentsArray[] = { + components.red, + components.green, + components.blue, + components.alpha + }; + CGColorRef color = CGColorCreate( CGColorSpaceCreateDeviceRGB(), - components + componentsArray ); return SharedColor(color, CFRelease); diff --git a/ReactCommon/fabric/graphics/Color.h b/ReactCommon/fabric/graphics/Color.h index 0a84e7b3a..f7622d213 100644 --- a/ReactCommon/fabric/graphics/Color.h +++ b/ReactCommon/fabric/graphics/Color.h @@ -23,7 +23,7 @@ struct ColorComponents { float alpha {0}; }; -SharedColor colorFromComponents(float red, float green, float blue, float alpha); +SharedColor colorFromComponents(ColorComponents components); ColorComponents colorComponentsFromColor(SharedColor color); } // namespace react diff --git a/ReactCommon/fabric/graphics/graphicValuesConversions.cpp b/ReactCommon/fabric/graphics/graphicValuesConversions.cpp index 85909b3a0..874c70b69 100644 --- a/ReactCommon/fabric/graphics/graphicValuesConversions.cpp +++ b/ReactCommon/fabric/graphics/graphicValuesConversions.cpp @@ -36,7 +36,7 @@ SharedColor colorFromDynamic(const folly::dynamic &value) { abort(); } - return colorFromComponents(red, green, blue, alpha); + return colorFromComponents({red, green, blue, alpha}); } std::string colorNameFromColor(const SharedColor &value) {