In-browser default selected text color - What is it?

browser, css, html

Solution

I'd agree with Joshua that the colors come from the system, but I'd disagree about CSS, for example, CSS-Tricks:

::selection { background: #ffcc89; color: #222; }
::-moz-selection { background: #ffcc89; color: #222; }

For more info, see Quirksmode on selection styles.

Problem

Supposing no CSS, javascript or other HTML trickery, how does the browser determine the color of the text and background for selected text? For example, standard white background (`#FFFFFF` or `RGB=255,255,255`) with black text (`#000000` or `RGB=0,0,0`) when selected with invert the colors (i.e. `black background`, `white text`). How are other colors chosen? For example, when writing a question on this site, the right sidebar has an area "How to ask" with `background #FFEFC6` and `text #AE0000`, which when selected become `#3399FF` and `#FFFFFF` respectively. I would like to know how this is determined (is there an algorithm or just defaults) and is this the same across browsers?

Original source