index.html 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <!DOCTYPE HTML>
  2. <html lang="zh-CN">
  3. <head>
  4. <title>颜色转换工具</title>
  5. <meta charset="UTF-8">
  6. <link rel="shortcut icon" href="../static/img/favicon.ico">
  7. <!-- Remove Color Picker CSS -->
  8. <!-- <link rel="stylesheet" href="../static/vendor/a-color-picker/acolorpicker.min.css"> -->
  9. <link rel="stylesheet" href="index.css" />
  10. <script type="text/javascript" src="../static/vendor/evalCore.min.js"></script>
  11. <script type="text/javascript" src="../static/vendor/vue/vue.js"></script>
  12. </head>
  13. <body>
  14. <div class="wrapper" id="pageContainer">
  15. <div class="panel panel-default" style="margin-bottom: 0px;">
  16. <div class="panel-heading">
  17. <h3 class="panel-title">
  18. <a href="https://www.baidufe.com/fehelper/index/index.html" target="_blank" class="x-a-high">
  19. <img src="../static/img/fe-16.png" alt="fehelper"/> FeHelper</a>:颜色转换工具
  20. <a href="#" class="x-donate-link" @click="openDonateModal($event)"><i class="nav-icon">❤&nbsp;</i>打赏鼓励</a>
  21. <a class="x-other-tools" @click="openOptionsPage($event)"><i class="icon-plus-circle"></i> 探索更多实用工具 <span class="tool-market-badge">工具市场</span></a>
  22. </h3>
  23. </div>
  24. </div>
  25. <div class="panel-body"> <!-- Remove main-content-area -->
  26. <!-- Remove colorPickerContainer -->
  27. <div class="row x-tips ui-mt-10">
  28. // 支持颜色值的RGB/RGBA、HEX、HSL/HSLA、HSV/HSVA互转。
  29. </div>
  30. <!-- Move Alpha Slider Row to the top -->
  31. <div class="row ui-mt-20 alpha-slider-row global-alpha-slider">
  32. <label for="alphaSlider">全局透明度 (Alpha):</label>
  33. <input type="range" id="alphaSlider" class="alpha-slider" min="0" max="100" step="1" v-model.number="alphaPercent" @input="updateAlphaFromSlider">
  34. <span class="alpha-value">{{ (alphaPercent / 100).toFixed(2).replace(/\.0+$/,'') }}</span>
  35. </div>
  36. <!-- Reintroduce modules grid -->
  37. <div class="modules-grid ui-mt-20">
  38. <!-- HEX Module -->
  39. <div class="color-module module-hex">
  40. <h4>HEX 输入</h4>
  41. <div class="input-group primary-input">
  42. <label for="fromHEX">HEX</label>
  43. <input type="text" class="form-control col-input" id="fromHEX" placeholder="如: #F2C68580"
  44. maxlength="9" v-model="fromHEX" @input="updateFromHEX">
  45. <label>预览</label><div class="demo-color" :style="{background: safeBgColor(fromHEX)}">&nbsp;</div>
  46. </div>
  47. <h5>输出:</h5>
  48. <div class="output-group">
  49. <label>RGB</label>
  50. <input type="text" class="form-control col-output" readonly :value="toRGB">
  51. <button class="btn-copy" title="复制" @click="copyToClipboard(toRGB)"> C </button>
  52. </div>
  53. <div class="output-group">
  54. <label>HSL</label>
  55. <input type="text" class="form-control col-output" readonly :value="toHSL">
  56. <button class="btn-copy" title="复制" @click="copyToClipboard(toHSL)"> C </button>
  57. </div>
  58. <div class="output-group">
  59. <label>HSV</label>
  60. <input type="text" class="form-control col-output" readonly :value="toHSV">
  61. <button class="btn-copy" title="复制" @click="copyToClipboard(toHSV)"> C </button>
  62. </div>
  63. </div>
  64. <!-- RGB Module -->
  65. <div class="color-module module-rgb">
  66. <h4>RGB 输入</h4>
  67. <div class="input-group primary-input">
  68. <label for="fromRGB">RGB</label>
  69. <input type="text" class="form-control col-input" id="fromRGB" placeholder="如: rgba(67,173,127,0.5)"
  70. maxlength="35" v-model="fromRGB" @input="updateFromRGB">
  71. <label>预览</label><div class="demo-color" :style="{background: safeBgColor(fromRGB)}">&nbsp;</div>
  72. </div>
  73. <h5>输出:</h5>
  74. <div class="output-group">
  75. <label>HEX</label>
  76. <input type="text" class="form-control col-output" readonly :value="toHEX">
  77. <button class="btn-copy" title="复制" @click="copyToClipboard(toHEX)"> C </button>
  78. </div>
  79. <div class="output-group">
  80. <label>HSL</label>
  81. <input type="text" class="form-control col-output" readonly :value="toHSL">
  82. <button class="btn-copy" title="复制" @click="copyToClipboard(toHSL)"> C </button>
  83. </div>
  84. <div class="output-group">
  85. <label>HSV</label>
  86. <input type="text" class="form-control col-output" readonly :value="toHSV">
  87. <button class="btn-copy" title="复制" @click="copyToClipboard(toHSV)"> C </button>
  88. </div>
  89. </div>
  90. <!-- HSL Module -->
  91. <div class="color-module module-hsl">
  92. <h4>HSL 输入</h4>
  93. <div class="input-group primary-input">
  94. <label for="fromHSL">HSL</label>
  95. <input type="text" class="form-control col-input" id="fromHSL" placeholder="如: hsla(154, 44%, 47%, 0.5)"
  96. maxlength="45" v-model="fromHSL" @input="updateFromHSL">
  97. <label>预览</label><div class="demo-color" :style="{background: safeBgColor(fromHSL)}">&nbsp;</div>
  98. </div>
  99. <h5>输出:</h5>
  100. <div class="output-group">
  101. <label>HEX</label>
  102. <input type="text" class="form-control col-output" readonly :value="toHEX">
  103. <button class="btn-copy" title="复制" @click="copyToClipboard(toHEX)"> C </button>
  104. </div>
  105. <div class="output-group">
  106. <label>RGB</label>
  107. <input type="text" class="form-control col-output" readonly :value="toRGB">
  108. <button class="btn-copy" title="复制" @click="copyToClipboard(toRGB)"> C </button>
  109. </div>
  110. <div class="output-group">
  111. <label>HSV</label>
  112. <input type="text" class="form-control col-output" readonly :value="toHSV">
  113. <button class="btn-copy" title="复制" @click="copyToClipboard(toHSV)"> C </button>
  114. </div>
  115. </div>
  116. <!-- HSV Module -->
  117. <div class="color-module module-hsv">
  118. <h4>HSV 输入</h4>
  119. <div class="input-group primary-input">
  120. <label for="fromHSV">HSV</label>
  121. <input type="text" class="form-control col-input" id="fromHSV" placeholder="如: hsva(154, 61%, 68%, 0.5)"
  122. maxlength="45" v-model="fromHSV" @input="updateFromHSV">
  123. <label>预览</label><div class="demo-color" :style="{background: safeBgColor(fromHSV)}">&nbsp;</div>
  124. </div>
  125. <h5>输出:</h5>
  126. <div class="output-group">
  127. <label>HEX</label>
  128. <input type="text" class="form-control col-output" readonly :value="toHEX">
  129. <button class="btn-copy" title="复制" @click="copyToClipboard(toHEX)"> C </button>
  130. </div>
  131. <div class="output-group">
  132. <label>RGB</label>
  133. <input type="text" class="form-control col-output" readonly :value="toRGB">
  134. <button class="btn-copy" title="复制" @click="copyToClipboard(toRGB)"> C </button>
  135. </div>
  136. <div class="output-group">
  137. <label>HSL</label>
  138. <input type="text" class="form-control col-output" readonly :value="toHSL">
  139. <button class="btn-copy" title="复制" @click="copyToClipboard(toHSL)"> C </button>
  140. </div>
  141. </div>
  142. </div> <!-- Close .modules-grid -->
  143. <!-- Remove Alpha slider from here -->
  144. <!--
  145. <div class="row ui-mt-20 alpha-slider-row">
  146. <label for="alphaSlider">透明度 (Alpha):</label>
  147. <input type="range" id="alphaSlider" class="alpha-slider" min="0" max="100" step="1" v-model.number="alphaPercent" @input="updateAlphaFromSlider">
  148. <span class="alpha-value">{{ (alphaPercent / 100).toFixed(2).replace(/\.0+$/,'') }}</span>
  149. </div>
  150. -->
  151. </div>
  152. </div>
  153. <script src="../static/vendor/jquery/jquery-3.3.1.min.js"></script>
  154. <!-- Remove Color Picker JS -->
  155. <!-- <script src="../static/vendor/a-color-picker/acolorpicker.js"></script> -->
  156. <script type="text/javascript" src="index.js"></script>
  157. </body>
  158. </html>