
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
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.](https://content.bartleby.com/qna-images/question/df5b15e2-e6d6-41f9-adf4-8004644211b0/6f695823-8d94-4c20-b7ca-78f7da105cf2/koc91jk_thumbnail.jpeg)
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 4 steps with 2 images

Knowledge Booster
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.Similar questions
- When are we going to get a break? The impact on context switching is unclear.arrow_forwardThe idea of RZ and the idea of NRZ-L are combined into the Manchester scheme. Explain?arrow_forwardDraw diagrams like the one at the top of page 428 for the two cases at the bottom of the diagram at the bottom of the same page (both examples labelled right).arrow_forward
- What's the problem with the fracture risk algorithm?arrow_forwardI need to figure out the criteria and constraints for an online coding robot. Having trouble distinguishing between the two (I can see the constraints clearly). the steps are as follows: stand up, sit down, take a step (must be standing), turn (right turn only -90 degrees), raise arms (must be standing), lower arms, add one to memory, subtract one from memory, test:touching anything? (must be standing with arms raised),test:touching door? (must be standing with arms raised), test: is number in memory zero?, repeat instructions (x) time, open door (must be standing with arms raised), stop (otto will not shut down without a stop command and his battery will not recharge)arrow_forwardDescribe the plot of the first chapter of the great gatsby.in your description include how the setting affect the plot.use example from the text to support your descriptionarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education