Notifications
Clear all

[Closed] Convert Hex to RGB

 PEN

Any one know if there is anything built Max Script to do this?

#646464 to [R,G,B]

2 Replies
ss = #646464 as string
cc = for k=0 to 2 collect (bit.hexasint (substring ss (1 + 2*k) 2))
color cc[3] cc[2] cc[1]

or

vv = bit.hexasint #646464
col = [0,0,0]
for k=3 to 1 by -1 do 
(
	col[k] = mod vv 256 
	vv /= 256
)
col as color

the second way is probably most cheap by performance and memory use

 PEN

Good to see that you are still around Denis. hexasint is what I was looking for.