Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <div class="color-wrapper js-green" >
	<div class='colorSwatch colorSwatch--primary green-600 isSelected' data-color="600">
			<div class="colorSwatch--color">Green 600</div>
	</div>
	<div class='colorSwatch colorSwatch--secondary green-500' data-color="500">
			<div class="colorSwatch--color">Green 500</div>
	</div>
	<div class='colorSwatch colorSwatch--tertiary green-700' data-color="700">
			<div class="colorSwatch--color">Green 700</div>
	</div>
	<div class="colorSwatch--supplemental">
		<div class='colorSwatch colorSwatch--small green-100' data-color="100">
				<div class="colorSwatch--color">Green 100</div>
		</div>
		<div class='colorSwatch colorSwatch--small green-200' data-color="200">
				<div class="colorSwatch--color">Green 200</div>
		</div>
		<div class='colorSwatch colorSwatch--small green-300' data-color="300">
				<div class="colorSwatch--color">Green 300</div>
		</div>
		<div class='colorSwatch colorSwatch--small green-400' data-color="400">
				<div class="colorSwatch--color">Green 400</div>
		</div>
		<div class='colorSwatch colorSwatch--small green-800' data-color="800">
				<div class="colorSwatch--color">Green 800</div>
		</div>
		<div class='colorSwatch colorSwatch--small green-900' data-color="900">
				<div class="colorSwatch--color">Green 900</div>
		</div>
		<div class='colorSwatch colorSwatch--small green-1000' data-color="1000">
				<div class="colorSwatch--color">Green 1000</div>
		</div>
		<div class='colorSwatch colorSwatch--small green-1100' data-color="1100">
				<div class="colorSwatch--color">Green 1100</div>
		</div>
	</div>
<div class="colorSwatchTokens" >
		<h3 class="colorSwatchTokens--title">Green <span class="js-color-val">600</span> Tokens</h3>
			<dl class="colorSwatch--token">
				<dt>Hex</dt>
				<dd>#999999</dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>Sass</dt>
				<dd>$Color-green--<span class="js-color-val">600</span></dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>JavaScript</dt>
				<dd>COLOR_GREEN_<span class="js-color-val">600</span></dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>CSS</dt>
				<dd>--color-green-<span class="js-color-val">600</span></dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>Swift</dt>
				<dd>UIColor().green<span class="js-color-val">600</span>()</dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>Android</dt>
				<dd>GREEN_<span class="js-color-val">600</span></dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>Python</dt>
				<dd>green<span class="js-color-val">600</span></dd>
			</dl>
		</div>		
</div>






<div class="color-wrapper js-bambu">
	<div class='colorSwatch colorSwatch--primary bambuTeal-600 isSelected' data-color="600">
			<div class="colorSwatch--color">Bambu Teal 600</div>
	</div>
	<div class='colorSwatch colorSwatch--secondary bambuTeal-500' data-color="500">
			<div class="colorSwatch--color">Bambu Teal 500</div>
	</div>
	<div class='colorSwatch colorSwatch--tertiary bambuTeal-700' data-color="700">
			<div class="colorSwatch--color">Bambu Teal 700</div>
	</div>
	<div class="colorSwatch--supplemental">
		<div class='colorSwatch colorSwatch--small bambuTeal-400' data-color="100">
				<div class="colorSwatch--color">Bambu Teal 400</div>
		</div>
		<div class='colorSwatch colorSwatch--small bambuYellow-500' data-color="200">
				<div class="colorSwatch--color">Bambu Yellow 500</div>
		</div>
		<div class='colorSwatch colorSwatch--small bambuYellow-600' data-color="300">
				<div class="colorSwatch--color">Bambu Yellow 600</div>
		</div>

	</div>
<div class="colorSwatchTokens">
		<h3 class="colorSwatchTokens--title">Bambu <span class="js-color-val">600</span> Tokens</h3>
			<dl class="colorSwatch--token">
				<dt>Hex</dt>
				<dd>#999999</dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>Sass</dt>
				<dd>$Color-green--<span class="js-color-val">600</span></dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>JavaScript</dt>
				<dd>COLOR_GREEN_<span class="js-color-val">600</span></dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>CSS</dt>
				<dd>--color-green-<span class="js-color-val">600</span></dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>Swift</dt>
				<dd>UIColor().green<span class="js-color-val">600</span>()</dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>Android</dt>
				<dd>GREEN_<span class="js-color-val">600</span></dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>Python</dt>
				<dd>green<span class="js-color-val">600</span></dd>
			</dl>
		</div>		
