<!DOCTYPE html>
<style>
span { font-size: 3em; }
::selection { text-shadow: 1px 1px 2px blue; }
::selection:window-inactive {
    text-shadow: 1px 1px 2px rgba(63, 128, 33, 0.95); /* green; alpha < 1 so that we don't blend the background color with white. */
}
</style>
<span>Any textual selection in this sentence should have a green shadow when the window is inactive.</span>
<script>
var span = document.querySelector("span");
window.getSelection().setBaseAndExtent(span, 0, span, 1);
if (window.testRunner)
    testRunner.setWindowIsKey(false);
</script>
