Is it possible to change the bullet colors in Xaringan presentation? The text should have a different color.
I have not find any option in xaringanthemer package neither going through the css file. I could not find any information remark.js documentation.
You can change the bullet point colour by adding a custom CSS to the YAML header of your Xaringan presentation.
Following is a fully reproducible minimal example.
Markdown file
title: "Example"
author: "Author"
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
css:
- default
- default-fonts
- custom.css
lib_dir: libs
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
---
```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
```
## Change bullet point colour
* An item
* Another item
Custom custom.css
We have taken the relevant CSS code to theme the bullet points from here.
ul {
list-style: none; /* Remove default bullets */
}
ul li::before {
content: "\2022"; /* Add content: \2022 is the CSS Code/unicode for a bullet */
color: red; /* Change the color */
font-weight: bold; /* If you want it to be bold */
display: inline-block; /* Needed to add space between the bullet and the text */
width: 1em; /* Also needed for space (tweak if needed) */
margin-left: -1em; /* Also needed for space (tweak if needed) */
}
Output
xaringan output is html so you can change any parts by css (e.g. using this guide to change bullet color to a red dot. Taking this as a template, you can add this chunk soon after the YAML of the Rmd to change it to a red bullet:
```{css, echo=F}
ul {
list-style: none; /* Remove default bullets */
}
ul li::before {
content: "\2022"; /* Add content: \2022 is the CSS Code/unicode for a bullet */
color: red; /* Change the color */
font-weight: bold; /* If you want it to be bold */
display: inline-block; /* Needed to add space between the bullet and the text */
width: 1em; /* Also needed for space (tweak if needed) */
margin-left: -1em; /* Also needed for space (tweak if needed) */
}
```
Separate style from content
Or more preferably (since it separates out the style component from slide content), create a css file, say style.css which contains:
ul {
list-style: none; /* Remove default bullets */
}
ul li::before {
content: "\2022"; /* Add content: \2022 is the CSS Code/unicode for a bullet */
color: red; /* Change the color */
font-weight: bold; /* If you want it to be bold */
display: inline-block; /* Needed to add space between the bullet and the text */
width: 1em; /* Also needed for space (tweak if needed) */
margin-left: -1em; /* Also needed for space (tweak if needed) */
}
then add in the YAML, making sure that style.css is in the same path as your Rmd,
css: [xaringan-themer.css, style.css]
Tweaking the bullet shape
You can change the shape the bullet using a different unicode supplied in content (e.g. use \2023 for a triangle bullet - see other common types here).
Changing the bullet color
You just need to replace red with the color of your choice. You can replace it with the hex color code instead too.
Related
I made a presentation in which I can change the text size of the slides. But if there is a math equation in the text, it doesn't render anymore. Is there a way that I could create a text class that would change the size of the text and be able to render math as well? Also, is there a way I can use the .tiny class on text, math, code input and output, in 1 CSS class definition or I would need to create 4 different .tiny classes (see the .tiny-code code.r and the .tiny-code code[class="remark-code"])?
---
title: Check this out
output:
xaringan::moon_reader:
seal: false
---
```{css, echo=FALSE}
.tiny {
font-size: .6rem;
font-weight: 200;
}
.huge {
font-size: 2.6rem;
font-weight: 200;
}
/* Tiny R block of code */
.tiny-code code.r {
font-weight: bold;
font-size: .3rem;
}
/* Tiny ouput */
.tiny-code code[class="remark-code"] {
font-size: .3rem;
display: block;
border: 0px solid red;
}
```
# Check this slide out
.tiny[get the **best estimation** of the parameters ( $\beta$ s), become a heRo]
.huge[this is huge]
.tiny-code[
```{r}
mtcars[1:5, "mpg"]
```
]
I found that this:
<span class="tiny">get the **best estimation** of the parameters ( $\beta$ s), become a heRo.</span>
works, but is there a way not to use html and write Markdown only?
Ok, found it...
.tiny[get the **best estimation** of the parameters ( \(\beta\) s), become a heRo]
Source here
.tiny[get the best estimation of the parameters ( \\(\beta\\) s), become a heRo]
Just recently i found out about marp.
I want to customize it a little to have basically 4 types of slides.
The title slide and the ToC slide should have different background images.
Following this post, i was able to customize the headings for those slides:
https://www.syndikat7.de/de/post/software-engineers-approach-to-presentation-slides
section.title h1 {
font-size: 60px;
letter-spacing: 10px;
margin-bottom: 0;
padding-bottom: 0;
}
---
marp: true
theme: mytheme
---
<!-- _class: title -->
# My heading on title themed slide
Now i want to add a cutom background image for the whole slide to this Class only.
But where do i have to but the background-image: url('PAth\to\image.png);?
if i put it in
section.title {
justify-content: center;
background-image: url('PAth\to\image.png);
}
The image just shows up around the actual title. The slid backglround is unaltered.
Wordpress 5.7, Theme 2021.
1 How do you change the colour of the submenu items in the Main Menu?
I'm a Wordpress newbie, basic/intermediate knowledge of CSS.
2 How do I change the background colour of the main menu and submenu?
This additional CSS makes the main menu items white. I want to do the same to the submenus.
*start of menu */
/*menu background */
.menu-wrapper {
background: rgba(204,153,51,.75);
}
a#primary-menu-list {
color:white;
}
.primary-navigation .primary-menu-container > ul > .menu-item > a
{color:white;}
.svg-icon
{color:white;}
/*end of menu */
As this theme supports CSS variables right now - I'd suggest you not override selectors, but override just variables. You need to add to your CSS these lines, replace with the colors you really want to use and make sure they override default styles
:root {
--primary-nav--color-link: #ffffff;
--primary-nav--color-link-hover: #cecece;
--primary-nav--color-text: #000000;
}
Here's the list of available variables for the main navigation
--primary-nav--font-family: var(--global--font-secondary);
--primary-nav--font-family-mobile: var(--global--font-primary);
--primary-nav--font-size: var(--global--font-size-md);
--primary-nav--font-size-sub-menu: var(--global--font-size-xs);
--primary-nav--font-size-mobile: var(--global--font-size-sm);
--primary-nav--font-size-sub-menu-mobile: var(--global--font-size-sm);
--primary-nav--font-size-button: var(--global--font-size-xs);
--primary-nav--font-style: normal;
--primary-nav--font-style-sub-menu-mobile: normal;
--primary-nav--font-weight: normal;
--primary-nav--font-weight-button: 500;
--primary-nav--color-link: var(--global--color-primary);
--primary-nav--color-link-hover: var(--global--color-primary-hover);
--primary-nav--color-text: var(--global--color-primary);
--primary-nav--padding: calc(0.66 * var(--global--spacing-unit));
--primary-nav--border-color: var(--global--color-primary);
Attempt 1:
I failed with the CSS, but then looked carefully in:
Plugin: Options for Twenty Twenty-One (free version)
Customising Nav Options
set Nav Background Color: selected the relevant color
Attempt 2:
Without the plugin
This works well when I use the + key to trigger the drop down
If I click on the submenu heading the heading is hard to read (white text on whitish background).
Additional CSS
:root {
/*submenu color */
--primary-nav--color-link: white;
/*main menu color */
--primary-nav--color-link-hover: white;
/* where does this take effect?
--primary-nav--color-text: red;
*/
--primary-nav--color-text: #000000;
}
/*this is the background of the main menu only, not submenu */
.menu-wrapper {
background: rgba(204,153,51,.75);
}
/*
this is for the submenu (drop down menus)
*/
.primary-navigation .sub-menu .menu-item>a { color: var(--primary-nav--color-link);
background:rgba(204,153,51,.75); */
}
.svg-icon
{color:white;}
I am using the flexdashboard Package with Rmarkdown and would like to modify the dimensions of headers, location of borders, colors, etc. that result in the webpage created by Rstudio. There are many CSS files associated with flex dashboard and Rmarkdown. Can someone please inform me what CSS files should be modified for this purpose, and where these files are located in the R or Rstudio directories?
By modifying a CSS theme (we chose to modify Lumen) in a flexdashboard subdirectory my colleague and I learned we could control the dimensions of certain elements in flexdashboard.
Specifically, we altered the CSS file in this directory:
C:\Program Files\R\R-3.4.2\library\flexdashboard\rmarkdown\templates\flex_dashboard\resources
See the annotated CSS file (again, for the Lumen theme) below for how we changed the dimensions of the border boxes. The edits shown were placed at the end of the existing lumen.css file.
/* Jeff's Edits */
.storyboard-nav {
box-sizing: border-box;
width: 100% !important; /* This prevents JS transformation on width */
height: auto; /* This overrides the height */
}
.storyboard-nav .sbnext, .storyboard-nav .sbprev {
height: auto; /* This overrides the height */
font-size: 3rem;
}
.storyboard-nav .sbframelist {
height: auto; /* This overrides the height */
}
.storyboard-nav .sbframelist ul {
box-sizing: border-box;
width: 100% !important; /* This prevents JS transformation on width */
height: auto; /* This overrides the height */
}
.storyboard-nav .sbframelist ul li {
height: auto; /* This overrides the height */
width: auto; /* This overrides the width */
}
You can always modify the defaults by adding your own CSS file, instructions here. This way you don't have to modify the default specifications (in case you ever want to use them).
If you want to check the default specifications for each theme, you can find them in the flexdashboard github repo.
As a slidifiy newbee, I don't understand why the first slide has a pale green background and all the other slides have white backgrounds.
The example "Test for Slidify" at http://www.rpubs.com/ also shows this pale green first slide.
How can I control the background color of this first slidify slide?
The css defining the title slide is contained in libraries/frameworks/io2012/slidify.css. Here is the part that controls the title slide. You can modify it and add it to your Rmd file directly to override default styles.
.title-slide {
background-color: #CBE7A5; /* #EDE0CF; ; #CA9F9D*/
}
.title-slide hgroup > h1{
font-family: 'Oswald', 'Helvetica', sanserif;
}
.title-slide hgroup > h1,
.title-slide hgroup > h2 {
color: #535E43 ; /* ; #EF5150*/
}
To do this from within an .Rmd file, one would add the following after the YAML front matter section of index.Rmd. This applies a white background to the title slide:
---
title : title slide bg change example
author : Ramnath
...
mode : selfcontained # {standalone, draft}
knit : slidify::knito2slides
---
<style>
.title-slide {
background-color: #FFFFFF; /* #EDE0CF; ; #CA9F9D*/
}
</style>
Remember to re-run slidify("index.Rmd") to apply the change.