Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

better UIColor conversion #1716

Merged
merged 2 commits into from
Jul 12, 2021
Merged

better UIColor conversion #1716

merged 2 commits into from
Jul 12, 2021

Conversation

tipa
Copy link
Contributor

@tipa tipa commented Mar 5, 2021

Description of Change

Better UIColor conversion uses rounding instead of cutting off decimals

Bugs Fixed

fixes #1572

API Changes

none

Behavioral Changes

none

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Updated documentation (see walkthrough)

@jamesmontemagno
Copy link
Collaborator

Anything for the other platforms at all?

@tipa
Copy link
Contributor Author

tipa commented Mar 5, 2021

@jamesmontemagno Windows & Android are using bytes for their "platform colors" so the bytes from the "system color" can be used 1:1

@jamesmontemagno
Copy link
Collaborator

@tipa
Copy link
Contributor Author

tipa commented Mar 16, 2021

Just spent an hour trying to add tests but the solution wouldn't build on my VS4Mac and on Windows, VS kept freezing when trying to start a remote session or the iOS simulator wouldn't launch.

This was the test I intended to try:

#if __IOS__
        [Fact]
        public void PlatformToColorDecimal()
        {
            var platform = UIKit.UIColor.FromDisplayP3(101.999986320734f, 50.9999969601631f, 153.000021278858f, a);
            var hex_platform = platform.ToString();
            var system = platform.ToSystemColor();
            var hex_system = system.ToString();
            Assert.Equal(hex_platform, hex_system);
        }
#endif

@jamesmontemagno
Copy link
Collaborator

@mattleibow good to go?

@jamesmontemagno jamesmontemagno added the ready-to-merge Review completed, Ready for API review and merge label Apr 12, 2021
@jamesmontemagno jamesmontemagno added this to the 1.7.0 milestone Jun 9, 2021
@Redth Redth merged commit ea31604 into xamarin:main Jul 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ready-to-merge Review completed, Ready for API review and merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Unprecise UIColor conversion
3 participants