Creating A Custom Theme

Open css/theme/src inside your IDE. This holds all of the Sass files (.scss) for each theme. These files will be transpiled to CSS using Grunt (a JavaScript task runner). If you prefer to write CSS, go ahead and just create the CSS file inside css/theme.

Create a new .scss file. I will call mine custom.scss. You may have to stop your localhost and run npm run build to transpile your Sass code to CSS.

Inside the index.html file, change the CSS theme import in the <head> tag to use the name of the newly created stylesheet. The extension will be .css, not .scss.

Next, I created variables for all of the different styles I wanted to use. You can find custom fonts on Google Fonts. Once the font is downloaded, be sure to add the font URL’s into the index.html file.

Add a .reveal class to the custom Sass file. This will wrap all of the styles to ensure our custom theme overrides any defaults. Then, add your custom styling!

Unfortunately, due to time constraints, I’ll admit that I used quite a bit of !important overrides in my CSS. This is horrible practice and I don’t recommend it. The reveal.css file has extremely specific CSS styles, so I should have, if I had more time, gone back and ensured my class names were more specific so I could remove the !importants.

Mixins & Settings

Reveal.js also comes with mixins and settings you can leverage in your custom theme.

To use the mixins and settings, just import the files into your custom theme:

@import "../template/mixins";
@import "../template/settings";

Mixins
You can use the vertical-gradient, horizontal-gradient, or radial-gradient mixins to create a neat visual effect.

All you have to do is pass in the required parameters (color value) and voila, you’ve got a gradient!