■ hex 함수를 사용해 RGB 색상의 16진수 문자열 값을 구하는 방법을 보여준다.
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 |
redValue = 166 greenValue = 128 blueValue = 255 redHexadecimalValue = hex(redValue ).replace("0x", "") greenHexadecimalValue = hex(greenValue).replace("0x", "") blueHexadecimalValue = hex(blueValue ).replace("0x", "") print(f"#{redHexadecimalValue}{greenHexadecimalValue}{blueHexadecimalValue}") # #a680ff |