Rarity

Rarity is a statistic applied to items, blocks and advancements to signify their value and ease in obtaining. It has no effect on gameplay whatsoever.

The only way to change an item's rarity is to enchant it, which brings its rarity from Common or Uncommon to Rare, or from Rare to Epic.

Displaying
Rarity is intended to display anywhere the item name does.

$$ it is shown in the following situations:
 * Item tooltips in the inventory
 * Item tooltips above the hotbar
 * Successful executions of

$$ rarity colors do not display in the following cases:
 * Item tooltips from an item frame
 * Contents tooltips from a shulker box
 * Item tooltips in the statistics screen
 * The CanPlaceOn/CanBreak tags of an item
 * Item names in the Superflat customization screen

As the "Ominous" rarity is a custom name color rather than an actual rarity, it shows in the first two above cases. Items with NBT data cannot be specified for the last three cases.