Fix error and color handling in ItemFormatter.

Alas, `local` does not affect the execution of code refs defined when it's in
scope. :-( So we have to set it up before every call to `format`.