Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

HTML

              
                - let src = 'https://images.unsplash.com/photo-1568715684971-9ac138754ab9?w=800'
- let col = '#ff8c00'

	body(style=`--c: ${col}`)
	svg(width='0' height='0')
		filter#mono-one(color-interpolation-filters='sRGB'
										x='0' y='0' width='100%' height='100%')
			feColorMatrix(type='saturate' values='0' result='g')
			feFlood(flood-color='currentColor' result='b')
			feColorMatrix(type='saturate' values='0')
			feComponentTransfer(result='c')
				feFuncR(type='discrete' tableValues='1 0')
				feFuncG(type='discrete' tableValues='1 0')
				feFuncB(type='discrete' tableValues='1 0')
			feBlend(in='g' mode='difference')
			feColorMatrix(type='luminanceToAlpha')
			feComposite(in='b' operator='in')
			feBlend(in2='c')
		filter#mono-two(color-interpolation-filters='sRGB'
										x='0' y='0' width='100%' height='100%')
			feColorMatrix(type='saturate' values='0' result='g')
			feFlood(flood-color='currentColor')
			feBlend(in='g' mode='hard-light')
		filter#mono-tre(color-interpolation-filters='sRGB'
										x='0' y='0' width='100%' height='100%')
			feFlood(flood-color='currentColor')
			feBlend(in='SourceGraphic' mode='luminosity')

	figure.mono-one
		img(src=src)
		figcaption monochrome option 1
	figure.mono-two
		img(src=src)
		figcaption monochrome option 2
	figure.mono-tre
		img(src=src)
		figcaption monochrome option 3
	figure.original
		img(src=src)
		figcaption original
	form
		label(for='col') paint in
		input#col(type='color' value=col)
              
            
!

CSS

              
                $col-l: 2px;
$col-d: 2.25em;

@import url('https://fonts.googleapis.com/css2?family=Handlee&display=swap');

html, body, filter { display: grid }

html { min-height: 100% }

body {
	--c: #ffaa00;
	grid-gap: 1em;
	grid-template-columns: 
		repeat(auto-fit, minmax(min(100%, 23em), 1fr));
	justify-self: center;
	align-content: center;
	width: min(100%, 68rem);
	background: #1d1f20;
	font: 1em handlee, purisa, sans-serif
}

svg {
	position: fixed;
	color: var(--c)
}

figure {
	margin: 0;
	padding: .375rem;
	border-radius: 3px;
	box-shadow: 5px 5px 13px;
	background: #ededed;
	text-align: center
}

img {
	max-width: 100%;
	
	.mono-one & { filter: url(#mono-one) }
	.mono-two & { filter: url(#mono-two) }
	.mono-tre & { filter: url(#mono-tre) }
}

form {
	display: flex;
	gap: .5rem;
	grid-column: 1/ -1;
	align-items: center;
	justify-self: center;
	padding: .5rem;
	background: #121212;
	color: #ededed;
}

label { font-size: 1.25em }

[type='color'] {
	border: none; /* override default */
	/* for :hover/ :focus case */
	outline: solid calc(var(--hov)*#{$col-l});
	/* ensure a square item */
	padding: 0 $col-l;
	/* aspect-ratio fails for [type=color]; set both width/ height */
	width: $col-d; height: $col-d;
	
	&::-webkit-color-swatch {
		border: solid .5*$col-l currentcolor
	}
	
	&::-moz-color-swatch {
		/* for reference on sizes & margins, see this article:
		 * https://css-tricks.com/color-inputs-a-deep-dive-into-cross-browser-differences/ */
		margin: 2*$col-l $col-l;
		border: solid .5*$col-l currentcolor;
		/* subtract 4px = 2px on left side + 2px on right side */
		width: calc(100% - 2*#{$col-l});
		/* subtract 8px = 4px on top side + 4px on bottom side */
		height: calc(100% - 4*#{$col-l})
	}
}
              
            
!

JS

              
                /* JS used only to pick monochrome paint */
addEventListener('input', e => {
	document.body.style = `--c: ${e.target.value}`
})
              
            
!
999px

Console