Liquid comes with multiple themes for theming its UI components. Most of the examples in the documentation have a theme switch built in, which you can use to switch between the available themes. In the following examples this switch is turned off. Instead, the examples show how you can apply a theme yourself.
You apply a theme by wrapping whatever needs to be themed in an element with a ld-theme-<themename>
CSS class.
<div class="ld-theme-bubblegum">
<ld-button>Text</ld-button>
</div>
<div class="ld-theme-bubblegum">
<button class="ld-button">Text</button>
</div>
In rare cases you may want to have a theming element wrapped by another theming element. Liquid supports unlimited theme inception (nested themes). Here is an example of a two-level theme inception:
<div class="ld-theme-bubblegum" style="display: flex;">
<ld-button>Text</ld-button>
<div class="ld-theme-tea" style="display: flex;">
<ld-button style="margin: 0 var(--ld-sp-16);">Text</ld-button>
<div class="ld-theme-ocean">
<ld-button>Text</ld-button>
</div>
</div>
</div>
<div class="ld-theme-bubblegum" style="display: flex;">
<button class="ld-button">Text</button>
<div class="ld-theme-tea" style="display: flex;">
<button class="ld-button" style="margin: 0 var(--ld-sp-16);">Text</button>
<div class="ld-theme-ocean">
<button class="ld-button">Text</button>
</div>
</div>
</div>
You have access to CSS custom properties with a color value depending on the current theme:
--ld-thm-primary
--ld-thm-primary-active
--ld-thm-primary-focus
--ld-thm-primary-highlight
--ld-thm-primary-hover
--ld-thm-primary-alpha-low
--ld-thm-primary-alpha-lowest
--ld-thm-secondary
--ld-thm-secondary-active
--ld-thm-secondary-focus
--ld-thm-secondary-highlight
--ld-thm-secondary-hover
--ld-thm-success
--ld-thm-success-active
--ld-thm-success-focus
--ld-thm-success-highlight
--ld-thm-success-hover
--ld-thm-warning
--ld-thm-warning-active
--ld-thm-warning-focus
--ld-thm-warning-highlight
--ld-thm-warning-hover
--ld-thm-error
--ld-thm-error-active
--ld-thm-error-focus
--ld-thm-error-highlight
--ld-thm-error-hover
The following examples illustrate the variables applied to background color within each theme: