# Use theme variables in a theme component

**URL:** https://meta.discourse.org/t/use-theme-variables-in-a-theme-component/65580
**Category:** Support
**Created:** [July 4, 2017, 12:06pm UTC](https://meta.discourse.org/t/use-theme-variables-in-a-theme-component/65580 "2017-07-04T12:06:59Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [July 4, 2017, 12:07pm UTC](https://meta.discourse.org/t/use-theme-variables-in-a-theme-component/65580/1 "2017-07-04T12:07:00Z")

</div>

Is there a way to use theme variables (e.g., `$primary` or `$love`) in a theme component?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [July 4, 2017, 12:15pm UTC](https://meta.discourse.org/t/use-theme-variables-in-a-theme-component/65580/2 "2017-07-04T12:15:47Z")

</div>

Should work fine in css

---

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [July 4, 2017, 12:17pm UTC](https://meta.discourse.org/t/use-theme-variables-in-a-theme-component/65580/3 "2017-07-04T12:17:31Z")

</div>

Ah. I was asking a more basic question. The theme variables are in a Sass file, right? How would I use them from a theme (or theme component) when I’m just adding CSS?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [July 4, 2017, 12:20pm UTC](https://meta.discourse.org/t/use-theme-variables-in-a-theme-component/65580/4 "2017-07-04T12:20:02Z")

</div>

They are just there, implicitly, using magic

Read through the source of the material design theme

---

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [July 4, 2017, 12:36pm UTC](https://meta.discourse.org/t/use-theme-variables-in-a-theme-component/65580/5 "2017-07-04T12:36:00Z")

</div>

Thanks, I think I got it. I was able to use them if I dropped a variable in the CSS field in the theme UI, but not in the way I’m including them (via `<link rel="stylesheet" href="…">`). I’ll look into restructuring my theme so that it plays well with the new theme architecture.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 8, 2024, 12:43pm UTC](https://meta.discourse.org/t/use-theme-variables-in-a-theme-component/65580/7 "2024-06-08T12:43:33Z")

</div>

This topic was automatically closed after 2531 days. New replies are no longer allowed.
