I am using biblatex (with xelatex). To be more specific I use Zotero and then I export from Zotero to the bib format.

Everything works fine but my bibliography is only in black color. That is the normal behaviour of course... However, my aim is to color each bib element differently for testing purposes in order to make sure I did not forget an element of the bib such as 'volume'. For instance I would like to apply the following color code.

    volume -> dark blue
    pages -> turqoise
    url -> brown
    title -> red
    isbn -> yellow
    booktitle -> pink
    publisher -> orange
    author -> grey
    date -> black

Is it possible to do this ?


You can change the way a field is displayed with \DeclareFieldFormat.

So all you have to do is redefine \DeclareFieldFormat for the relevant fields.

There are a few caveats, though,

  1. Not all 'fields' are fields. biblatex knows fields, lists and name lists. These three types use different \Declare...Format directives. So you need to know the type of your field

  2. You need to know the original definition if you don't want to override it completely. I'm assuming here that you still want italics and quotation marks as usual, only the colour should change.

    • Even though it is possible to patch the field format with xpatch's \xpretofieldformat, you need to know if any types get a special treatment. Because you can only patch the general or the type-specific format, but never both at the same time.

For the standard styles most formatting directives can be found in biblatex.def.

For fields this should be as easy as searching for the field, copying the \DeclareFieldFormat and adding in a \color{...} command in the definition. Don't forget that there might be several type-sepcific \DeclareFieldFormats for the same field (in the standard styles you should find them next to each other).

For lists you would do a similar thing, but you would search for \DeclareListFormat. (See publisher below.)

Names are more complicated. You first have to find out which name format the name you want to colour uses. author uses the format sortname in style=authoryear. And sortname is defined as family-given/given-family. So we copy the definition of family-given/given-family, call it coloured:family-given/given-family, add \colour{...} and tell sortname to be coloured:family-given/given-family from now on.


\usepackage[style=authoryear, backend=biber]{biblatex}


\DeclareFieldFormat{volume}{\color{DarkBlue}\bibstring{volume}~#1}% volume of a book
\DeclareFieldFormat[article,periodical]{volume}{\color{DarkBlue}#1}% volume of a journal




\DeclareFieldFormat{isbn}{\mkbibacro{ISBN}\addcolon\space \color{Yellow}#1}



       test {\ifdefvoid\namepartgiven}
       test {\ifdefvoid\namepartprefix}}



enter image description here

You can use the Biber option --validate-datamodel when compiling to help you check if your entries conform to the data model.

|improve this answer|||||
  • Hello moewe thanks so much for the answer. This is exactely what I was looking for. It works like a charm :) – S12000 Feb 24 '18 at 19:22
  • Do you know how to change the color of some item label, incuding brackets? I mean, for example, how to make red the [DK] in the bibliography entry [DK] Donald .... I'm using biber. – Sigur Mar 16 '19 at 0:03
  • @Sigur In the bibliography that would usually be the field format labelnumberwidth (for numeric styles) or labelalphawidth (for alphabetic styles). If that does not work, please ask a new question with an MWE that shows which style you use. – moewe Mar 16 '19 at 7:14
  • @moewe, many thanks. So, with \DeclareFieldFormat{labelalphawidth}{\textcolor{red}{\bibleftbracket#1\bibrightbracket}} I got all labels in red. Now, I'd like to do this for some, not all of them. Regards. – Sigur Mar 16 '19 at 12:00
  • @Sigur How do you want to tell biblatex which labels to turn red? You could use \ifkeyword, \ifentrytype or similar tests. If that does not give you what you want, please ask a new question with detailed specification of what you are after and an MWE. – moewe Mar 16 '19 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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