AustinGil / bedrocss

A classless CSS library that's modern, lightweight, and easy to modify so you can start your projects on a solid foundation. It does a bit more than a reset, but not so much as a framework. bedrocss applies sane defaults to plain HTML elements, so there isn't anything to learn, and it's super easy to modify.
https://bedrocss.austingil.com/
29 stars 4 forks source link

move color-scheme from :root to html #9

Closed nuxodin closed 3 years ago

nuxodin commented 3 years ago

:root is the same as html But :root has a higher specificity.

See here: https://css-tricks.com/almanac/selectors/r/root/#points-of-interest

AustinGil commented 3 years ago

That makes sense, but I think color-scheme has to be specified on the :root (https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme#adapting_to_color_schemes)

I've never seen it specified elsewhere, but I also have not tested otherwise.

And I think the specificity would not be an issue here because to change the value, a developer would need to specify it on :root anyway, thus replacing the value.

AustinGil commented 3 years ago

Did some testing and it seems that color scheme CAN be defined on HTML, so this looks good.

nuxodin commented 3 years ago

Ok, specificity may not be a problem. This is a good answer on stackoverflow: https://stackoverflow.com/a/45387911/4865307

It makes sense if you don't want to exclude that your css is used in a document where html is not the root element. For example in a SVG document.

And that is just for color-scheme maybe still a use case...🤔

AustinGil commented 3 years ago

Oh, thats a great link. Thanks for sharing. I think targeting HTML should be fine. The case for SVG is something I really can't make any prediction on because I've never come across color-scheme for SVG. It's easy to change it back if needed, but until then, I like your solution here to keep things simpler.

AustinGil commented 2 years ago

:tada: This PR is included in version 1.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: