Copy link to clipboard
Copied
When I type RGB values or a hex code into Photoshop's color picker, it automatically calculates HSB values. What are the formulas used to calculate the H, S, and B values presented in the color picker tool?
Scott
H = IF(180/PI()*ATAN2(2*R-G-B,SQRT(3)*(G-B))<0,180/PI()*ATAN2(2*R-G-B,SQRT(3)*(G-B))+360,180/PI()*ATAN2(2*R-G-B,SQRT(3)*(G-B)))
S=(Max(R,G,B)-Min(R,G,B))/Max(R,G,B)
B=Max(R,G,B)/255
Copy link to clipboard
Copied
See this existing thread regarding RGB/HSB calculations:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/calculate-hue-from-rgb/td-p/12603371
Copy link to clipboard
Copied
H = IF(180/PI()*ATAN2(2*R-G-B,SQRT(3)*(G-B))<0,180/PI()*ATAN2(2*R-G-B,SQRT(3)*(G-B))+360,180/PI()*ATAN2(2*R-G-B,SQRT(3)*(G-B)))
S=(Max(R,G,B)-Min(R,G,B))/Max(R,G,B)
B=Max(R,G,B)/255