</div>




<div class="color-wrapper js-generalreport">
	<div class="colorSwatch--dataviz">
		<div class='colorSwatch colorSwatch--small generalReport-100' data-color="100">
				<div class="colorSwatch--color">General Report 100</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-200' data-color="200">
				<div class="colorSwatch--color">General Report 200</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-300' data-color="300">
				<div class="colorSwatch--color">General Report 300</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-400' data-color="400">
				<div class="colorSwatch--color">General Report 400</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-500' data-color="500">
				<div class="colorSwatch--color">General Report 500</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-600' data-color="600">
				<div class="colorSwatch--color">General Report 600</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-700' data-color="700">
				<div class="colorSwatch--color">General Report 700</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-800' data-color="800">
				<div class="colorSwatch--color">General Report 800</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-900' data-color="900">
				<div class="colorSwatch--color">General Report 900</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-1000' data-color="1000">
				<div class="colorSwatch--color">General Report 1000</div>
		</div>		
	</div>
	<div class="colorSwatch--dataviz">
		<div class='colorSwatch colorSwatch--small generalReport-1100' data-color="1100">
				<div class="colorSwatch--color">General Report 1100</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-1200' data-color="1200">
				<div class="colorSwatch--color">General Report 1200</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-1300' data-color="1300">
				<div class="colorSwatch--color">General Report 1300</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-1400' data-color="1400">
				<div class="colorSwatch--color">General Report 1400</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-1500' data-color="1500">
				<div class="colorSwatch--color">General Report 1500</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-1600' data-color="1600">
				<div class="colorSwatch--color">General Report 1600</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-1700' data-color="1700">
				<div class="colorSwatch--color">General Report 1700</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-1800' data-color="1800">
				<div class="colorSwatch--color">General Report 1800</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-1900' data-color="1900">
				<div class="colorSwatch--color">General Report 1900</div>
		</div>
		<div class='colorSwatch colorSwatch--small generalReport-2000' data-color="2000">
				<div class="colorSwatch--color">General Report 2000</div>
		</div>
	</div>
<div class="colorSwatchTokens">
		<h3 class="colorSwatchTokens--title">General Report <span class="js-color-val">600</span> Tokens</h3>
			<dl class="colorSwatch--token">
				<dt>Hex</dt>
				<dd>#999999</dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>Sass</dt>
				<dd>$Color-green--<span class="js-color-val">600</span></dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>JavaScript</dt>
				<dd>COLOR_GREEN_<span class="js-color-val">600</span></dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>CSS</dt>
				<dd>--color-green-<span class="js-color-val">600</span></dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>Swift</dt>
				<dd>UIColor().green<span class="js-color-val">600</span>()</dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>Android</dt>
				<dd>GREEN_<span class="js-color-val">600</span></dd>
			</dl>
			<dl class="colorSwatch--token">
				<dt>Python</dt>
				<dd>green<span class="js-color-val">600</span></dd>
			</dl>
		</div>		
</div>

              
            
!

CSS

              
                * { box-sizing: border-box;}
body {
	margin: 40px 0;
	padding: 0;
	font-family: "Proxima Nova", "Helvetica";
}
.color-wrapper {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr 1fr;
	width: 100%;
	max-width: 924px;

	margin: 0 auto;
	clear: both;
}

.color-wrapper + .color-wrapper  {
	margin: 220px auto;
	
}

