Skip to content

Commit

Permalink
Update background colors
Browse files Browse the repository at this point in the history
- Yellow now provides more contrast
- Add 2 second transition when color changes
  • Loading branch information
jiannazzone committed Nov 22, 2023
1 parent a94ae21 commit c26d39f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function requestPass() {
// PASS.HTML METHODS
// Gets URL search parameters for pass.html
function getURLData() {
const parameters = new URLSearchParams(document.location.search);
// const parameters = new URLSearchParams(document.location.search);
const studentName = parameters.get('name');
const studentDestination = parameters.get('destination');
const duration = parameters.get('duration');
Expand All @@ -109,12 +109,13 @@ function getURLData() {
function updateBackgroundColor() {
const date = new Date();
const timeRemaining = studentEnd - date;
const duration = parameters.get('duration');

// Update currentColor variable
if (timeRemaining < 0) {
currentColor = '#c80815'; // red
} else if (timeRemaining <= 120000) {
currentColor = '#ffc40c'; // yellow
} else if (timeRemaining <= (duration*60000) / 2) {
currentColor = '#edb500'; // yellow
} else {
currentColor = 'darkgreen';
}
Expand Down
1 change: 1 addition & 0 deletions styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ body {
text-align: center;
font-family: 'DM Serif Display', serif;
margin: 1rem;
transition: background-color 2s;
}

body, a {
Expand Down

0 comments on commit c26d39f

Please sign in to comment.