Skip to content

Commit

Permalink
messed up again
Browse files Browse the repository at this point in the history
  • Loading branch information
LilyBwossom committed Nov 9, 2024
1 parent d2292ee commit 97465b0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions hazy.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,24 @@
}
}

//creates a list of rgb values from image data
const buildRgb = (imageData) => {
const rgbValues = [];
// note that we are loopin every 4!
// for every Red, Green, Blue and Alpha
for (let i = 0; i < imageData.length; i += 4) {
const rgb = {
r: imageData[i],
g: imageData[i + 1],
b: imageData[i + 2],
};

rgbValues.push(rgb);
}

return rgbValues;
};

//converts RGB to Hex
function rgbToHex(r, g, b) {
return "#" + [r, g, b].map(x => x.toString(16).padStart(2, '0')).join('');
Expand Down

0 comments on commit 97465b0

Please sign in to comment.