# Can somebody help me, please (background color)

**URL:** <https://discourse.processing.org/t/can-somebody-help-me-please-background-color/33996>\
**Category:** Processing\
**Created:** [December 8, 2021, 10:42am UTC](https://discourse.processing.org/t/can-somebody-help-me-please-background-color/33996 "2021-12-08T10:42:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Toxodera](https://avatars.discourse-cdn.com/v4/letter/t/91b2a8/32.png) [@Toxodera](https://discourse.processing.org/u/Toxodera)\
**Post date:** [December 8, 2021, 10:42am UTC](https://discourse.processing.org/t/can-somebody-help-me-please-background-color/33996/1 "2021-12-08T10:42:36Z")

</div>

Hello,  
I’m new to processing and I need help with my code. How can I switch my background to another colour when I click something on my mouse? And How can I code the sun to move?  
void setup()  
{  
size(800,600);  
background(#7DD1E5,20);  
}  
void draw()  
{  
fill(#E5CB00,100);  
stroke(#FFF41A,50);  
ellipse(50, 100, 100, 100);  
fill(#FFF41A,50);  
ellipse(50, 100, 60, 60);  
ellipse(50, 100, 55, 55);  
ellipse(50, 100, 50, 50);  
ellipse(50, 100, 45, 45);  
ellipse(50, 100, 40, 40);  
ellipse(50, 100, 35, 35);  
ellipse(50, 100, 30, 30);

fill(#FFFFFF,50);  
noStroke();  
circle(100, 150, 50);  
circle(70, 150, 50);  
circle(130, 150,50);  
circle(160, 150,50);  
circle(85, 120,50);  
circle(115, 120,50);  
circle(145, 120,50);

circle(365, 250, 50);  
circle(335, 250, 50);  
circle(395, 250, 50);  
circle(425, 250, 50);  
circle(350, 220, 50);  
circle(380, 220, 50);  
circle(410, 220, 50);

circle(650, 100, 50);  
circle(620, 100, 50);  
circle(680, 100, 50);  
circle(710, 100, 50);  
circle(635, 70, 50);  
circle(665, 70, 50);  
circle(695, 70, 50);

stroke(5); // Haus  
strokeWeight(5);  
fill(#E54C57);  
square(25,325,250);

strokeWeight(2);  
fill(#8B4513);  
rect(100,430,100,145);  
strokeWeight(1);  
fill(#CD853F);  
rect(140,430,20,145);  
rect(100,480,100,20);

noStroke();  
fill(#585A57);  
rect(175,485,20,10);

fill(#111112);  
rect(200,200,50,125);

stroke(0);  
strokeWeight(3);  
fill(#CD853F);  
triangle(10,325,150,200,290,325);

stroke(50);  
strokeWeight(5);  
fill(#857F86,200);  
rect(-5,575,70,70);  
rect(67,575,70,70);  
rect(137,575,70,70);  
rect(207,575,70,70);  
rect(277,575,70,70);  
rect(347,575,70,70);  
rect(417,575,70,70);  
rect(487,575,70,70);  
rect(557,575,70,70);  
rect(627,575,70,70);  
rect(697,575,70,70);  
rect(767,575,70,70);  
}

---

<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:** [December 8, 2021, 11:32am UTC](https://discourse.processing.org/t/can-somebody-help-me-please-background-color/33996/2 "2021-12-08T11:32:30Z")

</div>

you can store the background col in a variable

`color colBackground = coor (#7DD1E5);`

and change it in `mousePressed()` function

**Example**

```auto
color colBackground = color (#7DD1E5, 20); 

void setup() {
  size(800, 600);
  background(#7DD1E5, 20);
}

void draw() {

  background(colBackground);

  fill(#E5CB00, 100);
  stroke(#FFF41A, 50);
  ellipse(50, 100, 100, 100);
  fill(#FFF41A, 50);
  ellipse(50, 100, 60, 60);
  ellipse(50, 100, 55, 55);
  ellipse(50, 100, 50, 50);
  ellipse(50, 100, 45, 45);
  ellipse(50, 100, 40, 40);
  ellipse(50, 100, 35, 35);
  ellipse(50, 100, 30, 30);
}

void mousePressed() {
  colBackground = color (255, 0, 0, 20);
}

```

* * *

**Move sun**

here is a moving sun with 2 variables x,y

```auto

int x, y; 

void setup()
{
  size(800, 600);
  background(#7DD1E5, 20);
}
void draw()
{
  background(#7DD1E5, 20);

  pushMatrix();
  translate(x, y); 
  x++;
  fill(#E5CB00, 100);
  stroke(#FFF41A, 50);
  ellipse(50, 100, 100, 100);
  fill(#FFF41A, 50);
  ellipse(50, 100, 60, 60);
  ellipse(50, 100, 55, 55);
  ellipse(50, 100, 50, 50);
  ellipse(50, 100, 45, 45);
  ellipse(50, 100, 40, 40);
  ellipse(50, 100, 35, 35);
  ellipse(50, 100, 30, 30);

  popMatrix(); 

  fill(#FFFFFF, 50);
  noStroke();

  stroke(5); // Haus
  strokeWeight(5);
  fill(#E54C57);
  // square(25, 325, 250);

  strokeWeight(2);
  fill(#8B4513);
  rect(100, 430, 100, 145);
  strokeWeight(1);
  fill(#CD853F);
  rect(140, 430, 20, 145);
  rect(100, 480, 100, 20);

  noStroke();
  fill(#585A57);
  rect(175, 485, 20, 10);

  fill(#111112);
  rect(200, 200, 50, 125);

  stroke(0);
  strokeWeight(3);
  fill(#CD853F);
  triangle(10, 325, 150, 200, 290, 325);

  stroke(50);
  strokeWeight(5);
  fill(#857F86, 200);
  rect(-5, 575, 70, 70);
  rect(67, 575, 70, 70);
  rect(137, 575, 70, 70);
  rect(207, 575, 70, 70);
  rect(277, 575, 70, 70);
  rect(347, 575, 70, 70);
  rect(417, 575, 70, 70);
  rect(487, 575, 70, 70);
  rect(557, 575, 70, 70);
  rect(627, 575, 70, 70);
  rect(697, 575, 70, 70);
  rect(767, 575, 70, 70);
}

```

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [December 8, 2021, 12:15pm UTC](https://discourse.processing.org/t/can-somebody-help-me-please-background-color/33996/3 "2021-12-08T12:15:19Z")

</div>

Hello,

There are lots of resources (tutorials, references, examples, etc.) here:

> **[Welcome to Processing!](https://processing.org/)**
>
> Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Since 2001, Processing has promoted software literacy within the visual arts…

`:)`
