changecolorfromsvg-url
Service icon

ChangeColorFromSVG_URL

Stable version 1.0.0 (Compatible with OutSystems 11)
Uploaded
 on 09 January 2024
 by 
0.0
 (0 ratings)
changecolorfromsvg-url

ChangeColorFromSVG_URL

Details
function allows you to modify the color of an SVG file provided by a URL and then converts the modified SVG to a Base64 representation. This is useful when you want to dynamically change the color of an SVG graphic or icon and embed it in a web application.
Read more
  1. ChangeColorFromURLSVG:

    • Description: This function takes a URL of an SVG image and a color as input. It downloads the SVG content from the specified URL, modifies the fill color of all path elements in the SVG to the provided color, and returns the modified SVG content as a string.
    • Parameters:
      • svgUrl (Type: string): The URL of the SVG image.
      • color (Type: string): The color to which the fill color of the SVG path elements will be changed.
  2. DownloadSvgContent:

    • Description: This private helper function is used by ChangeColorFromURLSVG to download the SVG content from a given URL.
    • Parameters:
      • url (Type: string): The URL from which to download the SVG content.
    • Return Type: string: The downloaded SVG content.
  3. ConvertSvgToBase64:

    • Description: This function converts SVG content to a Base64-encoded string. It takes SVG content as input, converts it to UTF-8 encoded bytes, and then encodes those bytes as a Base64 string.
    • Parameters:
      • svgContent (Type: string): The SVG content to be converted.
    • Return Type: string: The Base64-encoded representation of the input SVG content.
  4. ChangeColorFromURLSVGConvertToBase64:

    • Description: This function combines the functionality of ChangeColorFromURLSVG and ConvertSvgToBase64. It changes the fill color of an SVG image from a given URL and returns the modified SVG content as a Base64-encoded string.
    • Parameters:
      • svgUrl (Type: string): The URL of the SVG image.
      • color (Type: string): The color to which the fill color of the SVG path elements will be changed.
    • Return Type: string: The Base64-encoded representation of the modified SVG content.

These functions can be used to dynamically change the color of SVG images from a URL and obtain the modified image in either SVG or Base64 format.

Release notes (1.0.0)
License (1.0.0)
Reviews (0)
Team
Other assets in this category