Skip to content

Commit f2fad4e

Browse files
committed
update milestone effects #23 #11
- instead of just the streak number changing color, now the whole `streak-div` gets a colored background that is the same as the background color of the button on the milestone "popup" - add another color for backgrounds: peach
1 parent 5a5edcb commit f2fad4e

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Wave
114114
|dark-blue |#004056|
115115
|med-blue |#2E7E8E|
116116
|light-blue |#1ADAE8|
117+
|peach |#FCBFAB|
117118
|med-orange |#DC3A04|
118119
|light-orange |#FCAF02|
119120
|red |#EB0000|
@@ -132,6 +133,10 @@ The paired colors have the following contrasts:
132133
|med-orange | white | 4.51:1 ||only used for graphical objects|
133134
|light-orange |black |11.27:1 || |
134135
|light-blue |black |12.23:1 || |
136+
|light-blue |dark-blue|6.55:1 || |
137+
|peach |dark-blue|7.05:1 || |
138+
139+
135140

136141

137142
Web Disability Simulator

assets/css/style.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
--dark-blue: #004056;
44
--med-blue: #2E7E8E;
55
--light-blue: #1ADAE8;
6+
--peach: #FCBFAB;
67
--med-orange: #DC3A04;
78
--light-orange: #FCAF02;
89
--red: #EB0000;
@@ -223,6 +224,7 @@ a {
223224
display: flex;
224225
margin-top: 1rem;
225226
font-size: large;
227+
padding: 0.2rem;
226228
}
227229

228230
/* the number showing the user's perfect streak count */

assets/js/script.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ const solutionDiv = document.getElementById('solution');
3333
const submitButton = document.getElementById('submit-button');
3434
// the New Game button
3535
const newGameButton = document.getElementById('new-game-button');
36-
// the streak counter from the bottom of the page
36+
// the streak counter at the bottom of the page
3737
const streakCounter = document.getElementById('streak-counter');
38+
// the div containing the perfect streak text and counter at the bottom of the page
39+
const streakDiv = document.getElementById('streak-div');
3840

3941
// Milestones
4042
const milestoneSection = document.getElementById('milestone-section');
@@ -380,7 +382,7 @@ function showMilestones() {
380382
switch (streak) {
381383
case 0:
382384
// change color of streak number
383-
streakCounter.style.color='black';
385+
streakDiv.style.backgroundColor='var(--white)';
384386
break;
385387
case 1:
386388
// set streak milestone color
@@ -392,9 +394,9 @@ function showMilestones() {
392394
streakDisplay.textContent = streak;
393395
streakText.style.backgroundColor=color;
394396
// change color of Continue button
395-
continueGameButton.style.backgroundColor=buttonColor;
396-
// change color of streak number
397-
streakCounter.style.color=color;
397+
continueGameButton.style.backgroundColor = buttonColor;
398+
// change color of the streak div
399+
streakDiv.style.backgroundColor = buttonColor;
398400
// run new game after milestone "popup"
399401
newGame();
400402
break;
@@ -408,25 +410,25 @@ function showMilestones() {
408410
streakDisplay.textContent = streak;
409411
streakText.style.backgroundColor=color;
410412
// change color of Continue button
411-
continueGameButton.style.backgroundColor=buttonColor;
412-
// change color of streak number
413-
streakCounter.style.color=color;
413+
continueGameButton.style.backgroundColor = buttonColor;
414+
// change color of the streak div
415+
streakDiv.style.backgroundColor = buttonColor;
414416
// run new game after milestone "popup"
415417
newGame();
416418
break;
417419
case 3:
418420
// set streak milestone color
419421
color = 'var(--med-orange)';
420-
buttonColor = 'var(--light-orange)';
422+
buttonColor = 'var(--peach)';
421423
// show the `milestoneSection`
422424
showMilestone();
423425
// show streak count on `milestoneSection`
424426
streakDisplay.textContent = streak;
425427
streakText.style.backgroundColor=color;
426428
// change color of Continue button
427-
continueGameButton.style.backgroundColor=buttonColor;
428-
// change color of streak number
429-
streakCounter.style.color=color;
429+
continueGameButton.style.backgroundColor = buttonColor;
430+
// change color of the streak div
431+
streakDiv.style.backgroundColor = buttonColor;
430432
// run new game after milestone "popup"
431433
newGame();
432434
break;

0 commit comments

Comments
 (0)