A Pen by Mark Howard on CodePen.
Created
May 4, 2017 15:30
-
-
Save ideabrian/5d3c39ade946c1ffb2146265f3faa2ed to your computer and use it in GitHub Desktop.
Background Color Picker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="hex"> | |
<input type="color" id="color" value="#49bc58" onchange="getColor()" /> | |
<h1 id="output">CHOOSE A COLOR</h1> | |
</div> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getColor() { | |
var color = $("#color").val(); | |
$("body").css("background", color); | |
$("#output").text(color); | |
$("#output").css("color", color); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> | |
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
display: flex; | |
justify-content: center; | |
background: #49bc58; | |
align-items: center; | |
height: 100vh; | |
} | |
#hex { | |
border-radius: 10px; | |
width: auto; | |
height: auto; | |
background: white; | |
color: #555; | |
text-align: center; | |
padding: 20px; | |
} | |
#color { | |
outline: none; | |
border: 0; | |
transition: all 0.5s ease; | |
width: 100px; | |
height: 100px; | |
&:hover { | |
transform: scale(1.1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment