0

The browser I'm using, qutebrowser, allows me to set a CSS file that applies those styles to every web site (but doesn't allow you to set it per page/domain, as far as I can tell), so I downloaded a dark theme CSS stylesheet from solarized-everything-css, but it seems the result on some website is unsatisfactory.

Therefore, I'd like to know if CSS offers a way to not apply a sequence of rulesets (in my case it'd be the whole stylesheet) on some domains. Something long the lines of

@this-web-site-is-NOT-in-the-black-list-in("list.txt") {
    /* the content of the dark theme CSS goes here*/
}

If it was possible, then I would add each problematic site to that sort of blacklist.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Enlico
  • 23,259
  • 6
  • 48
  • 102
  • 1
    There's https://stackoverflow.com/q/3123063 and https://developer.mozilla.org/en-US/docs/Web/CSS/@document, but neither are very compatible. If it were me, I'd run a bit of JS instead to check if the current site is compatible, and apply a root selector if so – CertainPerformance Oct 02 '20 at 16:42

1 Answers1

1

CSS itself cannot do this, because CSS is designed to apply only to a site from which it is loaded within the browser environment. Normally this happens by looking at resources listed in an HTML file's <head>, but can also happen from JavaScript injection via userscripts/addons/extensions a user has installed in their web browser.

So you need to use a 'user' style for this, which means you need to use a web browser that supports this. If the browser you're using (qutebrowser) does not allow you to set specific domains/URLs, then this will not be possible for you without creating your own user script (written in JavaScript, presumably) to apply this functionality on top of what the browser supports natively.

TylerH
  • 20,799
  • 66
  • 75
  • 101