Themes

Theme properties are part of IconSet class in Iconify Tools.

Themes are used to quickly place icons in categories based on part of icon name without listing every single icon.

There are two properties:

  • prefix is for prefixes, such as "baseline" in "baseline-home".
  • suffix is for suffixes, such as "twotone" in "home-twotone".

You can write to properties directly to update values.

Structure

Both are simple objects Record<string, string>, where:

  • key is part of icon name, can be empty string
  • value is title

Examples

Examples below show suffixes. Prefixes work just like suffixes, but compare first part of icon.

Example of suffixes list:

{
   "line": "Line",
   "solid": "Solid"
}

Prefixes and suffixes should not start or end with "-".

All icons that end with "-line" belong to "Line" category, all icons that end with "-solid" belong to "Solid" category.

If icon ends with something else, like "-outline", it will not belong to "Line" category because icons are checked for '-' + suffix (or prefix + '-' for prefixes).

Multiple similar items

There can be multiple matching suffixes, such as "24-line" and "line".

There can also be empty suffix (and prefix), which matches icons that do not match other suffixes.

Example of suffixes:

{
   "24-line": "Line 24",
   "line": "Line",
   "": "Other"
}

Icon "home-24-line" will belong to "Line 24" suffix, icon "home-20-line" will belong to "Line" suffix, icon "home-solid" will belong to "Other" suffix.

Order of suffixes and prefixes does not matter. They are sorted by length (longest first) before matching icons to make sure icons are placed in correct theme regardless of order.

Finding icons

To find which icons belong to which theme, use checkTheme() function.