Skip to content

Commit

Permalink
Fixed color parser
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDog3112 committed May 11, 2024
1 parent 88ae544 commit d7e2be0
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ function load_animated() {
* @returns {Color}
*/
function parseColor(color) {
let num = Number("0x" + color.trim().substring(1));
let num = Number("0x" + color.trim().substring(1,7));

if (Number.isNaN(num)) {
throw new Error("Failed to parse color!");
}

let first = Math.floor(num/Math.pow(16,4));
let second = Math.floor((num/Math.pow(16,2))%256);
let third = Math.floor(num%256);
Expand Down

0 comments on commit d7e2be0

Please sign in to comment.