HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<!-- <a id="academo-banner" href="https://academo.org/demos/wavelength-to-colour-relationship/" target="_blank">Find out more at Academo.org</a> -->
<!-- CSS was online here : -->
<!--
https://academo.org/scss/main.css?v=1618715105338 -->
<!-- https://academo.org/demos/wavelength-to-colour-relationship/ -->
<!-- <br> -->
<div style="position:realtive; padding:20px;display:flex;margin-top:0; justify-content: center">
<div style="position:realtive; ;display:flex column ">
<h1 style="top:0; margin:0 0 10px;border-left:8px solid red; padding-left:10px">Wavelength to Color</h1>
<p style="font-size:12px;width:700px">
Over the course of millions of years, the human eye has evolved to detect light in the range 380—780nm; a portion of the electromagnetic spectrum known as "visible light", which we perceive as colour. The particular range of wavelengths comes in phase with a window in the Earth's atmosphere, through which this light can travel. Higher frequency radiation, such as X-rays are absorbed by our atmosphere, as are lower wave frequencies, such as microwaves.
<br>
Sunlight appears white to us because it emits almost uniformly over all visible wavelength. However, a laser emits only at a single very specific, unique and precise wavelength. We can begin to wrap our mind around how frequency or light wavelength is related to colour.
<br>
<br>
Most of the times, when referring to colour on computer screens is by using the RGB system. In this Red, GRen adn Blue color model, each colour is given a value for each of the 3 components (red, green and blues) ranging from 0 to 255. Hence giving us a total value of 256 x 256 x 256 = 16.7 million possible colours. <br>
<br>However, due to the very complex way in which our human eyes perceives colors, we can see colors which are <em>outside</em> of the gamut (limit boudaries) of the RGB color space, there is no unique mapping that definitively converts a wavelength to a colour, and as such the below tool should been seen as more of an approximation than a rigorous resource.
</div>
</div>
<div style="display:flex;justify-content: center;">
<div style="display:flex row;margin:10px">
<div id="demo">
</div>
<div id="ui-container">
</div>
<div class="pointRepere" id="refPoint"></div>
</div>
</div>
@import "https://fonts.googleapis.com/css2?family=Open+Sans:ital,[email protected],400;0,700;1,400&display=swap";
.clearfix:after {
content: "";
display: table;
clear: both;
}
.mobile-show {
display: none;
}
@media (max-width: 400px) {
.mobile-show {
display: block;
}
.mobile-hide {
display: none;
}
}
@font-face {
font-family: fontello;
src: url(/fonts/fontello/fontello.eot?76394341);
src: url(/fonts/fontello/fontello.eot?76394341#iefix)
format("embedded-opentype"),
url(/fonts/fontello/fontello.woff2?76394341) format("woff2"),
url(/fonts/fontello/fontello.woff?76394341) format("woff"),
url(/fonts/fontello/fontello.ttf?76394341) format("truetype"),
url(/fonts/fontello/fontello.svg?76394341#fontello) format("svg");
font-weight: 400;
font-style: normal;
}
[class^="icon-"]:before,
[class*=" icon-"]:before {
font-family: fontello;
font-style: normal;
font-weight: 400;
speak: never;
display: inline-block;
text-decoration: inherit;
width: 1em;
margin-right: 0.2em;
text-align: center;
font-variant: normal;
text-transform: none;
line-height: 1em;
margin-left: 0.2em;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-link-ext:before {
content: "\f08e";
}
.icon-twitter:before {
content: "\f099";
}
.icon-facebook:before {
content: "\f308";
} /*!normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css*/
html {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
user-select:none;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block;
}
audio,
canvas,
progress,
video {
display: inline-block;
vertical-align: baseline;
}
audio:not([controls]) {
display: none;
height: 0;
}
[hidden],
template {
display: none;
}
a {
background-color: transparent;
}
a:active,
a:hover {
outline: 0;
}
abbr[title] {
border-bottom: 1px dotted;
}
b,
strong {
font-weight: 700;
}
dfn {
font-style: italic;
}
h1 {
font-size: 2em;
margin: 0.67em 0;
}
mark {
background: #ff0;
color: #000;
}
small {
font-size: 80%;
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
img {
border: 0;
}
svg:not(:root) {
overflow: hidden;
}
figure {
margin: 1em 40px;
}
hr {
box-sizing: content-box;
height: 0;
}
pre {
overflow: auto;
}
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
button,
input,
optgroup,
select,
textarea {
color: inherit;
font: inherit;
margin: 0;
}
button {
overflow: visible;
}
button,
select {
text-transform: none;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
cursor: pointer;
}
button[disabled],
html input[disabled] {
cursor: default;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
input {
line-height: normal;
}
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box;
padding: 0;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
input[type="search"] {
-webkit-appearance: textfield;
box-sizing: content-box;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
fieldset {
border: 1px solid silver;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
legend {
border: 0;
padding: 0;
}
textarea {
overflow: auto;
}
optgroup {
font-weight: 700;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
}
h1 {
font-weight: 700;
color: rgba(2, 5, 53, 0.75);
font-size: 48px;
line-height: 1;
margin: 30px 0 20px;
}
h2 {
color: rgba(2, 5, 53, 0.75);
}
@media (max-width: 600px) {
h1 {
font-size: 30px;
margin-top: 30px;
}
}
a {
color: #1abc9c;
transition: color 0.3s;
}
a:hover {
color: #f90;
transition-duration: 0s;
}
p,
li {
font-size: 18px;
line-height: 1.5;
color: #111;
}
p {
margin-top: 0;
margin-bottom: 20px;
}
.small {
font-size: 12px;
}
.embed-code {
padding: 5px;
font-family: courier;
}
@media (max-width: 1000px) {
p,
li {
font-size: 16px;
}
}
@media (max-width: 700px) {
p,
li {
font-size: 14px;
}
}
body {
font-family: open sans, sans-serif;
}
.body--shaded {
background: #e9e9e9;
}
html,
body {
margin: 0;
padding: 0;
height: 100%;
}
.wrapper {
max-width: 1200px;
background: #fff;
box-shadow: 0 0 3px 0 #c8c8c8;
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -62px;
}
.fullscreen .wrapper {
max-width: 100%;
}
.main {
width: 90%;
overflow: hidden;
margin: 0 auto;
}
.lead {
font-size: 1.4em;
}
hr {
margin: 20px 0;
border: 0;
border-top: 1px solid #ecf0f1;
}
.hr--margin-large {
margin: 60px 0;
}
#academo-banner {
padding: 10px;
background: rgba(0, 0, 0, 0.6);
position: fixed;
top: 0;
left: 0;
color: #fff;
text-decoration: none;
}
#academo-banner:hover {
color: #1abc9c;
}
.social-buttons {
min-height: 40px;
overflow: hidden;
}
.social-button {
display: block;
float: left;
padding: 0 10px 10px 0;
}
.social-button--google-classroom {
min-width: 32px;
}
.social-button--facebook a,
.social-button--twitter a {
background: url(/img/social-media-sprite.png);
background-size: 136px 54px;
display: block;
margin-top: 5px;
}
.social-button--patreon a:hover {
opacity: 0.85;
}
.social-button--twitter a {
width: 63px;
height: 26px;
}
.social-button--twitter a:hover {
background-position: 0 24px;
}
.social-button--facebook a {
width: 61px;
height: 25px;
background-position: 61px 0;
}
.social-button--facebook a:hover {
background-position: 61px 24px;
}
@media (max-width: 1200px) {
.wrapper {
margin-top: 0;
}
}
.header {
background: #fff;
}
.header-upper {
background: #020535;
overflow: hidden;
padding: 25px;
}
.header-upper .header-inner {
position: relative;
}
.logo {
font-size: 32px;
position: absolute;
top: -10px;
left: 0;
text-transform: lowercase;
}
.logo img {
width: 40px;
vertical-align: middle;
margin-right: 10px;
}
.header-lower {
background: rgba(2, 5, 53, 0.85);
overflow: hidden;
padding: 10px 20px;
border-top: solid 1px #1abc9c;
}
.header a {
text-decoration: none;
color: rgba(255, 255, 255, 0.95);
}
.header a:hover,
.header a.current {
color: #f90;
}
.header-inner {
width: 100%;
max-width: 1200px;
margin: 0 auto;
}
.nav {
float: right;
padding: 0;
margin: 0 0 0 40px;
}
.nav--secondary {
float: left;
margin-left: 0;
}
.nav li {
float: left;
list-style: none;
margin-left: 20px;
}
.nav--secondary li {
margin-left: 0;
margin-right: 20px;
}
.sponsor-wrapper {
padding: 20px 0;
width: 90%;
margin: 20px auto;
box-sizing: border-box;
}
.sponsor-wrapper a {
float: right;
}
.sposor-wrapper img {
width: 100%;
}
.nav--primary .social--facebook {
margin-left: 0;
}
@media (max-width: 800px) {
.header-upper {
/* padding: 15px 20px; */
}
.logo {
position: static;
float: left;
font-size: 26px;
top: -6px;
margin-right: 20px;
}
.logo img {
width: 30px;
margin-right: 5px;
}
.header a {
font-size: 16px;
}
.nav--primary {
margin-top: 10px;
margin-left: 0;
float: left;
clear: both;
}
.nav--primary li {
margin-left: 0;
margin-right: 20px;
}
}
@media (max-width: 600px) {
.nav--primary .social--twitter,
.nav--primary .social--facebook {
position: absolute;
top: 0;
right: 20px;
}
.nav--primary .social--facebook {
right: 0;
}
}
.thumbnails {
margin: 0 -18px;
padding: 0;
overflow: hidden;
}
.thumbnails li {
list-style: none;
float: left;
margin: 20px;
width: calc(25% - 40px);
}
.thumbnails li:nth-child(4n + 1) {
clear: both;
}
.thumbnail-title {
font-size: 14px;
color: #333;
font-weight: 700;
transition: color 0.3s;
}
.thumbnails a {
text-decoration: none;
color: #666;
transition: color 0.3s;
display: block;
}
.thumbnails a:hover .thumbnail-title {
color: #f90;
transition-duration: 0s;
}
.thumbnails img:not(.no-image-styles) {
border: solid 1px #c8c8c8;
transition: opacity 0.3s;
width: 100%;
}
.thumbnails img:not(.no-image-styles):hover {
opacity: 0.85;
transition-duration: 0s;
}
.sponsored-tile img {
height: auto;
}
@media (max-width: 880px) {
.thumbnails li {
width: calc(33% - 40px);
}
.thumbnails li:nth-child(4n + 1) {
clear: none;
}
.thumbnails li:nth-child(3n + 1) {
clear: both;
}
}
@media (max-width: 600px) {
.thumbnails li {
width: calc(50% - 40px);
}
.thumbnails li:nth-child(4n + 1) {
clear: none;
}
.thumbnails li:nth-child(3n + 1) {
clear: none;
}
.thumbnails li:nth-child(2n + 1) {
clear: both;
}
}
.home .main {
text-align: center;
}
.home .thumbnails li {
float: none;
display: inline-block;
vertical-align: top;
}
.home .main p {
max-width: 600px;
margin-left: auto;
margin-right: auto;
}
.home .logos {
list-style-type: none;
padding: 0;
max-width: 800px;
margin-left: auto;
margin-right: auto;
}
.home .logos li {
display: inline-block;
vertical-align: top;
}
.home .logos img {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
filter: grayscale(100%);
opacity: 0.6;
margin: 20px;
transition: all 0.5s;
}
.home .logos img:hover {
-webkit-filter: grayscale(0%);
-moz-filter: grayscale(0%);
filter: grayscale(0%);
opacity: 1;
transition-duration: 0s;
}
.tweets {
overflow: hidden;
width: 90%;
max-width: 1000px;
margin: 0 auto;
text-align: center;
}
.tweet {
width: 30%;
display: inline-block;
padding: 10px;
box-sizing: border-box;
vertical-align: top;
}
blockquote.twitter-tweet {
display: inline-block;
font-family: helvetica neue, Roboto, segoe ui, Calibri, sans-serif;
font-size: 12px;
font-weight: 700;
line-height: 16px;
border-color: #eee #ddd #bbb;
border-radius: 5px;
border-style: solid;
border-width: 1px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
margin: 10px 5px;
padding: 0 16px 16px;
max-width: 468px;
}
blockquote.twitter-tweet p {
font-size: 16px;
font-weight: 400;
line-height: 20px;
margin-top: 20px;
}
blockquote.twitter-tweet a {
color: inherit;
font-weight: 400;
text-decoration: none;
outline: 0;
}
blockquote.twitter-tweet a:hover,
blockquote.twitter-tweet a:focus {
text-decoration: underline;
}
@media (max-width: 1000px) {
.tweet {
width: 40%;
display: inline-block;
margin: 0 auto;
}
}
@media (max-width: 730px) {
.tweets {
width: 100%;
}
.tweet {
display: block;
width: 100%;
margin: 0 auto;
}
}
.tags a {
text-decoration: none;
padding: 5px 10px;
display: inline-block;
margin: 0 10px 10px 0;
background: #e9e9e9;
color: #666;
transition: background 0.3s;
font-size: 16px;
text-transform: capitalize;
}
.tags a:hover {
background: #8ddece;
transition-duration: 0s;
}
#demo {
margin-bottom: 20px;
}
#demo,
.demo-description {
float: left;
width: 800px;
width: calc(100% - 260px);
}
.demo--wide {
width: 100% !important;
}
.demo-description {
margin-bottom: 60px;
max-width: 700px;
margin-top: 60px;
}
.video-wrapper {
margin: 40px auto;
}
.video-wrapper iframe {
margin: 0 auto;
display: block;
}
.responsive-video-wrapper {
position: relative;
padding-bottom: 56.25%;
height: 0;
}
.responsive-video-wrapper .responsive-video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
#disqus_thread {
margin-top: 60px;
}
@media (max-width: 1120px) {
.demo-description {
margin-left: 0;
}
}
@media (max-width: 768px) {
#demo,
.demo-description {
width: 100%;
margin: 0 0 20px;
}
}
.demo-description h3 {
margin: 40px 0 0;
}
#ui-container,
.sidebar {
float: right;
width: 240px;
background: #e9e9e9;
padding: 20px;
margin-bottom: 20px;
box-sizing: border-box;
}
.sidebar {
margin-top: 60px;
}
.sidebar .thumbnails {
padding: 2px;
margin: 0;
}
.sidebar h3 {
margin-top: 0;
}
.preamble hr {
margin-top: 0;
}
.credits li {
font-size: 16px;
}
.sidebar .thumbnails li {
width: 100%;
margin: 0 0 20px;
}
.sidebar .thumbnails li:nth-child(4n + 1) {
clear: none;
}
@media (max-width: 1020px) {
.sidebar {
width: 100%;
margin: 0 0 20px;
}
.sidebar .thumbnails li {
margin: 20px;
width: calc(33% - 40px);
}
.sidebar .thumbnails li:nth-child(3n + 1) {
clear: both;
}
}
@media (max-width: 600px) {
.sidebar .thumbnails li {
width: calc(50% - 40px);
}
.sidebar .thumbnails li:nth-child(3n + 1) {
clear: none;
}
.sidebar .thumbnails li:nth-child(2n + 1) {
clear: both;
}
}
@media (max-width: 320px) {
.sidebar .thumbnails li {
width: 100%;
margin-left: 0;
}
.sidebar .thumbnails li img {
width: 99%;
}
}
.subcategory-list h3 {
margin-bottom: 0;
}
.category-description {
max-width: 800px;
}
.contact-form {
max-width: 600px;
}
#search-query {
width: 100%;
max-width: 300px;
padding: 5px;
}
.about p {
max-width: 620px;
}
.noUi-target * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-touch-callout: none;
-ms-touch-action: none;
cursor: default;
}
.noUi-base {
width: 100%;
height: 20px;
position: relative;
max-width: 100%;
max-height: 100%;
border: 1px solid #bfbfbf;
z-index: 1;
}
.noUi-handle {
background: #eee;
height: 44px;
width: 44px;
border: 1px solid #bfbfbf;
margin: -3px 0 0 -10px;
}
.noUi-active {
background: #e9e9e9;
}
.noUi-connect {
background: Teal;
}
.noUi-background {
background: #ddd;
}
.noUi-origin {
position: absolute;
right: 0;
top: 0;
bottom: 0;
z-index: 0;
border-radius: inherit;
}
.noUi-origin-upper {
background: inherit !important;
}
.noUi-z-index {
z-index: 10;
}
.noUi-vertical {
width: 40px;
height: 100%;
}
.noUi-vertical .noUi-origin {
bottom: 0;
left: 0;
}
.noUi-vertical .noUi-handle {
margin: -23px 0 0 -3px;
}
.noUi-target[disabled] .noUi-base {
background: #999;
}
.noUi-target[disabled] .noUi-connect {
background: #bbb;
}
.noUi-state-tap .noUi-origin {
-webkit-transition: left 0.3s, top 0.3s;
transition: left 0.3s, top 0.3s;
}
.noUi-base {
height: 11px;
border-color: #ccc;
}
.noUi-background {
background-color: #fff;
}
.noUi-connect {
margin-top: 15px;
background: #2c3e50;
float: left;
}
.noUi-handle {
cursor: pointer;
margin-top: -8px;
height: 25px;
width: 18px;
background-color: #d4d4d4;
border: 0 solid rgba(0, 0, 0, 0.1);
border-radius:3px;
outline: none;
}
.noUi-handle:hover {
background: #288edf;
}
.noUi-handle {
background: #eee;
border: 1px solid #ccc;
}
.noUi-active {
background-color:hsl(213,100%,41%)!important;
}
fieldset {
padding: 0;
margin: 0;
border: 0;
}
label {
display: inline-block;
margin-bottom: 5px;
font-weight: 700;
}
input[type="search"] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
input[type="radio"],
input[type="checkbox"] {
margin: 4px 0 0;
margin-top: 1px \9;
line-height: normal;
}
input[type="file"] {
display: block;
}
select[multiple],
select[size] {
height: auto;
}
select optgroup {
font-size: inherit;
font-style: inherit;
font-family: inherit;
}
input[type="file"]:focus,
input[type="radio"]:focus,
input[type="checkbox"]:focus {
outline: thin dotted #333;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
.form-control {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
color: #555;
vertical-align: middle;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
}
.form-control:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075),
0 0 8px rgba(102, 175, 233, 0.6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075),
0 0 8px rgba(102, 175, 233, 0.6);
}
.form-control:-moz-placeholder {
color: #999;
}
.form-control::-moz-placeholder {
color: #999;
}
.form-control:-ms-input-placeholder {
color: #999;
}
.form-control::-webkit-input-placeholder {
color: #999;
}
.form-control[disabled],
.form-control[readonly],
fieldset[disabled] .form-control {
cursor: not-allowed;
}
.form-group {
margin-bottom: 15px;
}
.radio,
.checkbox {
display: block;
min-height: 20px;
margin-bottom: 10px;
padding-left: 20px;
vertical-align: middle;
}
.radio label,
.checkbox label {
display: inline;
margin-bottom: 0;
font-weight: 400;
cursor: pointer;
}
.radio input[type="radio"],
.radio-inline input[type="radio"],
.checkbox input[type="checkbox"],
.checkbox-inline input[type="checkbox"] {
float: left;
margin-left: -20px;
}
.radio + .radio,
.checkbox + .checkbox {
margin-top: -5px;
}
.radio-inline,
.checkbox-inline {
display: inline-block;
padding-left: 20px;
margin-bottom: 0;
vertical-align: middle;
font-weight: 400;
cursor: pointer;
}
.radio-inline + .radio-inline,
.checkbox-inline + .checkbox-inline {
margin-top: 0;
margin-left: 10px;
}
input[type="radio"][disabled],
input[type="checkbox"][disabled],
.radio[disabled],
.radio-inline[disabled],
.checkbox[disabled],
.checkbox-inline[disabled],
fieldset[disabled] input[type="radio"],
fieldset[disabled] input[type="checkbox"],
fieldset[disabled] .radio,
fieldset[disabled] .radio-inline,
fieldset[disabled] .checkbox,
fieldset[disabled] .checkbox-inline {
cursor: not-allowed;
}
.form-control-static {
margin-bottom: 0;
}
.help-block {
display: block;
margin-top: 5px;
margin-bottom: 10px;
color: #737373;
}
@media (min-width: 768px) {
.form-inline .form-group {
display: inline-block;
margin-bottom: 0;
vertical-align: middle;
}
.form-inline .form-control {
display: inline-block;
}
.form-inline .radio,
.form-inline .checkbox {
display: inline-block;
margin-top: 0;
margin-bottom: 0;
padding-left: 0;
}
.form-inline .radio input[type="radio"],
.form-inline .checkbox input[type="checkbox"] {
float: none;
margin-left: 0;
}
}
.input-group {
position: relative;
display: table;
border-collapse: separate;
}
.input-group.col {
float: none;
padding-left: 0;
padding-right: 0;
}
.input-group .form-control {
/* width: 100%; */
width: 50px;
position:relative;
float:right;
margin-bottom: 0;
}
.input-group-addon,
.input-group .form-control {
display: table-cell;
}
.input-group-addon {
width: 1%;
white-space: nowrap;
vertical-align: middle;
}
.input-group-addon {
padding: 6px 12px;
font-size: 14px;
font-weight: 400;
line-height: 1;
color: #555;
text-align: center;
background-color: #eee;
border: 1px solid #ccc;
}
.input-group-addon input[type="radio"],
.input-group-addon input[type="checkbox"] {
margin-top: 0;
}
.input-group-addon:first-child {
border-right: 0;
}
.input-group-addon:last-child {
border-left: 0;
}
table {
max-width: 100%;
border-collapse: collapse;
border-spacing: 0;
}
.table {
width: 100%;
margin-bottom: 20px;
}
.table th,
.table td {
padding: 8px;
line-height: 20px;
text-align: left;
vertical-align: top;
border-top: 1px solid #ddd;
}
.table th {
font-weight: 700;
}
.table thead th {
vertical-align: bottom;
}
.table thead:first-child tr:first-child th,
.table thead:first-child tr:first-child td {
border-top: 0;
}
.table-bordered {
border: 1px solid #ddd;
border-left: 0;
}
.table-bordered th,
.table-bordered td {
border-left: 1px solid #ddd;
}
.table-bordered thead:first-child tr:first-child th,
.table-bordered tbody:first-child tr:first-child th,
.table-bordered tbody:first-child tr:first-child td {
border-top: 0;
} /*!! Props to Brad Bodine for the Checkboxes! http://codepen.io/bbodine1/details/novBm*/
input[type="checkbox"] {
visibility: hidden;
}
.checkbox {
position: relative;
}
#ui-container .checkbox label {
cursor: pointer;
position: absolute;
width: 20px;
height: 14px;
top: 0;
left: 0;
background: #fff;
border: 1px solid #ccc;
box-shadow: none;
}
.checkbox label:after {
-ms-filter: "alpha(opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
content: "";
position: absolute;
width: 9px;
height: 5px;
background: 0 0;
top: 4px;
left: 4px;
border: 3px solid #f90;
border-top: none;
border-right: none;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.checkbox label:hover::after {
-ms-filter: "alpha(opacity=30)";
filter: alpha(opacity=30);
opacity: 0.1;
}
.checkbox input[type="checkbox"]:checked + label:after {
-ms-filter: "alpha(opacity=100)";
filter: alpha(opacity=100);
opacity: 1;
}
.interface {
margin-bottom: 20px;
padding-bottom: 20px;
border-bottom: 2px solid #ecf0f1;
width: 100%;
}
.interface:first-of-type label {
padding-top: 0;
}
.interface:last-of-type,
.interface.last {
padding-bottom: 0;
border-bottom: none;
}
.interface label {
padding-top: 6px;
}
.interface .noUi-connect {
max-width: 240px;
}
@media (max-width: 768px) {
.interface .input,
.interface .input-append {
margin-right: 40px;
}
.interface .noUi-connect {
margin-bottom: 15px;
}
.interface {
width: 240px;
float: left;
margin-right: 60px;
}
}
.with-units {
text-align: right;
}
.interface.disabled {
opacity: 0.5;
}
#ui-container {
padding: 20px;
background: #efefef;
box-sizing: border-box;
}
#ui-container label,
#ui-container button {
font-size: 13px;
color: #333;
font-weight: 800;
-webkit-appearance: none;
width: 100%;
}
#ui-container button {
padding: 10px;
background: #ddd;
border: none;
border-bottom: solid 2px #ccc;
transition: background 0.3s;
}
#ui-container button:hover {
background: #8ddece;
border-color: #53cdb5;
transition-duration: 0s;
}
#ui-container button:active {
background: #31c3a6;
border-color: #1abc9c;
transition-duration: 0s;
}
#ui-container button:focus {
outline: none;
}
#ui-container .interface {
margin-bottom: 0;
}
#ui-container input {
-webkit-appearance: none;
}
.user-input-numerical {
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.user-input-string {
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.user-input-textarea {
-moz-box-sizing: border-box;
box-sizing: border-box;
height: 100px;
white-space: nowrap;
overflow: auto;
}
.interface input[readonly] {
border: none;
padding: 5px 5px 5px 0;
width: 100%;
background: #efefef;
cursor: text;
}
@media (max-width: 768px) {
#ui-container,
.sidebar {
width: 100%;
float: left;
}
}
@media (max-width: 480px) {
#ui-container {
border: solid 1px #ccc;
max-height: 250px;
overflow: scroll;
}
::-webkit-scrollbar {
-webkit-appearance: none;
width: 4px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
}
}
.footer {
color: #fff;
background: #11172b;
width: 100%;
text-align: right;
max-width: 1200px;
margin: 0 auto;
height: 62px;
}
.footer br {
display: none;
}
.footer p {
color: #fff;
font-size: 15px;
margin-bottom: 0;
}
.footer-inner {
padding: 20px;
}
.push {
height: 62px;
}
@media (max-width: 520px) {
.footer {
text-align: left;
}
.footer-inner {
padding: 10px 20px;
}
.footer p {
font-size: 13px;
}
.footer br {
display: block;
}
}
#color_display {
height: 312px;
}
#color span {
font-weight: bold;
}
#color {
float: left;
}
#color p {
line-height: 2;
}
#demo {
width: 150px;
}
#ui-container {
/* position:relative; */
/* float:unset; */
/* float: left; */
width:400px;
}
.interface .noUi-connect {
max-width: 640px;
}
#rainbowArea{
position:relative;
/* border: 1px solid white; */
}
.pointRepere{
color:white;
border: 1px dashed transparent;
border-right:none;
background:transparent;
width: 0px;
height:80px;
/* border-radius:100%; */
/* margin:10px; */
position:relative;
top:311px;
/* margin:10px; */
/* left:275px; */
/* left:0px; */
}
.pointRepere::before{
content:"";
border: 1px solid hsla(0,0%,0%,.5);
border-radius:6px;
position:absolute;
width:5px;
height:86px;
/* padding:0px; */
top:-4px;
left:-4px;
}
/* This code comes from Academo.org */
var demo = new Demo({
ui: {
wavelength: {
title: "Wavelength, human perception",
value: 550,
units: "nm",
range: [380, 780],
resolution: 1
}
},
color: null,
init: function () {
$("#demo").append("<div id='color_display'></div>");
$("#ui-container").append("<div id='color'></div>");
this.update();
this.renderRainbow();
},
update: function (e) {
this.color = this.nmToRGB(this.ui.wavelength.value);
$("#color_display").css("background-color", this.rgbToHex(this.color));
var colHtml = "<p><span>Color:</span><br />rgb(";
colHtml += this.color[0] + ", " + this.color[1] + ", " + this.color[2];
colHtml += ")<br />Hex: " + this.rgbToHex(this.color) + "<br />";
colHtml += chroma(this.rgbToHex(this.color)).css("hsl");
colHtml += "</p>";
$("#color").html(colHtml);
var offset = 10/2 +1 +20;
// console.log("HERE", (chroma(this.rgbToHex(this.color)).hsl()[0])-180 );
document.getElementById("refPoint").style.setProperty("left",(780 *(this.ui.wavelength.value- 550) / 568)+232 + "px");
document.getElementById("refPoint").style.setProperty("border-color",
"hsl(" + (chroma(this.rgbToHex(this.color)).hsl()[0] + 180) + ",100%,50%)")
},
nmToRGB: function (wavelength) {
var Gamma = 0.8,
IntensityMax = 255,
factor,
red,
green,
blue;
if (wavelength >= 380 && wavelength < 440) {
red = -(wavelength - 440) / (440 - 380);
green = 0.0;
blue = 1.0;
} else if (wavelength >= 440 && wavelength < 490) {
red = 0.0;
green = (wavelength - 440) / (490 - 440);
blue = 1.0;
} else if (wavelength >= 490 && wavelength < 510) {
red = 0.0;
green = 1.0;
blue = -(wavelength - 510) / (510 - 490);
} else if (wavelength >= 510 && wavelength < 580) {
red = (wavelength - 510) / (580 - 510);
green = 1.0;
blue = 0.0;
} else if (wavelength >= 580 && wavelength < 645) {
red = 1.0;
green = -(wavelength - 645) / (645 - 580);
blue = 0.0;
} else if (wavelength >= 645 && wavelength < 781) {
red = 1.0;
green = 0.0;
blue = 0.0;
} else {
red = 0.0;
green = 0.0;
blue = 0.0;
}
// Let the intensity fall off near the vision limits
if (wavelength >= 380 && wavelength < 420) {
factor = 0.3 + (0.7 * (wavelength - 380)) / (420 - 380);
} else if (wavelength >= 420 && wavelength < 701) {
factor = 1.0;
} else if (wavelength >= 701 && wavelength < 781) {
factor = 0.3 + (0.7 * (780 - wavelength)) / (780 - 700);
} else {
factor = 0.0;
}
if (red !== 0) {
red = Math.round(IntensityMax * Math.pow(red * factor, Gamma));
}
if (green !== 0) {
green = Math.round(IntensityMax * Math.pow(green * factor, Gamma));
}
if (blue !== 0) {
blue = Math.round(IntensityMax * Math.pow(blue * factor, Gamma));
}
return [red, green, blue];
},
toHex: function (number) {
//converts a decimal number into hex format
var hex = number.toString(16);
if (hex.length < 2) {
hex = "0" + hex;
}
return hex;
},
rgbToHex: function (color) {
// alert("Here!");
//takes an 3 element array (r,g,b) and returns a hexadecimal color
var hexString = "#";
for (var i = 0; i < 3; i++) {
hexString += this.toHex(color[i]);
}
return hexString;
},
renderRainbow: function () {
//render all the colours - used to generate the thumbnail image
var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
canvas.width = 550;
canvas.height = 80;
canvas.id="rainbowArea";
$("#demo").append(canvas);
for (var i = 0; i < canvas.width; i++) {
ctx.fillStyle = this.rgbToHex(
this.nmToRGB(
this.map(
i,
0,
canvas.width,
this.ui.wavelength.range[0],
this.ui.wavelength.range[1]
)
)
);
ctx.fillRect(i, 0, 1, canvas.height);
ctx.fillStyle = "#fff";
ctx.fill();
// add point on the specrtum
// ctx.beginPath();
// ctx.arc(
// this.ui.wavelength.value -780 + 550,
// canvas.height / 2,
// 10,
// 0,
// 2 * Math.PI
// );
// ctx.stroke();
}
},
map: function (value, minFrom, maxFrom, minTo, maxTo) {
//http://stackoverflow.com/questions/4154969/how-to-map-numbers-in-range-099-to-range-1-01-0
return minTo + (maxTo - minTo) * ((value - minFrom) / (maxFrom - minFrom));
}
});
Also see: Tab Triggers