How to resolve the algorithm Colour bars/Display step by step in the Processing programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Colour bars/Display step by step in the Processing programming language

Table of Contents

Problem Statement

Display a series of vertical color bars across the width of the display. The color bars should either use:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Colour bars/Display step by step in the Processing programming language

Source code in the processing programming language

fullScreen();
noStroke();
color[] cs = {
  color(0),         // black
  color(255,0,0),   // red
  color(0,255,0),   // green
  color(255,0,255), // magenta
  color(0,255,255), // cyan
  color(255,255,0), // yellow
  color(255)        // white
};
for(int i=0; i<7; i++) {
  fill(cs[i]);
  rect(i*width/8,0,width/8,height);
}

  

You may also check:How to resolve the algorithm Regular expressions step by step in the Ada programming language
You may also check:How to resolve the algorithm Unix/ls step by step in the Java programming language
You may also check:How to resolve the algorithm Palindromic gapful numbers step by step in the Go programming language
You may also check:How to resolve the algorithm Associative array/Iteration step by step in the Python programming language
You may also check:How to resolve the algorithm Loops/Infinite step by step in the EMal programming language