-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Support for inline theming? #1648
Comments
Although not explicitly mentioned in the v1 Roadmap, we intend to support inline theming in some way once Carbon v11 styles are adopted. At this time, Since Carbon v11 styles come with CSS variables, it should be possible to support theming using a context wrapper like in the example you shared. Implementation details still need to be determined, such as use of style props or injecting a reusable themed stylesheet for progressive enhancement. Related: |
What this means is that we would change the current |
@gregorw my current plan is to provide a default slot for carbon-components-svelte/src/carbon-components-svelte/Theme/Theme.svelte Lines 112 to 116 in 17f1f2d
See branch |
Hm… not sure I would mix the legacy behavior with the new implementation. Also, how can we merge this to main/master when master still doesn’t have v11 styles? |
We won't merge this into By legacy behaviour are you referring to v10 styles, or something else? |
My concern is that this will be a very long-lived branch, which is not good. I’d much rather try to merge smaller changes onto the main branch. Would it be possible to do these steps separately and merge them into main?
Those are all separate steps. Merging smaller patches at once would give us more progress on the main branch quicker with less risk.
What I mean with “legacy behavior” is that the current What I am saying is that we can rename |
Carbon Design System provides the idea of [inline theming](https://carbondesignsystem.com/guidelines/color/implementation/#how-inline-theming-works). As was mentioned in carbon-design-system#1648 the Carbon standard implementation is [documented here](https://react.carbondesignsystem.com/?path=/docs/components-theme--playground). It says: > The `GlobalTheme` and `Theme` components allow you to specify the theme for a page, or for a part of a page, respectively. `Theme` is most often used to implement inline theming where you can style a portion of your page with a particular theme. What this means for `carbon-components-svelte` is that we should rename the existing `Theme` component to `GlobalTheme`. This leads us a tiny bit closer to [feature parity with Carbon v11](carbon-design-system#1614) and gives room for a new component dedicated to v11 inline theming.
Carbon Design System provides the idea of [inline theming](https://carbondesignsystem.com/guidelines/color/implementation/#how-inline-theming-works). As was mentioned in carbon-design-system#1648 the Carbon standard implementation is [documented here](https://react.carbondesignsystem.com/?path=/docs/components-theme--playground). It says: > The `GlobalTheme` and `Theme` components allow you to specify the theme for a page, or for a part of a page, respectively. `Theme` is most often used to implement inline theming where you can style a portion of your page with a particular theme. What this means for `carbon-components-svelte` is that we should rename the existing `Theme` component to `GlobalTheme`. This leads us a tiny bit closer to [feature parity with Carbon v11](carbon-design-system#1614) and gives room for a new component dedicated to v11 inline theming.
I appreciate your insight. I think phasing in v11 components one at a time to Here's how that can look:
During this interim phase, the consumption side will look like this:
Let me know if that sounds good, I'd like to share this plan in #1614. |
Carbon Design System provides the idea of [inline theming](https://carbondesignsystem.com/guidelines/color/implementation/#how-inline-theming-works). As was mentioned in carbon-design-system#1648 the Carbon standard implementation is [documented here](https://react.carbondesignsystem.com/?path=/docs/components-theme--playground). It says: > The `GlobalTheme` and `Theme` components allow you to specify the theme for a page, or for a part of a page, respectively. `Theme` is most often used to implement inline theming where you can style a portion of your page with a particular theme. What this means for `carbon-components-svelte` is that we should rename the existing `Theme` component to `GlobalTheme`. This leads us a tiny bit closer to [feature parity with Carbon v11](carbon-design-system#1614) and gives room for a new component dedicated to v11 inline theming.
That’s not exactly what I meant.
I’m not sure
👍
v11 changes for buttons are quite moderate: 15f2875. I wouldn’t change class prefixes at the same time as adopting to the new styles as in 6fc0ab3. This is not necessary and it leads to noise that makes reviewing the actual meaningful changes more difficult.
Maybe we can draft a PR and discuss this there?
This is a discussion worthwhile having. But, I would keep it separate from v11 styles. This can come later. I think what we need is minimal changes that lead to v11 on master the quickest.
Before we share this plan maybe we can draft a PR that demonstrates feasibility of your idea. In the meantime I would like to try an alternative way that imposes minimal changes on the current setup: #1709. |
The Carbon design spec has recommendations about using an inline theme to essentially apply a different theme to one part of the app vs. the global theme. The storybook for React implements that kind of behavior here. All the theme examples in Svelte, however, only apply a single theme, and from my own testing, I don't believe that it is possible to do the following in Svelte:
Before making any proposals, I'm seeking to verify:
The text was updated successfully, but these errors were encountered: