Themed SVG Images
Overview
SVG (scalable vector graphics) is a format for vector images. The main benefit to vector images is that they can scale to any size without degradation, but another benefit is that simple monochrome SVG images can have their color themed just like text. This helps these images visually blend in with the rest of the application in a harmonious way.
These kinds of images are ideal for displaying a logo within the application. We support theming for these SVG images in the header and in the function content area. SVG images in the content area can have either regular styling or bright styling.
There are constraints on the kind of SVG file that can be themed. You should communicate these constraints to whoever designs the SVG file.
- The SVG must be monochrome (namely black).
- The SVG must only specify elements that have a fill attribute, such as paths. Our theming specifies values for the fill attribute in the SVG’s elements. Try to simplify the SVG to as few paths as possible.
- All fill values in the SVG must be pure black and all stroke values must be transparent. Otherwise the SVG may include internal CSS that interferes with our external theming.
- The SVG content must be specified inline within your HTML. We cannot externally theme an SVG in an img tag or an SVG used as the background of another element. You can copy/paste the content from svg file into your HTML.
Development
Web component development
SVG in the Header
- Put the svg content in the header, within the
rui-header-left
element.- If you use an SVG image for your application title, do not also use the
rui-header-title
component.
- If you use an SVG image for your application title, do not also use the
- Apply the
rui-header-svg
CSS class to the SVG tag. - Specify an appropriate width for the SVG tag.
- Do not specify the height; that is hardcoded to 50px by the theming.
SVG in the Content
- Put the svg content in the appropriate place in the page content.
- Apply the
rui-content-regular-svg
CSS class to the SVG for regular styling (same color asrui-regular-text-label
) or therui-content-bright-svg
CSS class for bright styling (same color asrui-bright-text-label
). - Specify an appropriate width for the SVG tag.
Angular wrapper development
SVG in the Header
- Put the svg content in the header, within the
jha-header-left
element.- If you use an SVG image for your application title, do not also use the
jha-header-title
component.
- If you use an SVG image for your application title, do not also use the
- Apply the
jha-header-svg
CSS class to the SVG tag. - Specify an appropriate width for the SVG tag.
- Do not specify the height; that is hardcoded to 50px by the theming.
SVG in the Content
- Put the svg content in the appropriate place in the page content.
- Apply the
jha-content-regular-svg
CSS class to the SVG for regular styling (same color asjha-regular-text-label
) or thejha-content-bright-svg
CSS class for bright styling (same color asjha-bright-text-label
). - Specify an appropriate width for the SVG tag.
Design
Place the SVG into either the header or the function content area.
Set the SVG’s fill to either the regular text color or the bright text color.