> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jaksam-scripts.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get rarities

> Returns every rarity configured in the inventory settings, with its label and color.

Returns every rarity configured in the inventory settings, with its label and color. Useful to show the same rarity names and colors in your own shops, crafting menus or HUDs.

<CodeGroup>
  ```lua Export theme={null}
  exports['jaksam_inventory']:getRarities()
  ```

  ```lua Example theme={null}
  local rarities = exports['jaksam_inventory']:getRarities()

  for rarityId, rarity in pairs(rarities) do
      print(rarityId, rarity.label, rarity.color) -- legendary  Legendary  #f0b105
  end

  -- Color of a specific item's rarity
  local item = exports['jaksam_inventory']:getStaticItem('bread')
  local color = item.rarity and rarities[item.rarity] and rarities[item.rarity].color
  ```
</CodeGroup>

### Parameters

None

### Return value

| Name | Data Type | Description |
| - | - | - |
| `rarities` | table | Rarities keyed by their ID. Each one is `{ label = string, color = string }`, where `color` is a hex color |

### Notes

* Rarities are the ones set in the `/inventory` settings menu, and the export always returns the current ones, so you can call it whenever you need them instead of caching the result on start
* The rarity ID is the value items use in their `rarity` field (see [Get static item](/jaksam-inventory/functions/shared/get-static-item))


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.