nearest.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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="nearest.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="https://unpkg.com/fuse.js@6.5.3/dist/fuse.min.js"></script>
  10. <script src="https://unpkg.com/texzilla@1.0.2/TeXZilla.js"></script>
  11. <script src="database.js"></script>
  12. <script src="nearest.js"></script>
  13. <script lang="javascript">window.onload = () => { onPageLoad(); }</script>
  14. </head>
  15. <body>
  16. <noscript>Requires javascript</noscript>
  17. <div class="container start-justified">
  18. <div id="left-panel" class="padded panel">
  19. <form class="panel config" onsubmit="event.preventDefault()">
  20. <div class="container control">
  21. <img src="https://img.pokemondb.net/sprites/sword-shield/icon/bulbasaur.png" />
  22. <button class="padded" type="button" onclick="onRandomColor()">Random color</button>
  23. <input size="7" maxlength="7" id="color-input" oninput="onColorChanged()" />
  24. </div>
  25. <div class="container control">
  26. <label for="metric">Metric:</label>
  27. <select type="checkbox" onchange="onMetricChanged()" id="metric">
  28. <option selected>RMS/Std Dev</option>
  29. <option>Mean Angle</option>
  30. <option>Chroma/Hue Angle</option>
  31. <option>Custom</option>
  32. </select>
  33. </div>
  34. <div class="hideable_control hideable_control--hidden">
  35. <label for="include-x">Include X:</label>
  36. <input type="checkbox" checked oninput="onCustomControlsChanged()" id="include-x">
  37. </div>
  38. <div class="hideable_control hideable_control--hidden">
  39. <label for="norm-q-y">Normalize q and Y:</label>
  40. <input type="checkbox" oninput="onCustomControlsChanged()" id="norm-q-y">
  41. </div>
  42. <div class="hideable_control hideable_control--hidden">
  43. <label for="close-coeff">Closeness coefficient: <span id="close-coeff-display">2</span></label>
  44. <input type="range" min="0" max="10" value="2" step="0.1" oninput="onCustomControlsChanged()" id="close-coeff">
  45. </div>
  46. <div class="container control">
  47. <label for="num-poke" style="min-width: 200px;">
  48. Search limit: <span id="num-poke-display">10</span>
  49. </label>
  50. <input type="range" min="1" max="100" value="10" oninput="onLimitChanged()" id="num-poke">
  51. </div>
  52. </form>
  53. <div class="panel math-section">
  54. <div class="container center-aligned">
  55. <div class="panel">
  56. <div>
  57. <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>X</mi><mrow><mo>(</mo><mi>P</mi><mo>)</mo></mrow><mo>=</mo><mfrac><mn>1</mn><mrow><mo>|</mo><mi>P</mi><mo>|</mo></mrow></mfrac><munder><mo>∑</mo><mrow><mi>p</mi><mo>∊</mo><mi>P</mi></mrow></munder><msup><mrow><mo>|</mo><mrow><mo>|</mo><mover><mi>p</mi><mo stretchy="false">⇀</mo></mover><mo>|</mo></mrow><mo>|</mo></mrow><mn>2</mn></msup></mrow><annotation encoding="TeX">X\\left(P\\right) = \\frac{1}{\\left|P\\right|}\\sum_{p\\inP}{\\left|\\left|\\vec{p}\\right|\\right|^2}</annotation></semantics></math>
  58. </div>
  59. <div>
  60. <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mover><mi>Y</mi><mo stretchy="false">⇀</mo></mover><mrow><mo>(</mo><mi>P</mi><mo>)</mo></mrow><mo>=</mo><mfrac><mn>1</mn><mrow><mo>|</mo><mi>P</mi><mo>|</mo></mrow></mfrac><munder><mo>∑</mo><mrow><mi>p</mi><mo>∊</mo><mi>P</mi></mrow></munder><mover><mi>p</mi><mo stretchy="false">⇀</mo></mover></mrow><annotation encoding="TeX">Y\\left(P\\right) = \\frac{1}{\\left|P\\right|}\\sum_{p\\inP}{\\vec{p}}</annotation></semantics></math>
  61. </div>
  62. </div>
  63. <div class="panel qvecs">
  64. <div id="q-vec-jab"></div>
  65. <div id="q-vec-rgb"></div>
  66. </div>
  67. </div>
  68. <div class="container center-aligned center-justified">
  69. <span style="margin-right: 0.5em;">Optimizing:</span>
  70. <span id="obj-fn"></span>
  71. </div>
  72. <div class="container center-aligned center-justified">
  73. <span style="margin-right: 0.5em;">Displaying:</span>
  74. <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo>(</mo><mrow><msub><mtext>RMS</mtext><mi>P</mi></msub><mrow><mo>(</mo><mi>q</mi><mo>)</mo></mrow><mo>,</mo><mo>∠</mo><mrow><mo>(</mo><mrow><mover><mi>q</mi><mo stretchy="false">⇀</mo></mover><mo>,</mo><mover><mi>Y</mi><mo stretchy="false">⇀</mo></mover><mrow><mo>(</mo><mi>P</mi><mo>)</mo></mrow></mrow><mo>)</mo></mrow><mo>,</mo><mo>∠</mo><mrow><mo>(</mo><mrow><msub><mover><mi>q</mi><mo stretchy="false">⇀</mo></mover><mo>⊥</mo></msub><mo>,</mo><mover><mi>Y</mi><mo stretchy="false">⇀</mo></mover><msub><mrow><mo>(</mo><mi>P</mi><mo>)</mo></mrow><mo>⊥</mo></msub></mrow><mo>)</mo></mrow></mrow><mo>)</mo></mrow><annotation encoding="TeX">\\left( \\text{RMS}_P\\left(q\\right), \\angle \\left(\\vec{q}, \\vec{Y}\\left(P\\right)\\right), \\angle \\left( \\vec{q}_{\\perp} , \\vec{Y}\\left(P\\right)_{\\perp} \\right) \\right)</annotation></semantics></math>
  75. </div>
  76. </div>
  77. <div class="panel bypkmn">
  78. <form class="container control" onsubmit="event.preventDefault(); onSearchChanged()">
  79. <label for="pokemon-name">Search By Pokemon</label>
  80. <input id="pokemon-name" size="15" oninput="onSearchChanged()">
  81. </form>
  82. <ul id="search-list" class="pkmn-list"></ul>
  83. </div>
  84. </div>
  85. <div class="padded panel">
  86. <div class="title">CIECAM02 Uniform Color Space (Jab)</div>
  87. <ul id="best-list-jab" class="pkmn-list"></ul>
  88. </div>
  89. <div class="padded panel">
  90. <div class="title">sRGB Color Space</div>
  91. <ul id="best-list-rgb" class="pkmn-list"></ul>
  92. </div>
  93. </div>
  94. </body>
  95. </html>