Re: How can I convert Hexadecimal to RGB Color and vice-versa?

2020-11-24 Thread Jacob Carlborg via Digitalmars-d-learn
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

Re: How can I convert Hexadecimal to RGB Color and vice-versa?

2020-11-23 Thread Marcone via Digitalmars-d-learn
// 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

Re: How can I convert Hexadecimal to RGB Color and vice-versa?

2020-10-16 Thread Ali Çehreli via Digitalmars-d-learn
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?

2020-10-16 Thread Marcone via Digitalmars-d-learn
How can I convert Hexadecimal to RGB Color and vice-versa?