HLS色空間
M a x = L + S 2 {\displaystyle Max=L+{\frac {S}{2}}}
M i n = L − S 2 {\displaystyle Min=L-{\frac {S}{2}}}
求めた最大値と最小値を、色相で場合分けした上で、RGBの各チャンネルに代入する。
( R , G , B ) = { ( Max = Min , Max = Min , Max = Min ) if H is undefined ( Max , Min + ( Max − Min ) × H 60 , Min ) if 0 ≤ H < 60 ( Min + ( Max − Min ) × 120 − H 60 , Max , Min ) if 60 ≤ H < 120 ( Min , Max , Min + ( Max − Min ) × H − 120 60 ) if 120 ≤ H < 180 ( Min , Min + ( Max − Min ) × 240 − H 60 , Max ) if 180 ≤ H < 240 ( Min + ( Max − Min ) × H − 240 60 , Min , Max ) if 240 ≤ H < 300 ( Max , Min , Min + ( Max − Min ) × 360 − H 60 ) if 300 ≤ H < 360 {\displaystyle {\begin{aligned}(R,G,B)&={\begin{cases}({\text{Max}}={\text{Min}},{\text{Max}}={\text{Min}},{\text{Max}}={\text{Min}})&{\mbox{if }}H{\mbox{ is undefined}}\\({\text{Max}},{\text{Min}}+({\text{Max}}-{\text{Min}})\times {\frac {H}{60}},{\text{Min}})&{\mbox{if }}0\leq H<60\\({\text{Min}}+({\text{Max}}-{\text{Min}})\times {\frac {120-H}{60}},{\text{Max}},{\text{Min}})&{\mbox{if }}60\leq H<120\\({\text{Min}},{\text{Max}},{\text{Min}}+({\text{Max}}-{\text{Min}})\times {\frac {H-120}{60}})&{\mbox{if }}120\leq H<180\\({\text{Min}},{\text{Min}}+({\text{Max}}-{\text{Min}})\times {\frac {240-H}{60}},{\text{Max}})&{\mbox{if }}180\leq H<240\\({\text{Min}}+({\text{Max}}-{\text{Min}})\times {\frac {H-240}{60}},{\text{Min}},{\text{Max}})&{\mbox{if }}240\leq H<300\\({\text{Max}},{\text{Min}},{\text{Min}}+({\text{Max}}-{\text{Min}})\times {\frac {360-H}{60}})&{\mbox{if }}300\leq H<360\end{cases}}\end{aligned}}}