fix ansi escape sequences, reset 24bit flag properly, add support for %n...

... in themes and extended colours