File tree Expand file tree Collapse file tree 1 file changed +62
-0
lines changed
Expand file tree Collapse file tree 1 file changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+
4+ < head >
5+ < meta charset ="UTF-8 ">
6+ < title > Color Picker App</ title >
7+ < style >
8+ body {
9+ font-family : system-ui, Arial;
10+ text-align : center;
11+ background-color : # f5f5f5 ;
12+ margin-top : 100px ;
13+ transition : background-color 0.5s ;
14+ }
15+
16+ .picker-container {
17+ display : inline-block;
18+ background : # fff ;
19+ padding : 25px 30px ;
20+ border-radius : 12px ;
21+ box-shadow : 0 4px 20px rgba (0 , 0 , 0 , 0.1 );
22+ }
23+
24+ h2 {
25+ margin-bottom : 15px ;
26+ }
27+
28+ input [type = "color" ] {
29+ border : none;
30+ width : 80px ;
31+ height : 50px ;
32+ cursor : pointer;
33+ }
34+
35+ # hexValue {
36+ margin-top : 10px ;
37+ font-size : 18px ;
38+ font-weight : 600 ;
39+ }
40+ </ style >
41+ </ head >
42+
43+ < body >
44+ < div class ="picker-container ">
45+ < h2 > 🎨 Pick a Color</ h2 >
46+ < input type ="color " id ="colorPicker " value ="#00bcd4 ">
47+ < p id ="hexValue "> #00BCD4</ p >
48+ </ div >
49+
50+ < script >
51+ const picker = document . getElementById ( "colorPicker" ) ;
52+ const hexValue = document . getElementById ( "hexValue" ) ;
53+
54+ picker . addEventListener ( "input" , ( ) => {
55+ document . body . style . backgroundColor = picker . value ;
56+ hexValue . textContent = picker . value . toUpperCase ( ) ;
57+ hexValue . style . color = picker . value ;
58+ } ) ;
59+ </ script >
60+ </ body >
61+
62+ </ html >
You can’t perform that action at this time.
0 commit comments