I'm working with React and need to adjust the text highlight color. Initially, I tried this approach:
Highlight.css
::selection {
background:#fbc308;
color: black
}
somecomponent.tsx
import './highlight.css'
However, this ended up changing the text highlight color for all elements, which was not my intention. Then, I attempted:
<div style={{"::selection" : {
background:"#fbc308",
color: "black"}}}><p>Something</p></div>
Unfortunately, this did not work and resulted in an error.
After that, I tried:
.somecomponent p::selection {
...style
}
But this only impacted the p elements. My goal is to change the text highlight color for all elements within a component.
Thank you.