First of all, thanks for finally adding macOS support - I've been waiting for it for months!!
I installed v1.6.0-pre1
Unfortunately there seems to be some issues when working with Color, it seems to fail to resolve the System.Drawing.Color type.
For example, this cannot compile:NSColor.Red.ToSystemColor();
Same problem with ColorConverters.FromHex("#fff");
.../ViewController.cs(13,13): Error CS0012: The type 'Color' is defined in an assembly that is not referenced. You must add a reference to assembly 'OpenTK, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'. (CS0012) (Test2)
If you add a reference to OpenTK it should work.
We need to look at seeing if we can have the nuget pull this in.
I thought this was moved to another assembly in VS2019...
@tipa let me know if adding a reference does actually fix it. Make sure to use the local opentk reference in the references window, and not the NuGet.
Yes this does fix it - thanks!
By the way, looking at the .csproj file I see that PackageReference is being used to include System.Numerics.Vectors on iOS, tvOS, watchOS but Reference is being used for macOS. Not sure if that's of importance...
I found another problem. This code
NSColor.ControlAccentColor.ToSystenmColor()
throws NSInvalidArgumentException: *** -getRed:green:blue:alpha: not valid for the NSColor Catalog color: System controlAccentColor; need to first convert colorspace.
I think this line needs to be added in the ToSystemColor method:
color = color.UsingColorSpace(NSColorSpace.GenericRGBColorSpace);
I'm not too up on color spaces, but I bet @mattleibow is with SkiaSharp... Is this the right thing to do here do you think @mattleibow ? GenericRGBColorSpace?
Should it not be the sRGB color space?
Good question. I am no color expert either. Not sure why I chose to use NSColorSpace.GenericRGBColorSpace, I think sRGB would work, too
Thanks for reporting. Pushed to NuGet. Let us know how it goes!
It looks like the Color type is still missing. Is it possible that you would need to add "OpenTK" as reference instead of "OpenTK-1.0"?
Hmm let me check. Thanks.
@mattleibow the problem persists with the newly released preview3 package.
Hmmm. It shouldn't, but I'll reopen and make sure that nothing got reverted or something.
I think this one can easily be fixed by referencing the correct dependency ("OpenTK" instead of "OpenTK-1.0")
Ah, I see where the confusion came in - iOS is using an even older OpenTK.
I'll push that out to the preview feed.
Most helpful comment
I found another problem. This code
NSColor.ControlAccentColor.ToSystenmColor()throws
NSInvalidArgumentException: *** -getRed:green:blue:alpha: not valid for the NSColor Catalog color: System controlAccentColor; need to first convert colorspace.I think this line needs to be added in the
ToSystemColormethod:color = color.UsingColorSpace(NSColorSpace.GenericRGBColorSpace);