A Pen by HARUN PEHLİVAN on CodePen.
Created
May 25, 2021 23:21
-
-
Save harunpehlivan/1abd516b10dfefad7465743fb5f25fa4 to your computer and use it in GitHub Desktop.
RGB
This file contains hidden or 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
| .container | |
| .expression | |
| span RGB | |
| input(name="red" type="number" class="form-control" placeholder="red" value="255" max="255") | |
| span , | |
| input(name="green" type="number" class="form-control" placeholder="green" value="255" max="255") | |
| span , | |
| input(name="blue" type="number" class="form-control" placeholder="blue" value="255" max="255") | |
| span | |
| #rgb | |
| #red | |
| #green | |
| #blue |
This file contains hidden or 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
| $(document).ready(() => { | |
| $("input").change((event) => { | |
| if(event.target.value > 255) { | |
| event.target.value = 255; | |
| } | |
| }); | |
| $("input[name='red']").change((event) => { | |
| //$("input[name='red']").css("color", "rgb("+event.target.value+",0,0)"); | |
| $("#red").css("background-color", "rgb("+event.target.value+",0,0)"); | |
| }); | |
| $("input[name='green']").change((event) => { | |
| //$("input[name='green']").css("color", "rgb(0,"+event.target.value+",0)"); | |
| $("#green").css("background-color", "rgb(0,"+event.target.value+",0)"); | |
| }); | |
| $("input[name='blue']").change((event) => { | |
| //$("input[name='blue']").css("color", "rgb(0,0,"+event.target.value+")"); | |
| $("#blue").css("background-color", "rgb(0,0,"+event.target.value+")"); | |
| }); | |
| }); |
This file contains hidden or 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://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> |
This file contains hidden or 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
| @import url('https://fonts.googleapis.com/css?family=PT+Mono'); | |
| html { | |
| background-color: black; | |
| } | |
| .container { | |
| position: absolute; | |
| vertical-align: middle; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| width: 100%; | |
| height: 100%; | |
| white-space: nowrap; | |
| overflow: hidden; | |
| } | |
| .expression { | |
| font-family: 'PT Mono', monospace; | |
| font-size: 0; | |
| color: #ccc; | |
| } | |
| .expression span { | |
| font-size: 20px; | |
| } | |
| .form-control { | |
| display: inline; | |
| width: 75px; | |
| background-color: #222; | |
| border-bottom: 1px solid white; | |
| border-radius: 0px; | |
| padding-bottom: 5px; | |
| color: white; | |
| font-size: 20px; | |
| } | |
| #rgb { | |
| // without isolation, the background color will be taken into account | |
| isolation: isolate; | |
| position: relative; | |
| width: 250px; | |
| height: 200px; | |
| top: -900px; | |
| left: 100px; | |
| } | |
| #red, #green, #blue { | |
| position: absolute; | |
| width: 100px; | |
| height: 2000px; | |
| mix-blend-mode: screen; | |
| transform-origin: center center; | |
| } | |
| #red { | |
| background-color: red; | |
| transform: rotate(-60deg); | |
| } | |
| #green { | |
| background-color: lime; | |
| } | |
| #blue { | |
| background-color: blue; | |
| transform: rotate(60deg); | |
| } |
This file contains hidden or 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
| <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment