mariusmuntean / ChartJs.Blazor

Brings Chart.js charts to Blazor
https://www.iheartblazor.com/
MIT License
677 stars 151 forks source link

FromDrawingColor Alpha #118

Closed imtrobin closed 3 years ago

imtrobin commented 4 years ago

Hi, can I suggest to add to ColorUtils

public static string FromDrawingColor (System.Drawing.Color color, float alpha) => ColorUtil.ColorString (color.R, color.G, color.B, alpha);

Joelius300 commented 4 years ago

Actually, System.Drawing.Color already has an alpha property. We should just expand FromDrawingColor to also include the alpha.

Instead of

return ColorHexString(color.R, color.G, color.B);

that would be

return ColorString(color.R, color.G, color.B, (double)color.A / byte.MaxValue);

That should work if I'm not mistaken. We could also consider adding a ColorHexString function with alpha included and use that.

Feel free to open a PR for this.

Joelius300 commented 3 years ago

Closed by ea4b914. Will be released in the next update.