Packing vec3(0-255) into a 0-255 float. Then unpacking it?

So I have a situation where I need to store a color and position into a single buffer.

I assumed that packing the vec3s into single floats should be easy… (famous last words)

But for some reason this is way way off. I don’t need much accuracy just a general value that is an approximation of the original.

Any ideas how to do this better?

This is super close but I cant pack green?

Got it.