$ 0 0 @rysiek perl -ne '/^#?(..)(..)(..)$/ or /^#?(.)(.)(.)$/ or die; printf "#%02x%02x%02x\n", 0xff-hex($1), 0xff-hex($2), 0xff-hex($3)'