Easily Encode and Colour SVG Icons

This pair of functions allows for easy encoding of SVG images and icons, so you no longer need to remember that annoying "data:image/svg+xml;utf8," prefix!
funcConvertRGBAColourToHexString converts a colour from the Power Apps colour type (i.e. RGBA) to a hex code. For example, funcConvertRGBAColourToHexString(Color.White) will output "#FFFFFF". This can be used in isolation or in tandem with the following function.
funcEncodeSVG will prepend given SVG text with the "data:image/svg+xml;utf8," prefix, and apply the EncodeURL() function to the given string. If a colour is also provided as one of the parameters, the function will search for any instances of 'currentColor' in the SVG text and replace it with the hex code for the given colour, allowing for easy rebranding of bootstrap / common resource icons.
No details available.
More Snippets from this Author
Loading...