While searching for something *completely* different, I noticed this post.
If it's been answered since, I apologize. I've forgetten how (other than it involved Excel), but I figured it out.
As you've determined, the mIRC color code is not the decimal equivalent of the hex RGB code used in HTML.
BUT it
IS the decimal equivalent of the hex BGR code.
Huh?!
In other words, you have to swap the B and R pairs, e.g. FF0000 becomes 0000FF, and
then convert from hex to dec.
So:
alias html2mirc {
set %mcc $remove($1,$chr(35))
set %mcc $+($right(%mcc,2),$mid(%mcc,3,2),$left(%mcc,2))
set -u0 %mcc $base(%mcc,16,10)
if ($isid) return %mcc
else echo -ag mIRC color code for $1 is %mcc
}
Ex: /html2mirc 8000FF [returns: mIRC color code for 8000FF is 16711808]
or
$html2mirc(C60217) [returns: 1508038]
And, of course:
alias mirc2html {
set -u0 %mcc $base($1,10,16,6)
set -u0 %hcc $+($chr(35),$right(%mcc,2),$mid(%mcc,3,2),$left(%mcc,2))
if ($isid) return %hcc
else echo -ag mIRC color code $1 in HTML is %hcc
}
This just shows the essence. It's actually completely useless for changing colors in a running mIRC, but I suppose you could produce lines you could paste into the mirc.ini of a non-running client. (See Merlin's invaluable
mIRC.ini Unleashed)
Happy coding...
