You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying to develop the ui-tomato-theme I was pretty quickly faced with
some confusion around what type of stuff I should be editing. I thought it would
be useful to have the conversation here so we can maybe later use it as a
starting point for docs.
Theming by changing global variables
My initial thought was to start by customizing some of the SCSS configuration
variables to match the style of a tomato picnic.
The first step was to make sure that the variables that I wanted to customize
were marked as !default inside ui-base-theme:
I figured this was a good set of variables to customize to quickly make the
theme visually distinguishable from the base theme. This allowed me to create a
config stylesheet in ui-tomato-theme to provide new values for these
variables:
This works and we end up with components being styled differently but I'm not
sure if this is the intended workflow. These changes affect all of the
components from ui-base-theme.
Questions
If the eventual goal is to support multiple themes being active at the same
time, how does this work if the theme's styles are based on these variables?
If we instead created another set of variables in the subtheme with a different
prefix, how do automate those variables being passed to subtheme components?
Theming by creating new scss files in the subtheme
Another way to theme a component is to create a new SCSS file inside your
subtheme for the component.
For example, to create the tomato theme's ui-button--default, in your subtheme
you can create the following SCSS file:
This will create a new themed version of ui-button--default component. You can
use this component by providing your theme's name as the value for the theme
property when invoking the component:
While trying to develop the ui-tomato-theme I was pretty quickly faced with
some confusion around what type of stuff I should be editing. I thought it would
be useful to have the conversation here so we can maybe later use it as a
starting point for docs.
Theming by changing global variables
My initial thought was to start by customizing some of the SCSS configuration
variables to match the style of a tomato picnic.
The first step was to make sure that the variables that I wanted to customize
were marked as
!default
insideui-base-theme
:I figured this was a good set of variables to customize to quickly make the
theme visually distinguishable from the base theme. This allowed me to create a
config stylesheet in
ui-tomato-theme
to provide new values for thesevariables:
This works and we end up with components being styled differently but I'm not
sure if this is the intended workflow. These changes affect all of the
components from
ui-base-theme
.Questions
If the eventual goal is to support multiple themes being active at the same
time, how does this work if the theme's styles are based on these variables?
If we instead created another set of variables in the subtheme with a different
prefix, how do automate those variables being passed to subtheme components?
Theming by creating new scss files in the subtheme
Another way to theme a component is to create a new SCSS file inside your
subtheme for the component.
For example, to create the tomato theme's
ui-button--default
, in your subthemeyou can create the following SCSS file:
This will create a new themed version of
ui-button--default
component. You canuse this component by providing your theme's name as the value for the
theme
property when invoking the component:
Customizing a component's styles this way does not change any of the global
variables and doesn't affect any other components.
The text was updated successfully, but these errors were encountered: