Skip to content

Commit

Permalink
Side red in warning area
Browse files Browse the repository at this point in the history
  • Loading branch information
1-alex98 committed Feb 17, 2021
1 parent b9d0d78 commit 136bf26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "microphone-electron",
"productName": "This is too loud",
"version": "1.0.0",
"version": "2.0.13",
"description": "Warns you if you are too loud",
"main": "main.js",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions view.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ let threshold;
window.requestAnimationFrame(render);

function render() {
const min = 15;
const min = 10;
const max = 100;

let fraction = Math.max(0, (volumeWrapper.volume - min) / (max - min) * 100);
threshold = slider.value / 100 * (max - min) + min;

let darker = "#58fa72";
let brighter = "#eee";
let brighterOk = "#eee";
let brighterWarn = "#ea9999";
if (volumeWrapper.volume > threshold) {
darker = "#f64b4b";
brighter = "#eee";
}

handleBar.style.backgroundImage = "-webkit-linear-gradient(0deg, " + darker + " " + fraction + "%, " + brighter + " " + fraction + "%)";
handleBar.style.backgroundImage = "-webkit-linear-gradient(0deg, " + darker + " " + fraction + "%, " + brighterOk + " " + fraction + "%, "+ brighterOk+" "+ slider.value +"%, "+brighterWarn+" "+slider.value +"% )";

window.requestAnimationFrame(render);
}
Expand Down

0 comments on commit 136bf26

Please sign in to comment.