r-markdownbulletedlist

Is there a way to add color to a bulleted list?


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>

Solution

  • 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