This great javascript library changes your highlight color based on the text selected.
Available as a drop in javascript library.
Currently a function is bound to the mouseup event to detect when new text is selected. Afterwards the text is processed in 4 steps
Replace all non-hex characters in the string with 0
.
Pad the string out to the nearest multiple of 3 with 0
s.
Get the first two characters from each third of the string.
Finally these 6 characters are assigned as the new text highlighting color.