// 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 {
        try {
                return "#%s".format(toHex(cast(const(BigInt)) rgbcolor));
        } catch(Throwable){return "";}
}

Reply via email to