How can I edit the appearance of a citation?

Hi there,

How can I colour my citation to have separate colours for the year separately from the author?
.
.
Example image of desired effect:
image

.

.

Currently I colour the citation by adding the following code at the beginning of my document: #show cite: set text(blue)
image

Thanks for your help.

You’re on the right track. Using a show rule is the way to go here.

#show cite: it => {
    show regex("\d{4}"): set text(blue)
    it
}

In case you’re unfamiliar, you can read about regex, or “regular expressions”, here. regex("\d{4}") means “match four-digit numbers”.

Note that there will still be a hyperlink for the whole citation, not just the year.

2 Likes