latexr-markdownbeamer

Change color of beamer presentation background - R Markdown


I am trying to change the background color of my beamer presentation in R Markdown, but I only want to change the background color of the cover page, but when I insert the following code, the background color change is produced for the whole presentation.

I would appreciate if you could help me with my query.

---
title: "Titulo"
subtitle: "Subtitulo"
author: "Nombre"
date: "2023-07-10"
output:
  beamer_presentation:
    incremental: true
    theme: "Rochester"
    colortheme: "default"
    fonttheme: "structurebold"
    toc: false
    slide_level: 3
    keep_tex: true
header-includes:
  - \usepackage{ragged2e}
  - \usepackage{color}
  - \usepackage{listings}
  - \AtBeginSubsection{}
  - \titlegraphic{\includegraphics[width = 3cm]{logo}}
  - \setbeamercolor{background canvas}{bg=red}
---

Solution

  • You can use the same trick as shown in https://topanswers.xyz/tex?q=1004#a1198

    ---
    title: "Titulo"
    subtitle: "Subtitulo"
    author: "Nombre"
    date: "2023-07-10"
    output:
      beamer_presentation:
        incremental: true
        theme: "Rochester"
        colortheme: "default"
        fonttheme: "structurebold"
        toc: false
        slide_level: 3
        keep_tex: true
    header-includes:
      - \usepackage{ragged2e}
      - \usepackage{listings}
      - \AtBeginSubsection{}
      - \titlegraphic{\includegraphics[width = 3cm]{example-image-duck}}
      - \makeatletter\def\ps@navigation@titlepage{\setbeamercolor{background canvas}{bg=red}\@nameuse{ps@navigation}}\addtobeamertemplate{title page}{\thispagestyle{navigation@titlepage}}{}\makeatother
    ---
    
    test
    

    enter image description here