Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronvanston/3d528669a18b9620a925 to your computer and use it in GitHub Desktop.
Save aaronvanston/3d528669a18b9620a925 to your computer and use it in GitHub Desktop.
Spread the Rainbow
<h4>Only works on Chrome 39+ on Android Lollipop+</h4>
<button type="button" class="btn change-theme">Spread the rainbow</button>
$(".change-theme, body").on("click", function() {
var colour = '#' + Math.floor(Math.random() * 16777215).toString(16);
$("#themeColour").attr('content', colour);
$(".change-theme").css("color", colour)
});
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

Spread the Rainbow

View this on Chrome 39+ on Android with at least Lollipop

A Pen by Aaron on CodePen.

License.

html,
body {
background-color: #cccccc;
padding: 0;
margin: 0;
color: #000;
font-family: 'Open Sans', sans-serif;
text-align: center;
height: 100%;
position: relative;
overflow: hidden;
cursor: pointer;
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
}
h4{
line-height: 1em;
font-weight: 100;
font-size: 1rem;
padding-left: 20px;
padding-right: 20px;
text-transform: uppercase;
}
.btn {
display: inline-block;
font-weight: 400;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
border: 1px solid transparent;
color: #000000;
background-color: transparent;
background-image: none;
border-color: inherit;
padding: .75rem 1.25rem;
font-size: 1.5rem;
line-height: 1.333333;
border-radius: .3rem;
margin-top: 5rem;
}
.btn:active,
.btn:hover,
.btn:focus{
outline:none;
text-decoration: none;
color: inherit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment