CodeMirror: Mark Selection Demo
Select something from here. You'll see that the selection's foreground color changes to white! Since, by default, CodeMirror only puts an independent "marker" layer behind the text, you'll need something like this to change its colour.
Simple addon to easily mark (and style) selected text.