Split Background Colour

Hello, I am very new to processing, but I have an assignment that requires me to split the screen with blue on top and green on the bottom. I know it’s very basic, but I can’t find anything about it in the processing reference or in the forum. I would really appreciate some help!

Thank you!

1 Like

Make background() green and draw a blue fill() rect() at the top w/ half height. :black_square_button:

1 Like

thank you so much! :grin:

You may also need to use noStroke() to eliminate outlines.

After mastering it with background(), you may also want to move to using two rect() calls with different fill(). This is the next step before putting those rects in a loop, so that you can have 2, 3, or 4 bands of color on the screen.

1 Like

Studio.ProcessingTogether.com/sp/pad/export/ro.9PDcp7xMBknWz

1 Like

I am trying to add a RGB color mode in full screen like this website - https://whitescreentest.com. Normally screen is white, after click it turns red, then green, then blue on every successive click. Can anyone help me implementing this.

Here’s one way (not sure how you’re going to get out of the fullscreen):

int counter = 0;

color WHITE = color(255, 255, 255);
color RED = color(255, 0, 0);
color BLUE = color(0, 0, 255);
color GREEN = color(0, 255, 0);

void setup() {
  fullScreen();
}

void draw() {
 switch(counter){
   case 0: background(WHITE);
   break;
   case 1: background(RED);
   break;
   case 2: background(BLUE);
   break;
   case 3: background(GREEN);
   break;
 }
  
}

void mousePressed(){
  counter++;
  if(counter > 3){
    counter = 0;
  }
}