I can change the CSS selection color, but how can I get the browser/OS default selection so that I can use it elsewhere?
e.g. on Ubuntu+Chrome text is highl
In the CSS2 specs some color keywords are defined but are now deprecated. Yet they should still work just fine:
.selected {
background: Highlight;
color: HighlightText;
}
<p>Lorem ipsum with some <span class="selected">selected text</span></p>
I think that for what you want is better if you use Javacript combined with CSS.
You could check this post https://stackoverflow.com/a/11752084/8379001 that shows how to find out the os and applies it to CSS.