PART B: colorArray ToCSS(colorArray) function This function should simply take an array of three numbers from 0 to 255 and return a string that can be used as a CSS color in rgb form. For example, the input array [48, 243, 156] would return the string "rgb(48, 243, 156)".

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
What would part b look like?
PART B: colorArray ToCSS(colorArray)
function
This function should simply take an array of three
numbers from 0 to 255 and return a string that can
be used as a CSS color in rgb form. For example,
the input array [48, 243, 156] would return the string
"rgb(48, 243, 156)".
PART C: generateColors() function
This code should loop through each of the color
boxes from 0 to 4. It should first check the isLocked
array to find out if the box is locked. If the box is not
locked, then it should replace the current color in
the box with a new random color.
Replacing the color in a box involves a few steps.
First, you need to generate a new random color
using the pre-written function,
getRandomColorArray().
1. The background color of the entire box
defined by the div element should change to
the new color.
2. The text in the span element which displays
the RGB value string should change to
describe the new color.
3. The text color in the box defined by the div
element should be set to either black or
white depending on the brightness of the
color. This should be determined by
summing the red, green, and blue values. If
the sum is greater than 382, make the text
color black, otherwise make it white. For
example, the values in the color
"rgb(165,40,200)" add up to 405, meaning
the text color should be black.
Transcribed Image Text:PART B: colorArray ToCSS(colorArray) function This function should simply take an array of three numbers from 0 to 255 and return a string that can be used as a CSS color in rgb form. For example, the input array [48, 243, 156] would return the string "rgb(48, 243, 156)". PART C: generateColors() function This code should loop through each of the color boxes from 0 to 4. It should first check the isLocked array to find out if the box is locked. If the box is not locked, then it should replace the current color in the box with a new random color. Replacing the color in a box involves a few steps. First, you need to generate a new random color using the pre-written function, getRandomColorArray(). 1. The background color of the entire box defined by the div element should change to the new color. 2. The text in the span element which displays the RGB value string should change to describe the new color. 3. The text color in the box defined by the div element should be set to either black or white depending on the brightness of the color. This should be determined by summing the red, green, and blue values. If the sum is greater than 382, make the text color black, otherwise make it white. For example, the values in the color "rgb(165,40,200)" add up to 405, meaning the text color should be black.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education