Using a pseudo-element, allows you to change the text color or background color on selected text.
Selecting Highlighted Content on W3C
Select the text in this paragraph. The background color and text color will change to purple and hotpink for the selected area.
Can I Use css-selection? Data on support for the selection-color feature across the major browsers from caniuse.com.