Highlighting ranks in Wikidata and Wikibase

This tip is from MisterSynergy, shared by Tagishsimon, and should really be better known (or even a default Wikibase feature).

Ranking is an important feature on Wikibase and Wikidata. For instance, it impacts what is returned by the Query Service.

Each statement in Wikidata or Wikibase has a rank, among three values:

Unfortunately, ranks are hardly visible on Wikidata, only showed by some tiny and obscure icons.

A solution is to highlight statements with preferred and deprecated ranks, changing their background colors to respectively a soft green and a soft red, using a simple CSS customization. Here is an example of a statement with deprecated rank:

You only need to modify your common.css on Wikidata (on a Wikibase instance, it would be at MediaWiki:Common.css for every user or at Special:MyPage/common.css for you only) by adding these lines:

.wb-deprecated { /* deprecated claims with red-ish background */
    background-color: #FFE0E0;
}
.wb-preferred { /* preferred claims with green-ish background */
    background-color: #E0FFE0;
}

On Wikidata, you can then check the item Arkady Babchenko (Q671985) to see the new rendering, as this item has several statements at preferred and deprecated ranks.

Update August 2020: Wikimedia Deutschland is actively working to properly tackle the problem, with a lot of interesting and more accessible solutions (T206392). Hopefully, this trick will soon be no longer necessary!

Update January 2022: Wikimedia Deutschland did not pursue their work on this issue. The Wikidata community globally activated the background coloring for statements with preferred or deprecated rank. Be aware that, when changing the rank of a statement, its background is not updated until the page is reloaded (T209138).