Or when the supposed target of the slur claim it as an unoffensive word and treat like something of a term of endearment among themselves.

  • 8
    When it’s used lovingly among the community itself, and only in that case, it’s called **reappropriation. Reappropriation by the community grants no license, none at all, to use such terms from outside the community. This is the more important point than the name for such terms. – Dan Bron Jun 28 '18 at 4:35

This is called amelioration:

In linguistics, amelioration is the upgrading or elevation of a word's meaning, as when a word with a negative sense develops a positive one. Also called melioration or elevation.

Amelioration is less common than the opposite historical process, called pejoration.
Amelioration (word meanings) — Glossary of Grammatical and Rhetorical Terms

Not the answer you're looking for? Browse other questions tagged or ask your own question.