Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


	Dark Mode?
	<input type="checkbox">


                /* Sets the default colors */
:root {
	--background-color: #efefef;
	--font-color: #444444;

/* Changes the values of the CSS variables if the data-theme is "dark" */

body[data-theme="dark"] {
	--background-color: #032b43;
	--font-color: #efefef;

/* Or, if the theme is "lovey-dovey", "dark-and-spooky" or "holly-jolly" */

body[data-theme="lovey-dovey"] {
	--background-color: #FD4659;
	--font-color: #FDB0C0;

body[data-theme="dark-and-spooky"] {
	--background-color: #010101;
	--font-color: #BA4A00;

body[data-theme="holly-jolly"] {
	--background-color: #048243;
	--font-color: #efefef;

/* And this is where the CSS variables are applied */

body {
	background-color: var(--background-color);
	color: var(--font-color);
	font-size: 1.2em;
  margin: 40vh auto;
  text-align: center;
  -webkit-transition: .4s;
  transition: .4s;
  font-family: Helvetica, arial, sans-serif;


                window.addEventListener('DOMContentLoaded', (event) => {
		// Creates a new date object, based off of today's current date
		let now = new Date();
		// Uncomment the following date objects to test out themes for February, June, October & December
		// let now = new Date('February 2020');
		// let now = new Date('June 2020'); // Default "dark" theme will render for June
		// let now = new Date('October 2020');
		// let now = new Date('December 2020');
		// Placeholder for theme name that we'll add later
		let themeToAdd = ""
		// Evaluates the current, zero-indexed month based off of the now date object
		switch(now.getMonth()) {
			case 1:
				themeToAdd = "lovey-dovey"
			case 9:
				themeToAdd = "dark-and-spooky"
			case 11:
				themeToAdd = "holly-jolly"
				themeToAdd = "dark"
		// Get the checkbox element 		
    let checkbox = document.querySelector("input")
    // Get the body tag	
    let body = document.querySelector("body")
		// This event handler listens for the checkbox to be checked or unchecked
    // Then, if the checkbox is checked ( == true)
		// Then apply `data-theme="theme-name"` to the body tag
		// Otherwise, remove the attribute
    checkbox.addEventListener('change', (event) => {
 ? body.setAttribute('data-theme', themeToAdd) : body.removeAttribute("data-theme")