1

I would like to add color to a bulleted list within a text portion of an RMarkdown script intended for HTML. I've tried many different things that all seem to work for a single line of text, but not for multiple lines. Here is an example. The first line "I am red text" ends up rendering in red, but the bulleted list do not:

<span style="color: red;"> I am red text </span>

<span style="color: red;">

  * bullet1
  * bullet2
  * bullet3
  
</span>
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Steve
  • 73
  • 6

1 Answers1

1

EDIT

Following a new information in the comments by the OP, here is a solution for multi colored bullet lists:

---
title: "Red bullets"
author: bttomio
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

<font color='red'>

  * bullet1
  * bullet2
  * bullet3

</font>

  * bullet1
  * bullet2
  * bullet3

-output

enter image description here


You can change the CSS to change the color. I just modified the code here, adding color: red;.

Here is a simple ```.Rmd

---
title: "Red bullets"
author: bttomio
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

```{css, echo = F}
ul {
    color: red;
}
```

  * bullet1
  * bullet2
  * bullet3

Output:

enter image description here

bttomio
  • 2,206
  • 1
  • 6
  • 17
  • Thanks for the feedback. This does turn the list red for me. It also turns all bulleted lists in the document red. Is there a way to single out one bulleted list and leave the rest black? Also, being new to this, I think I would benefit from a primer on how to use CSS. Do you have any recommendations on a resource to learn the basics? – Steve Feb 15 '21 at 13:29
  • 1
    Could you please be more precise in your question? You're adding a new information here (multi colored bullet lists). I found a solution using [this answer](https://stackoverflow.com/a/56593416/13249862). I am not so sure about a primer on how to use CSS. You will find lots on information on SO and over the web. – bttomio Feb 15 '21 at 19:24
  • Perfect. That works well and looks like a very simple solution. Thanks! – Steve Feb 15 '21 at 21:37
  • can we change the bullet color only? – Ade Dyas Aug 23 '21 at 06:15
  • 1
    @AdeDyas, yes. For example: * bullet1 – bttomio Aug 25 '21 at 23:12