Rarity

Rarity is a statistic applied to items, blocks and advancements to signify their value and ease in obtaining. The only effect rarity has on an item is the color with which their name appears when selected in the hotbar, moused over in the inventory or produced via the /give command (but not when viewed in an item frame, the contents of a shulker box or via statistics ), and has no effect on gameplay whatsoever.

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

It is not well known how rarities are handled in-game; more information is needed on this matter.