index.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Pokemon By Color</title>
  6. <link rel="stylesheet" href="styles.css" />
  7. <script src="https://unpkg.com/d3-color@3.0.1/dist/d3-color.min.js"></script>
  8. <script src="https://unpkg.com/d3-cam02@0.1.5/build/d3-cam02.min.js"></script>
  9. <script src="database-v3.js"></script>
  10. <script src="math.js"></script>
  11. <script src="form.js"></script>
  12. </head>
  13. <body>
  14. <noscript>Requires javascript</noscript>
  15. <template id="metric-form-template">
  16. <div>
  17. <label>
  18. <input type="checkbox" name="sortOrder" role="button" hidden />
  19. <output name="sortOrderLabel"></output>
  20. (click to toggle)
  21. </label>
  22. </div>
  23. <div>
  24. <label>
  25. <input type="radio" name="metricKind" value="whole" />
  26. Set Comparison
  27. </label>
  28. </div>
  29. <div>
  30. <label>
  31. <input type="radio" name="metricKind" value="mean" />
  32. Mean Comparison
  33. </label>
  34. </div>
  35. <div>
  36. <label>
  37. <input type="radio" name="metricKind" value="statistic" />
  38. Set Statistics
  39. </label>
  40. </div>
  41. <select name="whole" disabled>
  42. <option value="sigma">RMS Deviation (σ)</option>
  43. <option value="bigTheta">Cosine Difference (Θ)</option>
  44. <option value="alpha">Geometric Difference (α)</option>
  45. </select>
  46. <select name="mean" disabled>
  47. <option value="theta">Angular Difference (θ)</option>
  48. <option value="phi">Hue Azimuth (ϕ)</option>
  49. <option value="delta">Euclidean (δ)</option>
  50. <option value="manhattan">Manhattan (M)</option>
  51. <option value="ch">Chebyshev (Ч)</option>
  52. <option value="lightnessDiff">Lightness (ℓ)</option>
  53. </select>
  54. <select name="statistic" disabled>
  55. <option value="inertia">Inertia (I)</option>
  56. <option value="variance">Variance (V)</option>
  57. <option value="muNuAngle">Mu-Nu Angle (Φ)</option>
  58. <option value="size">Size (N)</option>
  59. <option value="lightness">Mean Lightness (L)</option>
  60. <option value="chroma">Mean Chroma (C)</option>
  61. <option value="importance">Visual Importance (β)</option>
  62. </select>
  63. <output name="sortMetric" hidden aria-hidden="true"></output>
  64. </template>
  65. <template id="scale-form-template">
  66. <div>
  67. <label>
  68. <input type="radio" name="rescaleFactor" value="none" />
  69. None
  70. </label>
  71. </div>
  72. <div>
  73. <label>
  74. <input type="radio" name="rescaleFactor" value="direct" />
  75. Cluster Size
  76. </label>
  77. </div>
  78. <div>
  79. <label>
  80. <input type="radio" name="rescaleFactor" value="inverse" />
  81. Inverse Cluster Size
  82. </label>
  83. </div>
  84. <div>
  85. <label>
  86. <input type="radio" name="rescaleFactor" value="size" />
  87. Image Size
  88. </label>
  89. </div>
  90. <div>
  91. <label>
  92. <input type="radio" name="rescaleFactor" value="inverseSize" />
  93. Inverse Image Size
  94. </label>
  95. </div>
  96. </template>
  97. <div>
  98. <img
  99. src="https://img.pokemondb.net/sprites/sword-shield/icon/breloom.png"
  100. alt="breloom"
  101. />
  102. <div>Breloom</div>
  103. <div></div>
  104. <div></div>
  105. </div>
  106. <form action="javascript:void(0);" id="sortControl" autocomplete="off">
  107. <div>
  108. <label>
  109. <div>Target Color</div>
  110. <input
  111. name="colorText"
  112. type="text"
  113. maxlength="7"
  114. oninput="onColorChange(event.target.value)"
  115. />
  116. </label>
  117. <input
  118. name="colorPicker"
  119. type="color"
  120. onchange="onColorChange(event.target.value)"
  121. />
  122. <button type="button" onclick="onColorChange(randomColor())">Random Color</button>
  123. </div>
  124. <div>
  125. <label>
  126. <div>Results:&nbsp;<output name="resultsToDisplayOutput">10</output></div>
  127. <input
  128. name="resultsToDisplay"
  129. type="range"
  130. min="1"
  131. max="100"
  132. value="10"
  133. oninput="
  134. event.target.form.elements.resultsToDisplayOutput.value = event.target.value
  135. "
  136. onchange="showResults()"
  137. />
  138. </label>
  139. </div>
  140. <fieldset onchange="updateSort()">
  141. <legend>Color Space</legend>
  142. <div>
  143. <label>
  144. <input type="radio" name="colorSpace" value="jab" checked />
  145. CIECAM
  146. </label>
  147. </div>
  148. <div>
  149. <label>
  150. <input type="radio" name="colorSpace" value="rgb" />
  151. sRGB
  152. </label>
  153. </div>
  154. </fieldset>
  155. <fieldset name="metric" onchange="onMetricChange(event.target.form.elements)">
  156. <legend>Distance Metric</legend>
  157. <!-- template mount point -->
  158. </fieldset>
  159. <fieldset name="rescaleSection" onchange="updateSort()">
  160. <legend>Scaled By</legend>
  161. <!-- template mount point -->
  162. </fieldset>
  163. <fieldset
  164. onchange="
  165. const elements = event.target.form.elements;
  166. document.forms.sortControl.elements.rescaleSection.hidden = elements.useClusters.value === 'off';
  167. document.forms.clusterControl.hidden = elements.useClusters.value === 'off';
  168. onMetricChange(elements);
  169. "
  170. >
  171. <legend>Compare With</legend>
  172. <div>
  173. <label>
  174. <input type="radio" name="useClusters" value="off" />
  175. Whole Image
  176. </label>
  177. </div>
  178. <div>
  179. <label>
  180. <input type="radio" name="useClusters" value="on" />
  181. Best Cluster
  182. </label>
  183. </div>
  184. <div>
  185. <label>
  186. <input type="radio" name="useClusters" value="mult" checked />
  187. Best Cluster Times Whole
  188. </label>
  189. </div>
  190. </fieldset>
  191. </form>
  192. <form action="javascript:void(0);" id="clusterControl" autocomplete="off">
  193. <div>Cluster Ranking</div>
  194. <fieldset name="metric" onchange="onMetricChange(event.target.form.elements)">
  195. <legend>Distance Metric</legend>
  196. <!-- template mount point -->
  197. </fieldset>
  198. <fieldset name="rescaleSection" onchange="updateSort()">
  199. <legend>Scaled By</legend>
  200. <!-- template mount point -->
  201. </fieldset>
  202. </form>
  203. <div>
  204. <div>Previous Colors</div>
  205. <div id="prev-colors"></div>
  206. </div>
  207. </body>
  208. </html>