As there is no colorize feature in markdown, you'll need to generate text that make the colorization depending on your output. See this chapter in the Rmarkdown cookbook:
Example for HTML:
---
title: "R Notebook"
output: html_document
---
```{r, include=FALSE}
color_if <- function(var) {
color <- if (var > 1) "green" else "red"
sprintf("<span style='color: %s;'>%s</span>", color, var)
}
```
A value less than 1 is `r color_if(0.5)`.
A value above 1 is `r color_if(2)`