.colorSwatch {
	grid-template-columns: 100%;
	cursor: pointer;
	position: relative;
	text-align: center;
	min-height: 50px;
	transition:  400ms cubic-bezier(0, 0, .2, 1);
 
	&:hover {
		z-index: 3;
		transform: scale(1.05);
		transform-origin: 100% 0;
		
		.colorSwatch--color {
			font-weight: 600;
		}
	}

	&.isSelected {
		z-index: 2;
		transform: scale(1.05);
		transform-origin: 100% 0;
		
		.colorSwatch--color {
			font-weight: 600;
			position: relative;

			&::after {
				visibility: visible;
  				transform: scaleX(1);
			}
		}
	}
	
	&--token {
		display: block;
		cursor: pointer;
		padding: 0;
		margin: 0;
		text-align: left;
		margin: 16px;
	
		dt {
			font-weight: 300;
			margin: 0;
			font-size: 11px;
			letter-spacing: 1px;
		}
		dd {
			width: 100%;
			display: block;
			margin: 4px 0 0 0;
			font-family: monospace;
			background: $Color-neutral--200;
			padding: 4px 8px;
			color: $Color-black;
			border-radius: 5px;
			
			&.isCopied {
				font-weight: 600;
				background: $Color-white;
			}
		}
	}
	
	&.isCopied {
		background: $Color-neutral--900;
		color: $Color-white;
		overflow: hidden;
	}
	
	&--color {
		display: inline-block;
		font-size: $Typography-size--300;
		font-weight: 500;
		position: relative;
		transform: translateY(-50%);
		top: 50%;
			
		&::after {
			content: "";
			position: absolute;
			width: 100%;
			height: 2px;
			bottom: 0;
			left: 0;
			background-color: CurrentColor;
			visibility: hidden;
			transform: scaleX(0);
			transition: all 200ms cubic-bezier(0, 0, .2, 1);
		}
	}

	&--primary {
	  .colorSwatch--color {
			font-size: $Typography-size--500;
		}
		overflow: hidden;
		grid-row: 1/span 5;
		grid-column: span 2;
		
	}
	&--secondary,
	&--tertiary {
		.colorSwatch--color {
			font-size: $Typography-size--400;
		}
		
		grid-row: 6/span 3;
		grid-column: span 1;
	}

	&--secondary {
		.colorSwatch--color {
			position: relative;
			
			&::before {
				content: "Secondary";
				font-size: 13px;
				position: absolute;
				top: -15px;
			}
		}			
	}

	&--tertiary {
		.colorSwatch--color {
			position: relative;
			&::before {
				content: "Tertiary";
				font-size: 13px;
				position: absolute;
				top: -15px;
			}
		}	
	}
	
	&--primary {
		.colorSwatch--color {
			position: relative;
			&::before {
				content: "Primary";
				font-size: 13px;
				position: absolute;
				top: -15px;
			}
		}
	}

	&--small {
		flex-direction: column;
    	justify-content: center;
		height: 100%;
	}
	
	&--supplemental {
		grid-row: 1/ span 8;
		grid-column: span 1;
		position: relative;
		display: flex;
		flex-direction: column;
   	height: 100%;
	}
	&--dataviz {
		grid-row: 1/ span 8;
		grid-column: span 2;
		position: relative;
		display: flex;
		flex-direction: column;
   	height: 100%;
	}
}

.colorSwatchTokens {
	grid-row: 1/span 8;

	background: $Color-black;
	color: $Color-white;

	&--title {
		margin-left: 16px;
		margin-bottom: 8px;
	}
	
}

@mixin get-colors($colors) {
	// Build Color classes
	@for $i from 1 through length($colors) {
		&-#{$i}00 {
			//subtract 1 from current iteration to match SASS map
			background: map-get($colors, $i - 1);
			@if $i < 5 {
				color: $Color-black;
			} @else {
				color: $Color-white;
			}
		}
	}
}



$Greens: (
	0: $Color-green--100,
	1: $Color-green--200,
	2: $Color-green--300,
	3: $Color-green--400,
	4: $Color-green--500,
	5: $Color-green--600,
	6: $Color-green--700,
	7: $Color-green--800,
	8: $Color-green--900,
	9: $Color-green--1000,
	10: $Color-green--1100
);

$Reds: (
	0: $Color-red--100,
	1: $Color-red--200,
	2: $Color-red--300,
	3: $Color-red--400,
	4: $Color-red--500,
	5: $Color-red--600,
	6: $Color-red--700,
	7: $Color-red--800,
	8: $Color-red--900,
	9: $Color-red--1000,
	10: $Color-red--1100
);

