Socket
Book a DemoInstallSign in
Socket

reveal-random-colors

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reveal-random-colors

Pimp your Reveal.js presentations by randomising slide colours and typeface.

latest
Source
npmnpm
Version
2.1.0
Version published
Maintainers
1
Created
Source

reveal-random-colors

Pimp your Reveal.js presentations by randomising slide colours and typeface.

demonstration in a browser

Add data-state="random-color" in slide attributes. This slide font-family, color and background-color will be randomised when it becomes active.

The default colors list is based on tachyons accessible combinations (contrast ratio > 7). Feel free to expand it 👍.

The default fonts list is based on macOS_ typefaces. Not because I hate other OSes but because it was my use case for a live presentations. Ides are welcome 😊.

Install

$ npm install reveal-random-colors

Use

Reveal.js Configuration

import Reveal from 'reveal.js';
import RandomColors from 'reveal-random-colors';

Reveal.registerPlugin('RandomColors', RandomColors());

Reveal.initialize({
  // ... cf. https://npmjs.com/reveal.js#configuration
});

In a Reveal.js slide:

<!-- .slide: data-state="random-color" -->

# My Slide Title

CSS Styles

The following rules will help cascade the random font to headlines and paragraphs.

.reveal [data-state="random-color"] h1,
.reveal [data-state="random-color"] h2,
.reveal [data-state="random-color"] h3,
.reveal [data-state="random-color"] h4,
.reveal [data-state="random-color"] h5,
.reveal [data-state="random-color"] p {
  font-family: inherit;
}

Using different fonts

Specify an array of typefaces to the plugin via the fonts option:

const myFonts = [
  'Comic Sans',
  'Ubuntu, sans-serif',
  'Open Sans, sans-serif',
];

Reveal.registerPlugin('RandomColors', RandomColors({
  fonts: myFonts
}));

License

MIT License.

Keywords

reveal.js

FAQs

Package last updated on 13 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts