Pen Settings



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


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


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.


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.


  <div class="text-container">
    <h1>Emoji Generator Codewithnepal</h1>
    <p>Click the buttons to generate random emoji's ๐Ÿ˜œ</p>
  <div id="primary-container">
    <div id="red-button" class="colour-box red"></div>
    <div id="yellow-button"class="colour-box yellow"></div>
    <div id="blue-button" class="colour-box blue"></div>
  <div id="secondary-container">
    <div class="lg-colour-box secondary"></div>



                @import url('');

:root {
  --red: #e53935;
  --yellow: #fdd835;
  --blue: #2196f3;
  --orange: #fb8c00;
  --green: #8bc34a;
  --purple: #7e57c2;

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: 'Lexend Deca', sans-serif;

main {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;

.text-container {
  text-align: center;
  margin-bottom: 5rem;

#primary-container {
  display: flex;

.colour-box {
  width: 100px;
  height: 100px;
  border-radius: 10px;
  margin: 0.5rem;
  cursor: pointer;
  box-shadow: 0px 10px 0px 0px rgba(0,0,0,0.3);
  transition: 0.2s;
} {
  background: var(--red);
  box-shadow: 0px 10px 0px 0px rgba(150, 6, 6);

.colour-box.yellow {
  background: var(--yellow);
  box-shadow: 0px 10px 0px 0px rgba(179, 133, 66);
} {
  background: var(--blue);
  box-shadow: 0px 10px 0px 0px rgba(0, 69, 122);

.lg-colour-box {
  width: 150px;
  height: 150px;
  border-radius: 10px;
  margin-top: 3rem;
  border: solid 5px #bdbdbd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  text-shadow: 0px 0px 10px #FFF;
} {
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  box-shadow: none; 
  transform: translate(0, 10px);


                const primaryContainer = document.querySelector('#primary-container');
const colorBoxes = document.querySelectorAll('.colour-box');
const redButton = document.querySelector('#red-button');
const yellowButton = document.querySelector('#yellow-button');
const blueButton = document.querySelector('#blue-button');
const lgColourBox = document.querySelector('.lg-colour-box');

let redSelected = false;
let yellowSelected = false;
let blueSelected = false;

const whiteArray = ['๐Ÿ‘ป', '๐Ÿ‘€', 'โ˜๏ธ', '๐Ÿš', '๐Ÿฅš', '๐Ÿฅ›', '๐Ÿ', '๐Ÿ—ฏ'];
const redArray = ['โค๏ธ', '๐Ÿ‘น', '๐Ÿ’‹', '๐Ÿ’ƒ', '๐ŸŽ', '๐ŸŒถ', '๐Ÿš˜', '๐ŸŒน'];
const yellowArray = ['๐ŸŒ', '๐Ÿฅ', '๐Ÿ‹', '๐Ÿง€', '๐Ÿšœ', '๐Ÿ’›', '๐Ÿ“’', '๐Ÿ‘‚'];
const blueArray = ['๐Ÿ‘•', '๐Ÿฆ‹', '๐Ÿฌ', '๐Ÿ’ฆ', '๐Ÿš™', '๐Ÿ’Ž', '๐Ÿ’™', 'โ„๏ธ'];
const orangeArray = ['๐ŸŽƒ', '๐Ÿฆ', '๐Ÿฆ€', '๐ŸŠ', '๐Ÿ€', '๐Ÿ“™', '๐Ÿงก', '๐Ÿฅ•'];
const purpleArray = ['๐Ÿ˜ˆ', '๐Ÿ‘พ', 'โ˜‚๏ธ', '๐Ÿ†', '๐Ÿ‡', '๐Ÿ”ฎ', '๐Ÿ’œ', '๐Ÿ•บ'];
const greenArray = ['๐Ÿคข', '๐Ÿธ', '๐Ÿฆ–', '๐Ÿ€', '๐Ÿ', '๐ŸŽพ', '๐Ÿ’š', '๐Ÿฅ’'];

function toggleButton(button, selected) {
  button.addEventListener('click', () => {
    if(!selected) {
      selected = true;
    } else {
      selected = false;
    primaryActiveColour(redButton, '#e53935', redArray);
    primaryActiveColour(yellowButton, '#fdd835', yellowArray)
    primaryActiveColour(blueButton, '#2196f3', blueArray);
    secondaryActiveColour(redButton, yellowButton, '#fb8c00', orangeArray);
    secondaryActiveColour(redButton, blueButton, '#7e57c2', purpleArray);
    secondaryActiveColour(blueButton, yellowButton, '#8bc34a', greenArray);
       && yellowButton.classList.contains('active')
       && blueButton.classList.contains('active')) { = '#6d4c41';
         lgColourBox.textContent = '๐Ÿ’ฉ';
       && !yellowButton.classList.contains('active')
       && !blueButton.classList.contains('active')) { = '#FFF';
         lgColourBox.textContent = whiteArray[0];

function primaryActiveColour(button, colour, array) {
  if(button.classList.contains('active')) { = colour;
    lgColourBox.textContent = array[0];

function secondaryActiveColour(button1, button2, colour, array) {
  if(button1.classList.contains('active') && button2.classList.contains('active')) { = colour;
    lgColourBox.textContent = array[0];

function shuffle(a) {
  for (let i = a.length - 1; i > 0; i--) {
    const j = Math.floor(Math.random() * (i + 1));
    [a[i], a[j]] = [a[j], a[i]];
  return a;

lgColourBox.textContent = whiteArray[0];

toggleButton(redButton, redSelected);
toggleButton(yellowButton, yellowSelected);
toggleButton(blueButton, blueSelected);