1+ <!DOCTYPE html>
2+ < html >
3+ < head >
4+ < meta charset ="utf-8 " />
5+ < meta name ="viewport " content ="width=device-width,initial-scale=1 " />
6+ < title > Interactive Colour Picker</ title >
7+ < link rel ="stylesheet " href ="https://pyscript.net/releases/2025.11.2/core.css ">
8+ < script type ="module " src ="https://pyscript.net/releases/2025.11.2/core.js "> </ script >
9+ < style >
10+ body {
11+ font-family : system-ui, -apple-system, sans-serif;
12+ max-width : 800px ;
13+ margin : 2rem auto;
14+ padding : 0 1rem ;
15+ background : # f5f5f5 ;
16+ }
17+ h1 {
18+ color : # 333 ;
19+ margin-bottom : 2rem ;
20+ }
21+ .container {
22+ background : white;
23+ padding : 2rem ;
24+ border-radius : 8px ;
25+ box-shadow : 0 2px 4px rgba (0 , 0 , 0 , 0.1 );
26+ }
27+ .colour-display {
28+ width : 100% ;
29+ height : 200px ;
30+ border-radius : 8px ;
31+ margin-bottom : 2rem ;
32+ transition : background-color 0.3s ;
33+ display : flex;
34+ align-items : center;
35+ justify-content : center;
36+ font-size : 2rem ;
37+ font-weight : bold;
38+ color : white;
39+ text-shadow : 0 2px 4px rgba (0 , 0 , 0 , 0.3 );
40+ }
41+ .controls {
42+ display : grid;
43+ gap : 1rem ;
44+ }
45+ .control-group {
46+ display : flex;
47+ align-items : center;
48+ gap : 1rem ;
49+ }
50+ .control-group label {
51+ min-width : 80px ;
52+ font-weight : 500 ;
53+ }
54+ .control-group input [type = "range" ] {
55+ flex : 1 ;
56+ }
57+ .control-group input [type = "number" ] {
58+ width : 70px ;
59+ padding : 0.5rem ;
60+ border : 2px solid # ddd ;
61+ border-radius : 4px ;
62+ text-align : center;
63+ }
64+ .hex-input {
65+ width : 100% ;
66+ padding : 0.75rem ;
67+ border : 2px solid # ddd ;
68+ border-radius : 4px ;
69+ font-family : monospace;
70+ font-size : 1.1rem ;
71+ text-transform : uppercase;
72+ }
73+ .presets {
74+ display : grid;
75+ grid-template-columns : repeat (auto-fit, minmax (100px , 1fr ));
76+ gap : 0.5rem ;
77+ margin-top : 1.5rem ;
78+ }
79+ .preset-btn {
80+ padding : 1rem ;
81+ border : 2px solid # ddd ;
82+ border-radius : 4px ;
83+ cursor : pointer;
84+ transition : all 0.2s ;
85+ text-align : center;
86+ font-size : 0.9rem ;
87+ }
88+ .preset-btn : hover {
89+ transform : translateY (-2px );
90+ box-shadow : 0 4px 8px rgba (0 , 0 , 0 , 0.1 );
91+ }
92+ .history {
93+ margin-top : 1.5rem ;
94+ }
95+ .history h3 {
96+ margin-bottom : 0.5rem ;
97+ }
98+ .history-colours {
99+ display : flex;
100+ gap : 0.5rem ;
101+ flex-wrap : wrap;
102+ }
103+ .history-colour {
104+ width : 50px ;
105+ height : 50px ;
106+ border-radius : 4px ;
107+ cursor : pointer;
108+ border : 2px solid # ddd ;
109+ transition : transform 0.2s ;
110+ }
111+ .history-colour : hover {
112+ transform : scale (1.1 );
113+ }
114+ </ style >
115+ </ head >
116+ < body >
117+ < h1 > Interactive Colour Picker</ h1 >
118+
119+ < div class ="container ">
120+ < div class ="colour-display " id ="colour-display "> #3498DB</ div >
121+
122+ < div class ="controls ">
123+ < div class ="control-group ">
124+ < label for ="red-slider "> Red:</ label >
125+ < input type ="range " id ="red-slider " min ="0 " max ="255 " value ="52 " />
126+ < input type ="number " id ="red-value " min ="0 " max ="255 " value ="52 " />
127+ </ div >
128+
129+ < div class ="control-group ">
130+ < label for ="green-slider "> Green:</ label >
131+ < input type ="range " id ="green-slider " min ="0 " max ="255 " value ="152 " />
132+ < input type ="number " id ="green-value " min ="0 " max ="255 " value ="152 " />
133+ </ div >
134+
135+ < div class ="control-group ">
136+ < label for ="blue-slider "> Blue:</ label >
137+ < input type ="range " id ="blue-slider " min ="0 " max ="255 " value ="219 " />
138+ < input type ="number " id ="blue-value " min ="0 " max ="255 " value ="219 " />
139+ </ div >
140+
141+ < div class ="control-group ">
142+ < label for ="hex-input "> Hex:</ label >
143+ < input type ="text " id ="hex-input " class ="hex-input " value ="#3498DB " />
144+ </ div >
145+ </ div >
146+
147+ < div class ="presets ">
148+ < button class ="preset-btn " data-colour ="#E74C3C " style ="background-color: #E74C3C; color: white; "> Red</ button >
149+ < button class ="preset-btn " data-colour ="#3498DB " style ="background-color: #3498DB; color: white; "> Blue</ button >
150+ < button class ="preset-btn " data-colour ="#2ECC71 " style ="background-color: #2ECC71; color: white; "> Green</ button >
151+ < button class ="preset-btn " data-colour ="#F39C12 " style ="background-color: #F39C12; color: white; "> Orange</ button >
152+ < button class ="preset-btn " data-colour ="#9B59B6 " style ="background-color: #9B59B6; color: white; "> Purple</ button >
153+ < button class ="preset-btn " data-colour ="#1ABC9C " style ="background-color: #1ABC9C; color: white; "> Teal</ button >
154+ </ div >
155+
156+ < div class ="history ">
157+ < h3 > Recent Colours</ h3 >
158+ < div id ="history-colours " class ="history-colours "> </ div >
159+ </ div >
160+ </ div >
161+
162+ < script type ="mpy " src ="./main.py "> </ script >
163+ </ body >
164+ </ html >
0 commit comments