Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Aug 21, 2023
1 parent 28111e2 commit c08e828
Show file tree
Hide file tree
Showing 57 changed files with 2,177 additions and 2,149 deletions.
14 changes: 9 additions & 5 deletions lib/colorconv.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@
* @return Array The HSV representation
*/
function rgbToHsv(r, g, b) {
r /= 255, g /= 255, b /= 255;
r /= 255;
g /= 255;
b /= 255;

const max = Math.max(r, g, b), min = Math.min(r, g, b);
let h, s = max;
const max = Math.max(r, g, b);
const min = Math.min(r, g, b);
let h;
let s = max;
const v = max;

const d = max - min;
s = max == 0 ? 0 : d / max;
s = !max ? 0 : d / max;

if (max == min) {
if (max === min) {
h = 0; // achromatic
} else {
switch (max) {
Expand Down
Loading

0 comments on commit c08e828

Please sign in to comment.