Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.67 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Make a Color Picker</title>
  6.  
  7. <link rel="stylesheet" href="main.css" media="screen" charset="utf-8">
  8. <style id="jsbin-css">
  9. h1, h2, h3, h4 {
  10. font-family: Monospace;
  11. }
  12.  
  13. button {
  14. min-width: 3em;
  15. min-height: 3em;
  16. border-radius: 1.5em;
  17. }
  18.  
  19. .red {
  20. background-color: red;
  21. }
  22.  
  23. .orange {
  24. background-color: orange;
  25. }
  26.  
  27. .yellow {
  28. background-color: yellow;
  29. }
  30.  
  31. .green {
  32. background-color: green;
  33. }
  34.  
  35. .blue {
  36. background-color: blue;
  37. }
  38.  
  39. .indigo {
  40. background-color: indigo;
  41. }
  42.  
  43. .violet {
  44. background-color: violet;
  45. }
  46.  
  47. .text-aqua {
  48. background-color: aqua;
  49. }
  50.  
  51. .text-chartreuse {
  52. background-color: chartreuse;
  53. }
  54.  
  55. .text-coral {
  56. background-color: coral;
  57. }
  58.  
  59. .text-darkmagenta {
  60. background-color: darkmagenta;
  61. }
  62.  
  63. .text-yellowgreen {
  64. background-color: yellowgreen;
  65. }
  66.  
  67. .text-plum {
  68. background-color: plum;
  69. }
  70.  
  71. .text-tomato {
  72. background-color: tomato;
  73. }
  74.  
  75. .color1 {
  76. background-color: #fbefcc;
  77. }
  78.  
  79. .color2 {
  80. background-color: #f9ccac;
  81. }
  82.  
  83. .color3 {
  84. background-color: #f4a688;
  85. }
  86.  
  87. .color4 {
  88. background-color: #e0876a;
  89. }
  90.  
  91. .color5 {
  92. background-color: #d9ad7c;
  93. }
  94.  
  95. .color6 {
  96. background-color: #a2836e;
  97. }
  98.  
  99. .color7 {
  100. background-color: #674d3c;
  101. }
  102. </style>
  103. </head>
  104. <body>
  105. <h1>Welcome to My Color Picker!</h1>
  106. <br>
  107. <h2>Change the background color:</h2>
  108. <div id="color-picker">
  109. <button class="red" onclick="setColor('red');"></button>
  110. <button class="orange" onclick="setColor('orange');"></button>
  111. <button class="yellow" onclick="setColor('yellow');"></button>
  112. <button class="green" onclick="setColor('green');"></button>
  113. <button class="blue" onclick="setColor('blue');"></button>
  114. <button class="indigo" onclick="setColor('indigo');"></button>
  115. <button class="violet" onclick="setColor('violet');"></button>
  116. </div>
  117. <br>
  118. <h3>Change the text color:</h3>
  119. <div id="text-color">
  120. <button class="text-aqua" onclick="setTextColor('aqua');"></button>
  121. <button class="text-chartreuse" onclick="setTextColor('chartreuse');"></button>
  122. <button class="text-coral" onclick="setTextColor('coral');"></button>
  123. <button class="text-darkmagenta" onclick="setTextColor('darkmagenta');"></button>
  124. <button class="text-yellowgreen" onclick="setTextColor('yellowgreen');"></button>
  125. <button class="text-plum" onclick="setTextColor('plum');"></button>
  126. <button class="text-tomato" onclick="setTextColor('tomato');"></button>
  127. </div>
  128. <h4>Harmonious Palette</h4>
  129. <div id="new-color-picker">
  130. <button class="color1" onclick="setColor('#fbefcc');"></button>
  131. <button class="color2" onclick="setColor('#f9ccac');"></button>
  132. <button class="color3" onclick="setColor('#f4a688');"></button>
  133. <button class="color4" onclick="setColor('#e0876a');"></button>
  134. <button class="color5" onclick="setColor('#d9ad7c');"></button>
  135. <button class="color6" onclick="setColor('#a2836e');"></button>
  136. <button class="color7" onclick="setColor('#674d3c');"></button>
  137. </div>
  138. <script id="jsbin-javascript">
  139. function setColor(bgcolor){
  140. var body = document.querySelector("body");
  141. body.style.background = bgcolor;
  142. }
  143.  
  144. function setTextColor(textcolor){
  145. var text = document.querySelector("body");
  146. text.style.color = textcolor;
  147. }
  148. </script>
  149.  
  150.  
  151. <script id="jsbin-source-css" type="text/css">h1, h2, h3, h4 {
  152. font-family: Monospace;
  153. }
  154.  
  155. button {
  156. min-width: 3em;
  157. min-height: 3em;
  158. border-radius: 1.5em;
  159. }
  160.  
  161. .red {
  162. background-color: red;
  163. }
  164.  
  165. .orange {
  166. background-color: orange;
  167. }
  168.  
  169. .yellow {
  170. background-color: yellow;
  171. }
  172.  
  173. .green {
  174. background-color: green;
  175. }
  176.  
  177. .blue {
  178. background-color: blue;
  179. }
  180.  
  181. .indigo {
  182. background-color: indigo;
  183. }
  184.  
  185. .violet {
  186. background-color: violet;
  187. }
  188.  
  189. .text-aqua {
  190. background-color: aqua;
  191. }
  192.  
  193. .text-chartreuse {
  194. background-color: chartreuse;
  195. }
  196.  
  197. .text-coral {
  198. background-color: coral;
  199. }
  200.  
  201. .text-darkmagenta {
  202. background-color: darkmagenta;
  203. }
  204.  
  205. .text-yellowgreen {
  206. background-color: yellowgreen;
  207. }
  208.  
  209. .text-plum {
  210. background-color: plum;
  211. }
  212.  
  213. .text-tomato {
  214. background-color: tomato;
  215. }
  216.  
  217. .color1 {
  218. background-color: #fbefcc;
  219. }
  220.  
  221. .color2 {
  222. background-color: #f9ccac;
  223. }
  224.  
  225. .color3 {
  226. background-color: #f4a688;
  227. }
  228.  
  229. .color4 {
  230. background-color: #e0876a;
  231. }
  232.  
  233. .color5 {
  234. background-color: #d9ad7c;
  235. }
  236.  
  237. .color6 {
  238. background-color: #a2836e;
  239. }
  240.  
  241. .color7 {
  242. background-color: #674d3c;
  243. }</script>
  244.  
  245. <script id="jsbin-source-javascript" type="text/javascript">function setColor(bgcolor){
  246. var body = document.querySelector("body");
  247. body.style.background = bgcolor;
  248. }
  249.  
  250. function setTextColor(textcolor){
  251. var text = document.querySelector("body");
  252. text.style.color = textcolor;
  253. }
  254.  
  255. </script></body>
  256.  
  257. <script type="text/javascript" src="script.js"></script>
  258. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement