testcase.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <title>Spectrum - The No Hassle jQuery Colorpicker</title>
  6. <meta name="description" content="Spectrum is a JavaScript colorpicker plugin using the jQuery framework. It is highly customizable, but can also be used as a simple input type=color polyfill">
  7. <meta name="author" content="Brian Grinstead and Spectrum contributors">
  8. <link rel="stylesheet" type="text/css" href="../spectrum.css">
  9. <link rel="stylesheet" type="text/css" href="../docs/bootstrap.css">
  10. <link rel="stylesheet" type="text/css" href="../docs/docs.css">
  11. <script type="text/javascript" src="../docs/jquery-1.9.1.js"></script>
  12. <script type="text/javascript" src="../spectrum.js"></script>
  13. </head>
  14. <body>
  15. <div id='header'>
  16. <h1><a href='http://bgrins.github.com/spectrum'>Spectrum</a></h1> <h2><em>The No Hassle jQuery Colorpicker</em></h2>
  17. <div id='links'>
  18. View the <a href='http://github.com/bgrins/spectrum'>Source code</a>.
  19. Spectrum is a project by <a href='http://twitter.com/bgrins'>@bgrins</a>.
  20. </div>
  21. <br style='clear:both;' />
  22. </div>
  23. <div class="container">
  24. <h2>Basic Test Case</h2>
  25. <p>Also available as a <a href="http://jsfiddle.net/bgrins/ctkY3/">jsfiddle</a></p>
  26. <button id="update">Update palette</button>
  27. <h2>Full Example</h2>
  28. <input type='text' id="full"/>
  29. </div>
  30. <script type="text/javascript">
  31. $("#update").click (function() {
  32. console.log($("#full").spectrum("option", "palette"));
  33. $("#full").spectrum("option", "palette", [
  34. ["red", "green", "blue"]
  35. ]);
  36. });
  37. $("#full").spectrum({
  38. color: "#ECC",
  39. flat: true,
  40. showInput: true,
  41. className: "full-spectrum",
  42. showInitial: true,
  43. showPalette: true,
  44. showSelectionPalette: true,
  45. maxPaletteSize: 10,
  46. preferredFormat: "hex",
  47. localStorageKey: "spectrum.demo",
  48. move: function (color) {
  49. },
  50. show: function () {
  51. },
  52. beforeShow: function () {
  53. },
  54. hide: function () {
  55. },
  56. change: function() {
  57. },
  58. palette: [
  59. ["rgb(0, 0, 0)", "rgb(67, 67, 67)", "rgb(102, 102, 102)",
  60. "rgb(204, 204, 204)", "rgb(217, 217, 217)","rgb(255, 255, 255)"],
  61. ["rgb(152, 0, 0)", "rgb(255, 0, 0)", "rgb(255, 153, 0)", "rgb(255, 255, 0)", "rgb(0, 255, 0)",
  62. "rgb(0, 255, 255)", "rgb(74, 134, 232)", "rgb(0, 0, 255)", "rgb(153, 0, 255)", "rgb(255, 0, 255)"],
  63. ["rgb(230, 184, 175)", "rgb(244, 204, 204)", "rgb(252, 229, 205)", "rgb(255, 242, 204)", "rgb(217, 234, 211)",
  64. "rgb(208, 224, 227)", "rgb(201, 218, 248)", "rgb(207, 226, 243)", "rgb(217, 210, 233)", "rgb(234, 209, 220)",
  65. "rgb(221, 126, 107)", "rgb(234, 153, 153)", "rgb(249, 203, 156)", "rgb(255, 229, 153)", "rgb(182, 215, 168)",
  66. "rgb(162, 196, 201)", "rgb(164, 194, 244)", "rgb(159, 197, 232)", "rgb(180, 167, 214)", "rgb(213, 166, 189)",
  67. "rgb(204, 65, 37)", "rgb(224, 102, 102)", "rgb(246, 178, 107)", "rgb(255, 217, 102)", "rgb(147, 196, 125)",
  68. "rgb(118, 165, 175)", "rgb(109, 158, 235)", "rgb(111, 168, 220)", "rgb(142, 124, 195)", "rgb(194, 123, 160)",
  69. "rgb(166, 28, 0)", "rgb(204, 0, 0)", "rgb(230, 145, 56)", "rgb(241, 194, 50)", "rgb(106, 168, 79)",
  70. "rgb(69, 129, 142)", "rgb(60, 120, 216)", "rgb(61, 133, 198)", "rgb(103, 78, 167)", "rgb(166, 77, 121)",
  71. "rgb(91, 15, 0)", "rgb(102, 0, 0)", "rgb(120, 63, 4)", "rgb(127, 96, 0)", "rgb(39, 78, 19)",
  72. "rgb(12, 52, 61)", "rgb(28, 69, 135)", "rgb(7, 55, 99)", "rgb(32, 18, 77)", "rgb(76, 17, 48)"]
  73. ]
  74. });
  75. </script>
  76. </body>
  77. </html>