$Neutrals: (
	0: $Color-neutral--100,
	1: $Color-neutral--200,
	2: $Color-neutral--300,
	3: $Color-neutral--400,
	4: $Color-neutral--500,
	5: $Color-neutral--600,
	6: $Color-neutral--700,
	7: $Color-neutral--800,
	8: $Color-neutral--900,
	9: $Color-neutral--1000
);

$Aquas: (
	0: $Color-aqua--100,
	1: $Color-aqua--200,
	2: $Color-aqua--300,
	3: $Color-aqua--400,
	4: $Color-aqua--500,
	5: $Color-aqua--600,
	6: $Color-aqua--700,
	7: $Color-aqua--800,
	8: $Color-aqua--900,
	9: $Color-aqua--1000,
	10: $Color-aqua--1100
);

$general-report: (
	0: $Color-green--500,
	1: $Color-teal--400,
	2: $Color-blue--400,
	3: $Color-purple--600,
	4: $Color-magenta--900,
	5: $Color-pink--400,
	6: $Color-red--600,
	7: $Color-orange--400,
	8: $Color-yellow--600,
	9: $Color-gray--600,
	10: $Color-green--700,
	11: $Color-teal--600,
	12: $Color-aqua--600,
	13: $Color-purple--900,
	14: $Color-magenta--900,
	15: $Color-pink--600,
	16: $Color-red--900,
	17: $Color-orange--700,
	18: $Color-yellow--800,
	19: $Color-gray--800
);

// Comparison Palette (Related items)
$CompareColors: (
	0: $Color-teal--500,
	1: $Color-teal--800,
	2: $Color-purple--500,
	3: $Color-purple--800
);

// Contrast Palette (Visualizing unrelated items)
$DataVizContrastingData: (
	0: $Color-teal--500,
	1: $Color-purple--800,
	2: $Color-magenta--500,
	3: $Color-yellow--800,
	4: $Color-gray--700
);

// Extended Palette (when large amounts of data need to be shown in a single chart)
$DataVizColorRotation: (
	0: $Color-green--500,
	1: $Color-teal--500,
	2: $Color-blue--500,
	3: $Color-purple--500,
	4: $Color-magenta--500,
	5: $Color-pink--500,
	6: $Color-red--500,
	7: $Color-orange--500,
	8: $Color-yellow--500,
	9: $Color-gray--500,
	10: $Color-green--800,
	11: $Color-teal--800,
	12: $Color-blue--800,
	13: $Color-purple--800,
	14: $Color-magenta--800,
	15: $Color-pink--800,
	16: $Color-red--800,
	17: $Color-orange--800,
	18: $Color-yellow--800,
	19: $Color-gray--700
);


.green {
	@include get-colors($Greens);
}

.neutral {
	@include get-colors($Neutrals);
}


.red {
	@include get-colors($Reds);
}

.aqua {
	@include get-colors($Aquas);
}

.bambuTeal-400 {
	color: $Color-white;
	background: $Color-bambuTeal--400;
}
.bambuTeal-500 {
	color: $Color-white;
	background: $Color-bambuTeal--400;
}
.bambuTeal-600 {
	color: $Color-white;
	background: $Color-bambuTeal--600;
}
.bambuTeal-700 {
	color: $Color-white;
	background: $Color-bambuTeal--700;
}
.bambuYellow-500 {
	background: $Color-bambuYellow--500;
}
.bambuYellow-600 {
	background: $Color-bambuYellow--600;
}


.generalReport {
	@include get-colors($general-report);
}

              
            
!

JS

              
                

$('.colorSwatch').on('click', function() {
	$('.colorSwatchTokens').toggleClass('isSelected');
});

$('.colorSwatch--token dd').on('click', function() {
	const origText = $(this).text();
	$(this).text('Token Copied!');
	$(this).addClass('isCopied');
	window.setTimeout( ()=> {
		$(this).text(origText);
		$(this).removeClass('isCopied');
	}, 1000 );
		
});

$('.colorSwatch').on('click', function() {
	$('.colorSwatch').removeClass('isSelected');
	$(this).addClass('isSelected');

	$('.js-color-val').text($(this).data('color'))
	
});
              
            
!
999px

Console