You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
import sys
|
|
import math
|
|
|
|
def hex2flt(h: str):
|
|
c_u8 = [int(h[0:2], 16), int(h[2:4], 16), int(h[4:6], 16)]
|
|
c_flt = [x / 255 for x in c_u8]
|
|
c_srgb = [x**2 for x in c_flt]
|
|
c_str = ", ".join(f"{x:7.5f}" for x in c_srgb)
|
|
print(f"[{c_str}]")
|
|
|
|
if __name__ == "__main__":
|
|
hex2flt(sys.argv[1])
|