emulation: Make extended fore/background colour handling more xterm-like

https://bugzilla.gnome.org/show_bug.cgi?id=616436