index.html 6.3 KB

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