# Creating color variables

**URL:** <https://forum.code.org/t/creating-color-variables/39178>\
**Category:** Unit and Lesson Discussion\
**Created:** [March 21, 2024, 1:48pm UTC](https://forum.code.org/t/creating-color-variables/39178 "2024-03-21T13:48:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthew.fundak](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@matthew.fundak](https://forum.code.org/u/matthew.fundak)\
**Post date:** [March 21, 2024, 1:48pm UTC](https://forum.code.org/t/creating-color-variables/39178/1 "2024-03-21T13:48:49Z")

</div>

We are doing CS Discoveries Unit 5 - Variables (Animation/gaming lab). The one lesson shows you how to create a color variable and call it. When the kids create their own color variables in another sub lesson it says they aren’t calling the variable. Why would that be.

Example:  
var color1 = “tan”  
fill(“tan”)

This should work, but it says the variable isn’t being called.

---

<div class="post-metadata">

**Author:** ![Binary\_Coder](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/binary_coder/32/8618_2.png) [@Binary\_Coder](https://forum.code.org/u/Binary_Coder)\
**Post date:** [March 21, 2024, 3:06pm UTC](https://forum.code.org/t/creating-color-variables/39178/2 "2024-03-21T15:06:46Z")

</div>

Not sure if I understand your problem, but if it’s that you get the error “color1 is defined, but it’s not called in your program”, then it can be fixed by calling `color1` instead of hard-coding a value:

```auto
var color1 = "tan";
fill(color1);

```

---

<div class="post-metadata">

**Author:** ![matthew.fundak](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@matthew.fundak](https://forum.code.org/u/matthew.fundak)\
**Post date:** [March 21, 2024, 3:27pm UTC](https://forum.code.org/t/creating-color-variables/39178/3 "2024-03-21T15:27:26Z")

</div>

It does not say it’s not defined. It says it isn’t being used, which is not true. I have kids that have the same code and it works for one but not the other. This is actually the first time I have ever had this occur on this particular lesson.

---

<div class="post-metadata">

**Author:** ![Binary\_Coder](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/binary_coder/32/8618_2.png) [@Binary\_Coder](https://forum.code.org/u/Binary_Coder)\
**Post date:** [March 21, 2024, 4:10pm UTC](https://forum.code.org/t/creating-color-variables/39178/4 "2024-03-21T16:10:53Z")

</div>

Sorry, I mistyped my question. I should have asked if you were getting this message:  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/codeorgforum/original/2X/5/5e8d3024ade253b902f7fe54017673cce524cce8.png)  
In which case my code above will fix the issue, though sometimes that error message will appear even if that issue has already been resolved.

But if the same code crashes the program for some students and not for others, then it’s more likely a problem with the lesson and I can’t help you.

---

<div class="post-metadata">

**Author:** ![melynn](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/melynn/32/4925_2.png) [@melynn](https://forum.code.org/u/melynn)\
**Post date:** [March 21, 2024, 8:58pm UTC](https://forum.code.org/t/creating-color-variables/39178/5 "2024-03-21T20:58:42Z")

</div>

@matthew.fundak,

Yes, @Binary_Coder is correct. You created the **color1** variable and gave it a value of “tan”. To use the variable, you should reference the variable name **color1**.

If you are having issues with other lessons, post a shared link to the code and we’ll take a look to see why there may be an error.

~Michelle
