-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tokens 🤝 global theming #184
Conversation
} | ||
) | ||
).toThrowError( | ||
new Error(`You've defined hard-coded colors which is not allowed in strict mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is sick 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the whole concept of strict has been removed for now
397c880
to
7729f0a
Compare
This comment has been minimized.
This comment has been minimized.
@gwyneplaine yo chime in sometime about the theming api :) i think global api is probably a little easier so i might remove all the variant stuff for now - but would be keen for a look over that too i quite like the css prop api because it can be typed + transformed easily and its pretty easy to use api - everything else is 🤷 the other missing piece is allowing consumers to pass runtime themes which should be not hard to implement - just a matter of passing the same object in and then transforming it to css variables at runtime. |
fbb7e8d
to
df4a97d
Compare
Investigating #18 #182
createThemeProvider()
apiuseMode()
hookTODO
Questions
base
and then use those references in the modes.base
tokens and then themes - withdefault
a mandatory theme?primary
to another color.I was imagining this could be something like:
And if you want to add an entire new theme:
Usage
default
and othersbase
- anything else results in an errordefault
Nested tokens
We can support nested tokens we just need to do some extra work because the transformed appearance needs to be flat.Transforms top level tokens that would be CSS variables to:
And then transform the token access to:
ThemeProvider
ends up being a component with react contexttheme
ends up being an object to access tokens.Ends up being inlined and looking like this CSS, uses default css variable so it works without the theme provider as well.
If we want to provide basic support for IE11 we can also do this (but let's not):