Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • \$\begingroup\$ 149: f=c=>eval(((document.body.innerHTML=`<font id=g color=${c}>`),getComputedStyle(g).color));rgb=(...a)=>a.map(n=>(n+256).toString(16).slice(1)).join`` \$\endgroup\$ Commented Aug 1, 2022 at 12:54
  • 3
    \$\begingroup\$ Shouldn't this be 'HTML+Javascript', since you need a DOM environment for execution? \$\endgroup\$ Commented Aug 1, 2022 at 14:43
  • \$\begingroup\$ You can do this in HTML in 74 bytes, output letter X in the actual color: <font>X<input oninput=this.parentElement.setAttribute('color',this.value) \$\endgroup\$ Commented Aug 1, 2022 at 15:18
  • \$\begingroup\$ @ccprog the goal is to output an hex string, not to set an element's color. (And you could outgolf your HTML: onevent attributes use the target as context, so this is never needed there, but setting an id on the parent makes it available as a global, so you could shave 17 bytes if I count correctly <font id=f>X<input oninput=f.setAttribute('color',value) (untested, I'm on a phone, but that doesn't answer the question anyway) (Oh and since you don't read it I don't think you need setAttribute, .color should work, if I'm not mistaken). \$\endgroup\$ Commented Aug 1, 2022 at 15:43
  • 1
    \$\begingroup\$ @Kaiido quote: "Output any representation of the resulting RGB color (including but not limited to the actual color". Otherwise, you are right: <font id=f>X<input oninput=f.color=value works just fine with 41 bytes. \$\endgroup\$ Commented Aug 1, 2022 at 16:04