Skip to content
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

FromDrawingColor Alpha #118

Closed
imtrobin opened this issue May 31, 2020 · 2 comments
Closed

FromDrawingColor Alpha #118

imtrobin opened this issue May 31, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@imtrobin
Copy link

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);

@imtrobin imtrobin added the enhancement New feature or request label May 31, 2020
@Joelius300
Copy link
Contributor

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants