diff --git a/.gitignore b/.gitignore index ebc5fe3e2..d07bcc884 100644 --- a/.gitignore +++ b/.gitignore @@ -112,5 +112,7 @@ docs/public/ # Typedoc generated files modules/**/generated/ -# PyCharm -.idea \ No newline at end of file +# PyCharm and Mac +.idea +.DS_store +*.swp diff --git a/modules/ROOT/pages/customize-icons.adoc b/modules/ROOT/pages/customize-icons.adoc index 7f500ba09..1bf01eb29 100644 --- a/modules/ROOT/pages/customize-icons.adoc +++ b/modules/ROOT/pages/customize-icons.adoc @@ -10,7 +10,7 @@ You can customize the icons on a ThoughtSpot page using an icon sprite SVG file To override an icon: -. Open the ThoughtSpot application page and locate the icon that you want to replace. +. Open the ThoughtSpot application page and locate the icon you want to replace. .. Right-click on the icon and select *Inspect*. .. Inspect the `` element. .. Note the icon ID. @@ -69,3 +69,61 @@ a|**After** + image::./images/post-icon-override.png[After icon override] |====== +== Creating an icon override +The basic structure of an icon override file is shown in the following snippet: + +[source,svg] +---- + + + + + + +---- + +The `` portion within the `` tags is the definition of the actual drawing. + +You are defining a small icon, so it should fit within a square boundary and have a single solid color. + +There are many simple SVG icon examples available online, for example, the link:https://www.svgviewer.dev/[SVG viewer site, window=_blank]. + +You only need to copy the `` tags from your example SVG within the ` ` tags. + +=== viewBox property + +The link:https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/viewBox[viewBox property^] is in the order `min-x`, `min-y`, `width`, and `height`. + +The first two properties should be `0 0` while the second should match any `width` and `height` properties from the source of your SVG paths. + +The `width` and `height` properties may be added directly in the `` tag, or as part of `viewBox` property in that tag, or perhaps in another tag above ``. Use the values from your source SVG in the `viewBox` property of the `` element within your override file. + +=== fill property +You can add the `fill` property to the `` tag to define a different fill color than the default: + +[source,svg] +---- + +---- + +== Testing an icon override file +The +++Visual Embed SDK Playground +++ allows you to try out the icon customization framework. + +To view the code for customization: + +. Select the *Apply custom styles* checkbox in the Playground. + +The `customizations` code appears for CSS modifications appears in the code panel. +. Replace the `customization` section with the following code and click *Run* to view the results: ++ +[source,JavaScript] +---- + customizations: { + iconSpriteUrl: "https://cdn.jsdelivr.net/gh/thoughtspot/custom-css-demo/icon-override1.svg" + } +---- + +[NOTE] +==== +The `cdn.jsdeliver.net` domain is allowed on ThoughtSpot Embedded link:https://try-everywhere.thoughtspot.cloud/v2/#/everywhere/playground/search[public playground] and trial sites. +On your ThoughtSpot application instance, make sure to add the domain that will host the SVG file to xref:security-settings.adoc#csp-trusted-domain[the *CSP img-src domains* allowlist]. +==== \ No newline at end of file