index.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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" 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. </div>
  116. <div>
  117. <label>
  118. <div>Results:&nbsp;<output name="resultsToDisplayOutput">10</output></div>
  119. <input
  120. name="resultsToDisplay"
  121. type="range"
  122. min="1"
  123. max="100"
  124. value="10"
  125. oninput="
  126. event.target.form.elements.resultsToDisplayOutput.value = event.target.value
  127. "
  128. onchange="showResults(event.target.value)"
  129. />
  130. </label>
  131. </div>
  132. <fieldset onchange="updateSort()">
  133. <legend>Color Space</legend>
  134. <div>
  135. <label>
  136. <input type="radio" name="colorSpace" value="jab" checked />
  137. CIECAM
  138. </label>
  139. </div>
  140. <div>
  141. <label>
  142. <input type="radio" name="colorSpace" value="rgb" />
  143. sRGB
  144. </label>
  145. </div>
  146. </fieldset>
  147. <fieldset name="metric" onchange="onMetricChange(event.target.form.elements)">
  148. <legend>Distance Metric</legend>
  149. <!-- template mount point -->
  150. </fieldset>
  151. <fieldset name="rescaleSection" onchange="updateSort()">
  152. <legend>Scaled By</legend>
  153. <!-- template mount point -->
  154. </fieldset>
  155. <fieldset
  156. onchange="
  157. const elements = event.target.form.elements;
  158. document.forms.clusterControl.hidden = elements.useClusters.value === 'off';
  159. onMetricChange(elements);
  160. "
  161. >
  162. <legend>Compare With</legend>
  163. <div>
  164. <label>
  165. <input type="radio" name="useClusters" value="off" />
  166. Whole Image
  167. </label>
  168. </div>
  169. <div>
  170. <label>
  171. <input type="radio" name="useClusters" value="on" />
  172. Best Cluster
  173. </label>
  174. </div>
  175. <div>
  176. <label>
  177. <input type="radio" name="useClusters" value="mult" checked />
  178. Best Cluster Times Whole
  179. </label>
  180. </div>
  181. </fieldset>
  182. </form>
  183. <form action="javascript:void(0);" id="clusterControl" autocomplete="off">
  184. <div>Cluster Ranking</div>
  185. <fieldset name="metric" onchange="onMetricChange(event.target.form.elements)">
  186. <legend>Distance Metric</legend>
  187. <!-- template mount point -->
  188. </fieldset>
  189. <fieldset name="rescaleSection" onchange="updateSort()">
  190. <legend>Scaled By</legend>
  191. <!-- template mount point -->
  192. </fieldset>
  193. </form>
  194. </body>
  195. </html>