I'm not sure what the context of this question is, but it sounds like maybe you want to highlight specific elements of the page a certain way and be able to toggle that custom highlight. (rather than styling elements your extension would create)
Since you can't actually remove the CSS file or just erase it by adding a file with the same name, I suggest the following:
- wrap your custom styles in something like
body.JMaylinCustomStyles
- use JavaScript to add or remove the
JMaylinCustomStyles
class to the body
element.
- there is no step 3.
The benefits are that it doesn't add much work on top of what you have, that you don't have to figure out how to override your custom styles in a second stylesheet (it's always very annoying and error-prone) and that you even gain a bit in CSS specificity so your styles are more likely to be applied.
Note that the best way to "wrap" your styles would be to use Sass or LESS since you can literally just add body.JMaylinCustomStyles {
at the top of the file and }
at the bottom.