mattosaurus / ChartJSCore

Implementation of Chart.js for use with .NET Core.
GNU General Public License v3.0
116 stars 34 forks source link

Use System.Drawing.Color for color properties #32

Closed Davee02 closed 5 years ago

Davee02 commented 5 years ago

Each dataset has multiple color-properties (BackgroundColor, ForegroundColor, ...). The datatype of them is string. My proposal is that we change the datatype to System.Drawing.Color. The old string value could then be parsed with Color.FromArgb(1, 200, 100, 200) or new ColorConverter().ConvertFromString("#FFDFD991").

The downside of this is that it would be a breaking change. But the migration is fairly simple as shown with the two examples above.

I would be happy if I could implement this.

mattosaurus commented 5 years ago

Good idea. I don't think System.Drawing was available for .NET Core when I initially coded this which is why I didn't use it. Do you want to go ahead and submit a pull request with the required changes, or if not I'll look at this when I get a chance.

Davee02 commented 5 years ago

I just looked at the project and noticed that ChartJSCore targets netstandard2.0. In this framework the System.Drawing namespace doesn' exist yet. This means that we cannot use the Color-object (yet).