JSFiddle - React, Tailwind, and code Playground

HTML

<pre></pre>

JavaScript

h= (r,g,b)=>([x,y,z]=[r,g,b].sort((a,b)=>b-a),m=x-z,(x-r?x-g?r-g+4*m:b-r+2*m:g-b+6*m)/m%6*60)

log = s => {document.querySelector("pre").textContent += s + "\n";}

log("0, 182, 255");
log(h(0, 182, 255));
log("\n");

log("127, 247, 103");
log(h(127, 247, 103));
log("\n");

log("0, 0, 1");
log(h(0, 0, 1));
log("\n");

log("255, 165, 245");
log(h(255, 165, 245));