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 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

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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              <div class="wrapper">
  <div>
    <button class="btn b" onclick='hexCodes("5FBBB9,39A0ED,0E34A0,011638")'>Blue</button>
    <button class="btn v" onclick='hexCodes("AE8CA3,766C7F,CCC9E7,947EB0,7353BA")'>Purple</button>
    <button class="btn r" onclick='hexCodes("A31621,F45B69,FF220C,FB3640")'>Red</button>
    <ul class="color-legend">
        <li id="li-square-0"><i class="fas fa-square"></i> <span>#D0435B</span></li>
        <li id="li-square-1"><i class="fas fa-square"></i> <span>#FCF0EF</span></li>
        <li id="li-square-2"><i class="fas fa-square"></i> <span>#403757</span></li>
    </ul>
  </div>
  <div class="theme-layout">
    <header class="header-section">
      <p class="item-time">9:10</p>
      <p class="items">
        <i class="fas fa-signal"></i>
        <i class="fas fa-wifi"></i>
        <i class="fas fa-battery-three-quarters"></i>
      </p>
    </header>
    
    <section>
      <div class="item-image"><i id ="file-image" class="far fa-file-image fa-7x"></i></div>
      <div id="item-dark" class="item-description-dark"></div>
      <div class="item-description-light"></div>
    </section>
    
    <section class="content-section">
     <div id="l0" class="item-line l1"></div>
     <div id="l1" class="item-line l2"></div>
     <div id="l2" class="item-line l3"></div>
     <div id="l3" class="item-line l4"></div>
     <div class="item-description-light"></div> 
    </section>
  </div>
</div>
            
          
!

CSS

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

html, body{
    margin: 0;
    padding: 0;
}
body{
    font-family: 'Roboto', sans-serif;
}
.wrapper {
    margin: 0 auto;
    padding-top: 100px;
    width: 550px;
    display: grid;
    grid-gap: 10px;
    grid-template-columns: 150px 350px;
    grid-template-rows: repeat(5, 140px);
  }
  .theme-layout {
    grid-column: 2;
    grid-row: 1 / span 4;
    border-radius: 1rem;
    border: 2px solid #E29265;
    box-shadow: 12px 12px 0 0 #B6CBF6;
    padding: 10px;
  }
  .header-section {
    display: flex;
    padding: 0 10px;
  }
  .items {
    margin-left: auto;
  }
  .item-image{
    padding: 25px;
    margin: 25px auto;
    text-align: center;
  }
  .fa-file-image {
    color: #D0435B;
  }
  .content-section {
    margin-top: 65px;
  }
  .item-description-dark {
    background-color: #403757;
    padding: 5px;
    margin: 10px 80px;
    border-radius: 1rem;
  }
  .item-description-light {
    background-color: #EFEFEF;
    padding: 5px;
    margin: 10px 50px;
    border-radius: 1rem;
  }
  .item-line{
    background-color: #D0435B;
    padding: 10px;
    margin: 10px 20px;
    border-radius: 1rem;
  }
  .l2, .l3, .l4 {
    background-color: #FCF0EF;
  }
  .content-section .item-description-light{
    margin-top: 35px;
  }
  .btn {
    color: #fff;
    border-radius: 2px;
    border: none;
    line-height: 42px;
    width: 130px;
    font-size: 20px;
    text-transform: uppercase;
    cursor: pointer;
    margin-top: 15px;
  }
  .btn.b {
    background-color: #0facf3;
  }
  .btn.v {
    background-color: #9574EA;
  }
  .btn.r{
    background-color: #ff0022;
  }
  ul {
    list-style-type: none;
    padding: 0;
    margin-top: 10px;
  }
  li {
    padding: 5px;
  }
  li i {
      font-size: 17px;
      text-shadow: 1px 1px #B6CBF6;
  }
  li span {
      font-size: 20px;
  }
  #li-square-0 i{
    color: #D0435B
  }
  #li-square-1 i{
    color: #FCF0EF;
  }
  #li-square-2 i {
    color: #403757;
  }
  
            
          
!

JS

            
              const hexCodes = seed =>{
  const url = 'https://api.noopschallenge.com/hexbot?count=3&seed='+seed;
  fetch(url)
  .then(response => response.json())
  .then(data =>{   
    let size = Object.keys(data.colors).length;
    document.getElementById('file-image').style.color = data.colors[0].value;
    document.getElementById('l0').style.backgroundColor = data.colors[0].value;
    document.getElementById('item-dark').style.backgroundColor = data.colors[1].value;

    for(let i = 0; i <= size; i++) {
      if(i > 0){
        document.getElementById(`l${i}`).style.backgroundColor = data.colors[2].value;
      }
      let li = document.getElementById(`li-square-${i}`);
      let hexCode = data.colors[i].value;
      li.querySelector('.fas').style.color = hexCode;
      li.querySelector('span').innerHTML = hexCode;
    }
  })
    .catch (error =>{
      console.log(error);
  })
}
            
          
!
999px

Console