# Program which changes the color of a circle based on which key is pressed

**URL:** https://discourse.processing.org/t/program-which-changes-the-color-of-a-circle-based-on-which-key-is-pressed/7233
**Category:** Coding Questions
**Created:** [January 5, 2019, 10:02pm UTC](https://discourse.processing.org/t/program-which-changes-the-color-of-a-circle-based-on-which-key-is-pressed/7233 "2019-01-05T22:02:18Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Umar2003](https://avatars.discourse-cdn.com/v4/letter/u/8e8cbc/32.png) [@Umar2003](https://discourse.processing.org/u/Umar2003)
#### Post date: [January 5, 2019, 10:02pm UTC](https://discourse.processing.org/t/program-which-changes-the-color-of-a-circle-based-on-which-key-is-pressed/7233/1 "2019-01-05T22:02:18Z")

</div>

I’m trying to write a Write a program which changes the color of a circle based on which key is pressed. Here are  
the colors and their corresponding keys:  
Nothing Pressed - Black  
Y - Yellow  
G - Green  
R - Red  
B - Blue  
O - Orange  
P - Purple

---

<div class="post-metadata">

### Author: ![figraham](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/figraham/32/4161_2.png) [@figraham](https://discourse.processing.org/u/figraham)
#### Post date: [January 5, 2019, 10:10pm UTC](https://discourse.processing.org/t/program-which-changes-the-color-of-a-circle-based-on-which-key-is-pressed/7233/2 "2019-01-05T22:10:13Z")

</div>

Are you asking for project guidance? I suggest you work off of the [keyboard example](https://processing.org/examples/keyboard.html) and use the [background()](https://processing.org/reference/background_.html) function to change the color.

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [January 5, 2019, 10:13pm UTC](https://discourse.processing.org/t/program-which-changes-the-color-of-a-circle-based-on-which-key-is-pressed/7233/3 "2019-01-05T22:13:44Z")

</div>

Also look in reference at fill and ellipse()

---

<div class="post-metadata">

### Author: ![figraham](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/figraham/32/4161_2.png) [@figraham](https://discourse.processing.org/u/figraham)
#### Post date: [January 5, 2019, 10:29pm UTC](https://discourse.processing.org/t/program-which-changes-the-color-of-a-circle-based-on-which-key-is-pressed/7233/5 "2019-01-05T22:29:37Z")

</div>

That’s not really the purpose of the forum. It’s supposed to be meant to help people learn and collaborate. I’d be happy to recommend many great resources on how to learn how to use Processing or help you debug existing code. But if you’d just like someone to do the work for you then I suggest you hire someone.

---

<div class="post-metadata">

### Author: ![Sky](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sky/32/3013_2.png) [@Sky](https://discourse.processing.org/u/Sky)
#### Post date: [January 6, 2019, 10:35am UTC](https://discourse.processing.org/t/program-which-changes-the-color-of-a-circle-based-on-which-key-is-pressed/7233/7 "2019-01-06T10:35:37Z")

</div>

I give you a hint, with the code from the ‘I’ ‘E’ ‘F’, you can do the same thing, but with fill() and ellipse(). Just remember to write background(255)(white color) at the beginning of draw() to update the screen

---

<div class="post-metadata">

### Author: ![Eeyorelife](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@Eeyorelife](https://discourse.processing.org/u/Eeyorelife)
#### Post date: [January 6, 2019, 10:47am UTC](https://discourse.processing.org/t/program-which-changes-the-color-of-a-circle-based-on-which-key-is-pressed/7233/8 "2019-01-06T10:47:21Z")

</div>

If you try to do it yourself and post the resulting code here we can help you achieve your goal. But no one is going to do it for you.
