-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding .NET Core Support #13
Comments
Thanks for letting me know. Is there a specific error message that you see? I believe this may be related the discussion here: #12 |
Nothing concrete sadly, just a generic "this nuget is not compatible" message pointing to the project.json lines where this nuget reference appears. I'll take a look and see if I can also help. |
I see. Thanks for the info, and thanks for taking a look! I will also look into this when I can find some spare time. |
I just merged a PR to support .NET Core 1.0 and netstandard 1.3. I marked the version as 2.0 and now some testing can begin before releasing. Colorful.Console should totally work on OSX and Linux now! However, the colours will not change on these platforms as the P/Invoke signatures are obviously different. This bit of code needs to be filled in to change colours on those platforms. I have no experience of OSX and Linux P/Invoke so I'm at a loss there. Even without colours changing on these platforms I still think it may be worth a release as it still works on Windows and you still have Figlet font text. When we release, we should tweet the .NET Core team and get some visibility of the project. |
Someone in this StackOverflow wrote a method to get the nearest I'm not too clued up on how the |
@RehanSaeed good question. I'll check this out later today, and will update this thread. |
We should also probably put a try catch into MapColor and fall back to picking the closest ConsoleColor. We can't assume that PInvoke will work anymore. |
Good point -- will do. |
I've just implemented the "nearest match" functionality (d20b38c)! A word of warning, though: I don't have access to an OSX or Linux machine, so I'm not quite sure how well this will work. I did write a test to make sure that the nearest match is actually correct (at least for a handful of test-case colors), but I'm still not 100% confident. I've just read through the issue you opened on the CoreFX page. I wonder when .NET Core will support System.Drawing.Color? I'll also look into those two ConsolePal classes -- I had never heard of those until now. |
Is this progressing? I would very much like to use it in a .NET Core App. |
@giggio The current master branch should work on Mac and Linux without being so colourful but needs testing. |
@giggio Like @RehanSaeed said, the master branch should work on Mac and Linux, but it will only display the standard colors when writing in color. Is it not working for you? As I mentioned in my last post in this thread, I haven't actually tested this library on Mac or Linux, so I'm not certain that it does work. If it isn't working for you on either of those platforms, that would be interesting for us to know. |
Tests don't work, you have a dependency on This is from: string[] storyFragments = new string[]
{
"John went to the store.",
"He wanted to buy fruit.",
"The security guard wouldn't let him buy fruit.",
"John didn't like being harrassed about buying fruit.",
"He went to another fruit store.",
"At the other fruit store, he selected a ripe piece of fruit.",
"A security guard came by and deselected the piece of fruit.",
"John selected it again.",
"He was determined to buy fruit.",
"Until 7 PM, when the store closed."
};
int r = 225;
int g = 255;
int b = 250;
for (int i = 0; i < 10; i++)
{
Console.WriteLine(storyFragments[i], Color.FromArgb(r, g, b));
r -= 18;
b -= 9;
} It happens on other parts as well. |
Thanks for the info! Sorry for the delay -- I'm looking into this now. I've discovered that there's an element in the Colorful.Console xproj file that may be causing this problem:
Unfortunately, I don't actually know what this does (we target more than 4.6.1, so I'm not sure what this means), and can't find any useful documentation. I have some ideas, though, and will update this thread once I've done some testing. |
@tomakita no, your project.json files still target net461: https://github.com/tomakita/Colorful.Console/blob/master/src/Colorful.Console.Tests/project.json#L14 |
@giggio Ok, thanks for the feedback. We use xUnit for our tests, and it isn't compatible with any versions of .NET Standard, yet, so the Tests project isn't cross-platform at the moment. As for the Example project, when I try to add .NET Standard as a framework in the project.json file, I get an unhelpful compilation error about .NET Standard 1.3 not being compatible with my target runtime. I'm guessing that this has something to do with the fact that the Example application is a console application, as that's the only difference between it and the Colorful.Console project itself. I'm going to wait until .NET Core 1.1 is released before doing any further work on cross-platform compatibility. In the meantime, if you'd like to submit a PR related to cross-platform compatibility, feel free! Thanks again for the feedback. |
@giggio By the way, I apologize for the poor support you're getting from me on this issue. I feel like I need to get a better low-level understanding of .NET Core in order to address this issue, but I don't have time right now. My only solace is that, the more mature .NET Core gets, the better the documentation will become, so the barrier to entry will eventually become low enough for me to participate! |
Sure, no problem. |
@giggio xUnit is compatible but right now, you cannot run tests against both .NET Core and .NET Framework separately. You have to pick one and run tests against that. My understanding is that this will change in the next version. |
Just to give a quick update: I haven't forgotten about adding .NET Core support -- I'm waiting for .NET Core to support .NET Standard 2.0, and will make the change at that time. I was hoping that this would happen in .NET Core 1.1, but it looks like it only supports .NET Standard 1.6.1. Let's hope this changes in .NET Core 1.2! |
@tomakita what API are you depending on to use .NET Standard 2.0? |
@giggio We depend on System.Drawing. |
Would ImageSharp work as a replacement for System.Drawing? I use it for Color in my projects. https://github.com/JimBobSquarePants/ImageSharp |
@wonea Thanks for the reminder. We've experimented with ImageSharp, and I don't remember why, but we ended up not being able to use it. That was over a year ago, though, so I'll look into it again. |
The future is here, and .NET Core 2.0 Preview 1 is available with System.Drawing |
Thanks for letting me know. Looking through dotnet/core#640, I don't feel comfortable making the switch to Preview 1. Preview 2 is supposed to be released at the end of June, so I'll check that out when it's released. |
The Serilog project has implemented ANSI 256 color themes. Read this blog post to see how they did it. There is a limited colour pallete of 256 colours, I'm not sure how that would work if System.Drawing was used. |
Thanks @RehanSaeed, we're looking into this as we speak: #24 ! |
Hey! .NetCore 2.0 has been released. Right now I tried to use the package and got following errors:
|
Thanks to @JamieG, Colorful.Console should now work under .NET Core 2.0! |
@tomakita I can see you are taking a dependency on .NET Core 2.0. You should change that to support .NET Standard 2.0. This way any platform that supports the .NET Standard will be able to run it, not only .NET Core. |
Will do today after work -- thanks for the tip! |
@JamieG has very generously made this change! Let me know how it goes. |
Well, not much to add to the title. Started a console project with this new .NET Core approach, added Colorful.Console nuget and got the incompatibility error once added.
I just let you know the incompatibility in case it is trivial to fix, but I don't think this is an urgent issue 👍
The text was updated successfully, but these errors were encountered: