Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Return color string values in the [0-255] range #14233

Merged
merged 2 commits into from
May 22, 2019

Conversation

LukasPaczos
Copy link
Member

Closes #14130.

Fixes the color string round tripping which makes all the places where the string is used compliant with the rgba color option from the spec. All other color string types will be converted to rgba when being fetched back from the core and we don't have a good mechanism in place to fight that.

String alpha value will be rounded to 2 decimal points.

@LukasPaczos LukasPaczos added the Android Mapbox Maps SDK for Android label Mar 26, 2019
@LukasPaczos LukasPaczos added this to the release-m milestone Mar 26, 2019
@LukasPaczos LukasPaczos requested a review from tobrun March 26, 2019 12:26
@LukasPaczos LukasPaczos force-pushed the lp-color-getter-consistency-14130 branch from b32b48e to 19bc8d6 Compare March 27, 2019 11:39
@LukasPaczos LukasPaczos added the Core The cross-platform C++ core, aka mbgl label Mar 27, 2019
@LukasPaczos LukasPaczos force-pushed the lp-color-getter-consistency-14130 branch from 19bc8d6 to 264ba1a Compare March 27, 2019 11:44
@LukasPaczos
Copy link
Member Author

LukasPaczos commented Mar 27, 2019

String alpha value will be rounded to 2 decimal points.

This is done in 1907c05.

@kkaefer @1ec5 above is to improve color values round-tripping, any issues you're seeing in the approach? Or is there a way to work around CSSColorParser#parse changing the decimal output?

@LukasPaczos LukasPaczos force-pushed the lp-color-getter-consistency-14130 branch 2 times, most recently from 5545a5b to 1907c05 Compare March 27, 2019 12:13
@1ec5
Copy link
Contributor

1ec5 commented Apr 2, 2019

above is to improve color values round-tripping, any issues you're seeing in the approach? Or is there a way to work around CSSColorParser#parse changing the decimal output?

NSColor on macOS and UIColor on iOS represent all components, including the alpha component, with a double-precision property, whereas the components are all floats in mbgl. Does it make sense to increase the precision, or should we just live with the lack of round-tripping on Apple platforms?

float r = 0.0f;
float g = 0.0f;
float b = 0.0f;
float a = 0.0f;

/cc @fabian-guerra @julianrex

@LukasPaczos
Copy link
Member Author

Any other thoughts here? Can we get this into release-mojito or does it require further discussion?

@LukasPaczos LukasPaczos modified the milestones: release-mojito, release-n Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android Core The cross-platform C++ core, aka mbgl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Color getter inconsistency
3 participants