---
title: "Comment by Kylon Tyner on \"Custom Properties in CSS : A handful approach to write your code\" | Hashnode"
description: "Excellent write-up! Something I&#39;ve found annoying with the variables is that if you create a variable like this: --clr-primary : #fa0e9d ; you can&#39;t the"
url: "https://hashnode.com/posts/custom-properties-in-css-a-handful-approach-to-write-your-code/60fd0b7718fbbb77c946706d/comment/6100a83b2db92534dc931deb"
---

[Discussion](https://hashnode.com/posts/custom-properties-in-css-a-handful-approach-to-write-your-code/60fd0b7718fbbb77c946706d)

Comment [Custom Properties in CSS : A handful approach to write your code](https://hashnode.com/posts/custom-properties-in-css-a-handful-approach-to-write-your-code/60fd0b7718fbbb77c946706d)

[Kylon Tyner](https://hashnode.com/@ktyner)

[Jul 28, 2021](https://hashnode.com/posts/custom-properties-in-css-a-handful-approach-to-write-your-code/60fd0b7718fbbb77c946706d/comment/6100a83b2db92534dc931deb)

Excellent write-up! Something I've found annoying with the variables is that if you create a variable like this:

```
--clr-primary: #fa0e9d;
```

you can't then use that variable like so:

```
background-color: rgba(var(--clr-primary), 0.5)
```

A solution I've found is to create 2 variables:

```
:root {
  --clr-primary: rgb(var(--clr-primary-rgb));
  --clr-primary-rgb: 250, 14, 157;
}

.otherElement {
  background-color: rgba(var(--clr-primary-rgb), 0.5);
}
```

Cheers 🍻

[Saurav Purohit](https://hashnode.com/@saurav017)

[Jul 29, 2021](https://hashnode.com/posts/custom-properties-in-css-a-handful-approach-to-write-your-code/60fd0b7718fbbb77c946706d/comment/6100a83b2db92534dc931deb#reply-61023ae4d3dd5634ae9091e4)

Thanks for adding Mate😃🙏🏻
