How to link function to primitive

I downloaded a copy of the source code and was messing around to see how it worked when I managed to make colors first-class. How can I link the function I made to the primitive, I am trying to make a primitive to set the rgba values of the color?

I suggest you read the code of the Colors and Crayons library, which has blocks to do anything in color space.

I already have written the function I will use but when I run the block it gives me the error "Type error cannot read properties of undefined (reading 'apply')" I think this is because selector is null but I don't no where that is set for the other primitives such as move 10 steps.

Oh, I see, you're modding Snap!. I missed that part.

Look in objects.js pretty near the beginning.

I got it working, thank you for the help.