On Friday, 16 October 2020 at 20:10:58 UTC, Marcone wrote:
How can I convert Hexadecimal to RGB Color and vice-versa?
Not sure if this is what you're looking for:
struct Color
{
private uint hex;
int red()
out(result; result >= 0 && result <= 255) // assert
// Função hex2rgb()
uint hex2rgb(string hexcolor) nothrow {
try {
uint value;
hexcolor.stripLeft("#").formattedRead!"%x"(value);
return value;
} catch(Throwable){return 0;}
}
// Função rgb2hex()
string rgb2hex(uint rgbcolor) nothrow
On 10/16/20 1:10 PM, Marcone wrote:
How can I convert Hexadecimal to RGB Color and vice-versa?
On 10/16/20 1:10 PM, Marcone wrote:
> How can I convert Hexadecimal to RGB Color and vice-versa?
Do you mean from a string like "#123456" to the values of red, green,
and blue? I a
How can I convert Hexadecimal to RGB Color and vice-versa?