Ask HN: CSS Interfaces

1 points by perpetualcrayon ↗ HN
With components, how do you prefer to style your (and 3rd party) components?

It seems a logical path would be to start defining CSS Interfaces, so 3rd party widgets will seamlessly style themselves based on a website's "theme".

Are there any projects out there on this path? That have gained traction?

2 comments

[ 2.5 ms ] story [ 11.8 ms ] thread
see https://github.com/styled-components/styled-components - it provides a nice theme interface
Thanks for the link. I have come across this in the past, and I think it's great, except it appears that it still deals directly with CSS primitives.

I'm thinking more in terms of: I have a data structure for my "theme", which styled components has, but this data structure requires no knowledge of the inner structure of the component in order to style it properly.

What I'm thinking is, if there were some common interface, there wouldn't be any need to know anything about the structure of the component.

It definitely seems like it would be a difficult problem to solve. I think one of the first steps toward something like this would be to build up a vocabulary that represents slightly more generic, composable concepts than what the CSS primitives represent.