How would i convert a base 10 integer into its hex code?

Hi! I was wondering whether it's possible to convert a value like 4095 into 0x000fff. Whenever I store hexadecimals in a storage, they of course, get converted into integers, but I'm trying to use a macro to insert this color into a text component, which uses hexadecimal. I'm on 1.21.5 btw and if you need any more info just ask!
Continue to help post