ace-colorpicker-rpk 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/.babelrc +30 -0
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +35 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
  4. package/ChangeLogs.md +22 -0
  5. package/LICENSE +21 -0
  6. package/README.md +117 -0
  7. package/addon/ace-colorpicker.css +1074 -0
  8. package/addon/ace-colorpicker.js +9602 -0
  9. package/addon/sample/colorpicker.html +199 -0
  10. package/config/rollup.config.dev.js +52 -0
  11. package/config/rollup.config.prod.js +53 -0
  12. package/dist/ace-colorpicker.css +1074 -0
  13. package/dist/ace-colorpicker.js +9736 -0
  14. package/dist/ace-colorpicker.min.js +1 -0
  15. package/gl.html +56 -0
  16. package/index.html +172 -0
  17. package/package.json +87 -0
  18. package/resources/image/ace-editor.png +0 -0
  19. package/resources/image/colorpaletts.png +0 -0
  20. package/resources/image/colorpicker.png +0 -0
  21. package/resources/image/grapes.jpg +0 -0
  22. package/resources/image/palette-type.png +0 -0
  23. package/resources/image/scalecolors-title.png +0 -0
  24. package/resources/image/scalecolors.png +0 -0
  25. package/resources/image/screen-shot.png +0 -0
  26. package/resources/image/sketch-type.png +0 -0
  27. package/src/colorpicker/BaseBox.js +94 -0
  28. package/src/colorpicker/BaseColorPicker.js +404 -0
  29. package/src/colorpicker/BaseModule.js +19 -0
  30. package/src/colorpicker/BaseSlider.js +97 -0
  31. package/src/colorpicker/BaseStore.js +71 -0
  32. package/src/colorpicker/UIElement.js +46 -0
  33. package/src/colorpicker/VerticalSlider.js +57 -0
  34. package/src/colorpicker/chromedevtool/ColorControl.js +47 -0
  35. package/src/colorpicker/chromedevtool/index.js +36 -0
  36. package/src/colorpicker/index.js +37 -0
  37. package/src/colorpicker/macos/ColorControl.js +47 -0
  38. package/src/colorpicker/macos/index.js +38 -0
  39. package/src/colorpicker/mini/ColorControl.js +40 -0
  40. package/src/colorpicker/mini/index.js +24 -0
  41. package/src/colorpicker/mini-vertical/ColorControl.js +35 -0
  42. package/src/colorpicker/mini-vertical/index.js +23 -0
  43. package/src/colorpicker/module/ColorManager.js +111 -0
  44. package/src/colorpicker/module/ColorSetsList.js +132 -0
  45. package/src/colorpicker/ring/ColorControl.js +47 -0
  46. package/src/colorpicker/ring/index.js +42 -0
  47. package/src/colorpicker/ui/ColorInformation.js +216 -0
  48. package/src/colorpicker/ui/ColorPalette.js +130 -0
  49. package/src/colorpicker/ui/ColorRing.js +68 -0
  50. package/src/colorpicker/ui/ColorSetsChooser.js +96 -0
  51. package/src/colorpicker/ui/ColorWheel.js +257 -0
  52. package/src/colorpicker/ui/CurrentColorSets.js +81 -0
  53. package/src/colorpicker/ui/CurrentColorSetsContextMenu.js +63 -0
  54. package/src/colorpicker/ui/control/Hue.js +40 -0
  55. package/src/colorpicker/ui/control/Opacity.js +65 -0
  56. package/src/colorpicker/ui/control/Value.js +50 -0
  57. package/src/colorpicker/ui/control/VerticalHue.js +39 -0
  58. package/src/colorpicker/ui/control/VerticalOpacity.js +55 -0
  59. package/src/colorpicker/vscode/ColorControl.js +40 -0
  60. package/src/colorpicker/vscode/index.js +82 -0
  61. package/src/colorpicker/xd/ColorControl.js +36 -0
  62. package/src/colorpicker/xd/index.js +36 -0
  63. package/src/extension/ace/colorview.js +198 -0
  64. package/src/extension/ace/index.js +11 -0
  65. package/src/index.js +12 -0
  66. package/src/scss/colorpicker.scss +65 -0
  67. package/src/scss/colorview.scss +32 -0
  68. package/src/scss/component/button.scss +33 -0
  69. package/src/scss/component/colorchooser.scss +141 -0
  70. package/src/scss/component/colorsets-contextmenu.scss +33 -0
  71. package/src/scss/component/colorsets.scss +89 -0
  72. package/src/scss/component/control.scss +93 -0
  73. package/src/scss/component/gradient-editor.scss +260 -0
  74. package/src/scss/component/gradient-picker.scss +241 -0
  75. package/src/scss/component/information.scss +141 -0
  76. package/src/scss/component/palette.scss +45 -0
  77. package/src/scss/index.scss +5 -0
  78. package/src/scss/mixins.scss +21 -0
  79. package/src/scss/themes/macos.scss +71 -0
  80. package/src/scss/themes/mini-vertical.scss +94 -0
  81. package/src/scss/themes/mini.scss +76 -0
  82. package/src/scss/themes/palette.scss +85 -0
  83. package/src/scss/themes/ring.scss +57 -0
  84. package/src/scss/themes/sketch.scss +172 -0
  85. package/src/scss/themes/vscode.scss +93 -0
  86. package/src/scss/themes/xd.scss +88 -0
  87. package/src/util/Blender.js +29 -0
  88. package/src/util/Canvas.js +128 -0
  89. package/src/util/Color.js +27 -0
  90. package/src/util/ColorNames.js +14 -0
  91. package/src/util/Dom.js +361 -0
  92. package/src/util/Event.js +30 -0
  93. package/src/util/EventMachin.js +349 -0
  94. package/src/util/GL.js +8 -0
  95. package/src/util/HueColor.js +49 -0
  96. package/src/util/ImageFilter.js +9 -0
  97. package/src/util/ImageLoader.js +137 -0
  98. package/src/util/Kmeans.js +237 -0
  99. package/src/util/Matrix.js +196 -0
  100. package/src/util/State.js +42 -0
  101. package/src/util/blend/composite.js +124 -0
  102. package/src/util/blend/non-separable.js +118 -0
  103. package/src/util/blend/separable.js +76 -0
  104. package/src/util/filter/StackBlur.js +517 -0
  105. package/src/util/filter/functions.js +829 -0
  106. package/src/util/filter/image/crop.js +16 -0
  107. package/src/util/filter/image/flipH.js +23 -0
  108. package/src/util/filter/image/flipV.js +25 -0
  109. package/src/util/filter/image/histogram.js +45 -0
  110. package/src/util/filter/image/index.js +18 -0
  111. package/src/util/filter/image/resize.js +18 -0
  112. package/src/util/filter/image/rotate.js +39 -0
  113. package/src/util/filter/image/rotateDegree.js +53 -0
  114. package/src/util/filter/index.js +11 -0
  115. package/src/util/filter/matrix/blur.js +12 -0
  116. package/src/util/filter/matrix/emboss.js +17 -0
  117. package/src/util/filter/matrix/gaussian-blur-5x.js +17 -0
  118. package/src/util/filter/matrix/gaussian-blur.js +16 -0
  119. package/src/util/filter/matrix/grayscale2.js +16 -0
  120. package/src/util/filter/matrix/index.js +58 -0
  121. package/src/util/filter/matrix/kirsch-horizontal.js +13 -0
  122. package/src/util/filter/matrix/kirsch-vertical.js +13 -0
  123. package/src/util/filter/matrix/laplacian-5x.js +16 -0
  124. package/src/util/filter/matrix/laplacian.js +14 -0
  125. package/src/util/filter/matrix/motion-blur-2.js +18 -0
  126. package/src/util/filter/matrix/motion-blur-3.js +19 -0
  127. package/src/util/filter/matrix/motion-blur.js +18 -0
  128. package/src/util/filter/matrix/negative.js +16 -0
  129. package/src/util/filter/matrix/normal.js +11 -0
  130. package/src/util/filter/matrix/sepia2.js +16 -0
  131. package/src/util/filter/matrix/sharpen.js +14 -0
  132. package/src/util/filter/matrix/sobel-horizontal.js +11 -0
  133. package/src/util/filter/matrix/sobel-vertical.js +11 -0
  134. package/src/util/filter/matrix/stack-blur.js +15 -0
  135. package/src/util/filter/matrix/transparency.js +16 -0
  136. package/src/util/filter/matrix/unsharp-masking.js +16 -0
  137. package/src/util/filter/multi/index.js +9 -0
  138. package/src/util/filter/multi/kirsch.js +7 -0
  139. package/src/util/filter/multi/sobel.js +7 -0
  140. package/src/util/filter/multi/vintage.js +7 -0
  141. package/src/util/filter/pixel/bitonal.js +24 -0
  142. package/src/util/filter/pixel/brightness.js +19 -0
  143. package/src/util/filter/pixel/brownie.js +23 -0
  144. package/src/util/filter/pixel/clip.js +21 -0
  145. package/src/util/filter/pixel/contrast.js +18 -0
  146. package/src/util/filter/pixel/gamma.js +13 -0
  147. package/src/util/filter/pixel/gradient.js +52 -0
  148. package/src/util/filter/pixel/grayscale.js +27 -0
  149. package/src/util/filter/pixel/hue.js +28 -0
  150. package/src/util/filter/pixel/index.js +52 -0
  151. package/src/util/filter/pixel/invert.js +16 -0
  152. package/src/util/filter/pixel/kodachrome.js +23 -0
  153. package/src/util/filter/pixel/matrix.js +28 -0
  154. package/src/util/filter/pixel/noise.js +24 -0
  155. package/src/util/filter/pixel/opacity.js +14 -0
  156. package/src/util/filter/pixel/polaroid.js +23 -0
  157. package/src/util/filter/pixel/saturation.js +30 -0
  158. package/src/util/filter/pixel/sepia.js +28 -0
  159. package/src/util/filter/pixel/shade.js +21 -0
  160. package/src/util/filter/pixel/shift.js +23 -0
  161. package/src/util/filter/pixel/solarize.js +23 -0
  162. package/src/util/filter/pixel/technicolor.js +23 -0
  163. package/src/util/filter/pixel/threshold-color.js +35 -0
  164. package/src/util/filter/pixel/threshold.js +7 -0
  165. package/src/util/filter/pixel/tint.js +20 -0
  166. package/src/util/functions/formatter.js +99 -0
  167. package/src/util/functions/fromCMYK.js +17 -0
  168. package/src/util/functions/fromHSL.js +52 -0
  169. package/src/util/functions/fromHSV.js +64 -0
  170. package/src/util/functions/fromLAB.js +99 -0
  171. package/src/util/functions/fromRGB.js +220 -0
  172. package/src/util/functions/fromYCrCb.js +16 -0
  173. package/src/util/functions/func.js +194 -0
  174. package/src/util/functions/image.js +145 -0
  175. package/src/util/functions/math.js +56 -0
  176. package/src/util/functions/mixin.js +164 -0
  177. package/src/util/functions/parser.js +294 -0
  178. package/src/util/gl/filter/index.js +9 -0
  179. package/src/util/gl/filter/matrix/blur.js +9 -0
  180. package/src/util/gl/filter/matrix/emboss.js +17 -0
  181. package/src/util/gl/filter/matrix/gaussian-blur-5x.js +15 -0
  182. package/src/util/gl/filter/matrix/gaussian-blur.js +19 -0
  183. package/src/util/gl/filter/matrix/grayscale2.js +13 -0
  184. package/src/util/gl/filter/matrix/index.js +55 -0
  185. package/src/util/gl/filter/matrix/kirsch-horizontal.js +11 -0
  186. package/src/util/gl/filter/matrix/kirsch-vertical.js +11 -0
  187. package/src/util/gl/filter/matrix/laplacian-5x.js +13 -0
  188. package/src/util/gl/filter/matrix/laplacian.js +11 -0
  189. package/src/util/gl/filter/matrix/motion-blur-2.js +17 -0
  190. package/src/util/gl/filter/matrix/motion-blur-3.js +17 -0
  191. package/src/util/gl/filter/matrix/motion-blur.js +17 -0
  192. package/src/util/gl/filter/matrix/negative.js +13 -0
  193. package/src/util/gl/filter/matrix/normal.js +8 -0
  194. package/src/util/gl/filter/matrix/sepia2.js +13 -0
  195. package/src/util/gl/filter/matrix/sharpen.js +11 -0
  196. package/src/util/gl/filter/matrix/sobel-horizontal.js +11 -0
  197. package/src/util/gl/filter/matrix/sobel-vertical.js +11 -0
  198. package/src/util/gl/filter/matrix/transparency.js +13 -0
  199. package/src/util/gl/filter/matrix/unsharp-masking.js +14 -0
  200. package/src/util/gl/filter/multi/index.js +9 -0
  201. package/src/util/gl/filter/multi/kirsch.js +7 -0
  202. package/src/util/gl/filter/multi/sobel.js +7 -0
  203. package/src/util/gl/filter/multi/vintage.js +7 -0
  204. package/src/util/gl/filter/pixel/bitonal.js +22 -0
  205. package/src/util/gl/filter/pixel/brightness.js +14 -0
  206. package/src/util/gl/filter/pixel/brownie.js +11 -0
  207. package/src/util/gl/filter/pixel/chaos.js +20 -0
  208. package/src/util/gl/filter/pixel/clip.js +20 -0
  209. package/src/util/gl/filter/pixel/contrast.js +16 -0
  210. package/src/util/gl/filter/pixel/gamma.js +16 -0
  211. package/src/util/gl/filter/pixel/gradient.js +59 -0
  212. package/src/util/gl/filter/pixel/grayscale.js +22 -0
  213. package/src/util/gl/filter/pixel/hue.js +19 -0
  214. package/src/util/gl/filter/pixel/index.js +54 -0
  215. package/src/util/gl/filter/pixel/invert.js +18 -0
  216. package/src/util/gl/filter/pixel/kodachrome.js +11 -0
  217. package/src/util/gl/filter/pixel/matrix.js +29 -0
  218. package/src/util/gl/filter/pixel/noise.js +18 -0
  219. package/src/util/gl/filter/pixel/opacity.js +17 -0
  220. package/src/util/gl/filter/pixel/polaroid.js +11 -0
  221. package/src/util/gl/filter/pixel/saturation.js +20 -0
  222. package/src/util/gl/filter/pixel/sepia.js +19 -0
  223. package/src/util/gl/filter/pixel/shade.js +20 -0
  224. package/src/util/gl/filter/pixel/shift.js +11 -0
  225. package/src/util/gl/filter/pixel/solarize.js +21 -0
  226. package/src/util/gl/filter/pixel/technicolor.js +11 -0
  227. package/src/util/gl/filter/pixel/threshold-color.js +15 -0
  228. package/src/util/gl/filter/pixel/threshold.js +7 -0
  229. package/src/util/gl/filter/pixel/tint.js +25 -0
  230. package/src/util/gl/filter/util.js +185 -0
  231. package/src/util/gl/functions.js +158 -0
  232. package/src/util/gl/index.js +543 -0
  233. package/src/util/index.js +17 -0
  234. package/stand.html +975 -0
  235. package/test/util.Blend.spec.js +15 -0
  236. package/test/util.Color.spec.js +200 -0
  237. package/test/util.Filter.spec.js +12 -0
  238. package/test/util.ImageFilter.spec.js +16 -0
package/stand.html ADDED
@@ -0,0 +1,975 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+
7
+ <link rel="stylesheet"
8
+ href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
9
+ <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
10
+
11
+ <link rel="stylesheet" href="./addon/ace-colorpicker.css" />
12
+ <script type="text/javascript" src="./addon/ace-colorpicker.js" ></script>
13
+ <meta property="og:title" content="ColorPicker for CodeMirror Addon" />
14
+ <meta property="og:description" content="Very Simple ColorPicker for CodeMirror" />
15
+ <meta property="og:url" content="https://easylogic.github.io/ace-colorpicker/" />
16
+ <meta property="og:image" content="https://easylogic.github.com/ace-colorpicker/resources/image/screen-shot.png" />
17
+
18
+ <meta name="twitter:card" content="summary_large_image">
19
+ <meta name="twitter:site" content="https://easylogic.github.io/ace-colorpicker/">
20
+ <meta name="twitter:creator" content="@easylogic">
21
+ <meta name="twitter:title" content="ColorPicker for CodeMirror Addon">
22
+ <meta name="twitter:description" content="Very Simple ColorPicker for CodeMirror">
23
+ <meta name="twitter:image" content="https://easylogic.github.com/ace-colorpicker/resources/image/screen-shot.png">
24
+
25
+ <style type="text/css">
26
+ html, body {
27
+ padding:0px;
28
+ margin:0px;
29
+ }
30
+ h1.title {
31
+ margin-top:0px;
32
+ color: white;
33
+ padding: 50px;
34
+ text-align: center;
35
+ font-size: 50px;
36
+ text-shadow: 1px 1px 1px rgb(255, 255, 255);
37
+ }
38
+
39
+ section {
40
+ background-color: rgb(29, 37, 43);
41
+ min-height: 900px;
42
+
43
+ }
44
+
45
+ section.main {
46
+ min-height: auto;
47
+ }
48
+
49
+ section.colorpicker-style-list {
50
+ background-color: rgb(247, 227, 213)
51
+ }
52
+
53
+ section.colorpicker-style-list > h1 {
54
+ margin-top:0px;
55
+ margin-bottom:0px;
56
+ color: rgb(128, 198, 217);
57
+ padding: 70px;
58
+ text-align: center;
59
+ font-size: 50px;
60
+ text-shadow: 1px 1px 1px rgb(0, 0, 0);
61
+ }
62
+
63
+ section.colorpicker-style-list > div {
64
+ max-width: 800px;
65
+ margin: 0 auto;
66
+ padding-bottom: 100px;
67
+ }
68
+
69
+ section.colorpalette-area {
70
+ background-color: #584592;
71
+ position: relative;
72
+ }
73
+
74
+ section.colorpalette-area .circle.white {
75
+ position: absolute;
76
+ width: 150px;
77
+ height: 150px;
78
+ border-radius: 50%;
79
+ border: 1px solid white;
80
+ left: 10px;
81
+ top: 50px;
82
+ z-index: 0;
83
+ }
84
+
85
+
86
+ section.colorpalette-area:after {
87
+ position: absolute;
88
+ content: "";
89
+ width: 100px;
90
+ height: 100px;
91
+ border-radius: 50%;
92
+ background-color: rgb(246, 107, 107);
93
+ left: 150px;
94
+ bottom: 100px;
95
+ }
96
+
97
+
98
+ section.colorpalette-area > h1 {
99
+ margin-top:0px;
100
+ margin-bottom:0px;
101
+ color: #e2cf32;
102
+ padding: 70px;
103
+ text-align: center;
104
+ font-size: 50px;
105
+ text-shadow: 1px 1px 1px rgb(0, 0, 0);
106
+ }
107
+
108
+ section.colorpalette-area > div:not(.circle) {
109
+ max-width: 920px;
110
+ margin: 0 auto;
111
+ padding-bottom: 100px;
112
+ }
113
+
114
+ section.colorpalette-area .area-item {
115
+ width: 300px;
116
+ box-sizing: border-box;
117
+ border:0px;
118
+ margin:0px;
119
+ display: inline-block;
120
+ height: 400px;
121
+ box-shadow: 0 0 0 0 rgba(213, 235, 255, 0.192);
122
+ vertical-align: middle;
123
+ background-color: rgba(255, 255, 255, 0.1);
124
+ }
125
+
126
+ section.colorpalette-area .area-item .image-select-input {
127
+ padding: 5px 10px;
128
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
129
+ background-color: rgba(213, 235, 255, 0.192);
130
+ }
131
+
132
+ section.colorpalette-area .area-item img{
133
+ max-width: 100%;
134
+ margin: 0 auto;
135
+ }
136
+
137
+
138
+
139
+ section.color-scale-area {
140
+ background-color: #80c6d9;
141
+ position: relative;
142
+ }
143
+
144
+ section.color-scale-area:before {
145
+ position: absolute;
146
+ content: "";
147
+ width: 500px;
148
+ height: 500px;
149
+ border-radius: 50%;
150
+ background-color: rgb(226, 207, 50);
151
+ left: -250px;
152
+ top: 50%;
153
+ margin-top: -250px;
154
+ }
155
+
156
+ section.color-scale-area:after {
157
+ position: absolute;
158
+ content: "";
159
+ width: 100px;
160
+ height: 100px;
161
+ border-radius: 50%;
162
+ background-color: rgb(88, 69, 146);
163
+ left: 150px;
164
+ bottom: 100px;
165
+ }
166
+
167
+ section.color-scale-area > h1 {
168
+ margin-top:0px;
169
+ margin-bottom:0px;
170
+ color: white;
171
+ padding: 70px;
172
+ text-align: center;
173
+ font-size: 50px;
174
+ text-shadow: 1px 1px 1px rgb(0, 0, 0);
175
+ }
176
+
177
+ section.color-scale-area > div {
178
+ max-width: 820px;
179
+ margin: 0 auto;
180
+ padding-bottom: 100px;
181
+ }
182
+
183
+ section.color-scale-area .area-item {
184
+ width: 400px;
185
+ box-sizing: border-box;
186
+ border:0px;
187
+ margin:0px;
188
+ display: inline-block;
189
+ height: 400px;
190
+ box-shadow: 0 0 0 0 rgba(213, 235, 255, 0.192);
191
+ vertical-align: middle;
192
+ text-align: center;
193
+ }
194
+
195
+ section.color-scale-area .area-item .daimond {
196
+ margin: 0 auto;
197
+ }
198
+
199
+
200
+ section.color-scale-template-area {
201
+ background-color: rgba(248, 107, 107, 0.1);
202
+ }
203
+
204
+ section.color-scale-template-area > h1 {
205
+ margin-top:0px;
206
+ margin-bottom:0px;
207
+ color: #f7f7f7;
208
+ padding: 70px;
209
+ text-align: center;
210
+ font-size: 50px;
211
+ text-shadow: 1px 1px 1px rgb(0, 0, 0);
212
+ }
213
+
214
+ section.color-scale-template-area > div {
215
+ max-width: 820px;
216
+ margin: 0 auto;
217
+ padding-bottom: 100px;
218
+ }
219
+
220
+ section.color-scale-template-area h3 {
221
+ max-width: 820px;
222
+ margin: 0 auto;
223
+ padding-bottom: 10px;
224
+ text-align: center;
225
+ }
226
+
227
+ section.color-scale-template-area > div .color-scale {
228
+ margin: 0 auto;
229
+ margin-bottom: 10px;
230
+ }
231
+
232
+ section.color-gradient-template-area {
233
+ background-color: rgb(248, 107, 107);
234
+ }
235
+
236
+ section.color-gradient-template-area > h1 {
237
+ margin-top:0px;
238
+ margin-bottom:0px;
239
+ color: #f7f7f7;
240
+ padding: 70px;
241
+ text-align: center;
242
+ font-size: 50px;
243
+ text-shadow: 1px 1px 1px rgb(0, 0, 0);
244
+ }
245
+
246
+ section.color-gradient-template-area > div {
247
+ max-width: 820px;
248
+ margin: 0 auto;
249
+ padding-bottom: 100px;
250
+ }
251
+
252
+ section.color-gradient-template-area h3 {
253
+ max-width: 820px;
254
+ margin: 0 auto;
255
+ padding-bottom: 10px;
256
+ text-align: center;
257
+ }
258
+
259
+ section.color-gradient-template-area > div .color-gradient {
260
+ margin: 0 auto;
261
+ margin-bottom: 10px;
262
+ }
263
+
264
+
265
+ .ace-area {
266
+ max-width: 800px;
267
+ height: 600px;
268
+ margin: 0 auto;
269
+ }
270
+ .CodeMirror {
271
+ border: 1px solid #eee;
272
+ height: 300px;
273
+ }
274
+
275
+ .color-scale {
276
+ display:flex;
277
+ max-width: 500px;
278
+ margin-bottom: 5px;
279
+ background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;
280
+ }
281
+
282
+ .color-scale * {
283
+ flex: 1;
284
+ height: 30px;
285
+ position: relative;
286
+ }
287
+
288
+ .color-scale *:hover:after {
289
+ display: inline-block;
290
+ width: 100px;
291
+ text-align: center;
292
+ content: attr(title);
293
+ position:absolute;
294
+ left:50%;
295
+ bottom:100%;
296
+ background-color: black;
297
+ color: white;
298
+ transform:translateX(-50%);
299
+ }
300
+
301
+ .color-gradient {
302
+ display:flex;
303
+ max-width: 500px;
304
+ margin-bottom: 5px;
305
+ display: -webkit-flex; /* Safari */
306
+ -webkit-flex-wrap: wrap; /* Safari 6.1+ */
307
+ display: flex;
308
+ flex-wrap: wrap;
309
+ background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJElEQVQYV2NctWrVfwYkEBYWxojMZ6SDAmT7QGx0K1EcRBsFAADeG/3M/HteAAAAAElFTkSuQmCC") repeat;
310
+ }
311
+
312
+
313
+ .color-gradient > * {
314
+ flex:1;
315
+ height: 30px;
316
+ position: relative;
317
+ }
318
+
319
+ .color-gradient *:hover:after {
320
+ display: inline-block;
321
+ width: 100px;
322
+ text-align: center;
323
+ content: attr(title);
324
+ position:absolute;
325
+ left:50%;
326
+ bottom:100%;
327
+ background-color: black;
328
+ color: white;
329
+ transform:translateX(-50%);
330
+ }
331
+
332
+ .daimond {
333
+ width: 300px;
334
+ height: 300px;
335
+ box-sizing:border-box;
336
+ position: relative;
337
+ display: flex;
338
+ flex-direction: column;
339
+ }
340
+
341
+ .daimond .row {
342
+ flex: 1;
343
+ display: flex;
344
+ }
345
+
346
+ .daimond .row .column {
347
+ flex: 1;
348
+ height: 100%;
349
+ position: relative;
350
+
351
+ }
352
+
353
+ .daimond .row .column:hover:after {
354
+ display: inline-block;
355
+ width: 100px;
356
+ text-align: center;
357
+ content: attr(title);
358
+ position:absolute;
359
+ left:50%;
360
+ bottom:100%;
361
+ background-color: black;
362
+ color: white;
363
+ transform:translateX(-50%);
364
+ pointer-events: none;
365
+ }
366
+
367
+ #image-palette .color-item {
368
+ display:inline-block;
369
+ width: 100px;
370
+ height: 100px;
371
+ padding: 40px 20px;
372
+ box-sizing: border-box;
373
+ }
374
+
375
+ #image-palette .color-item:before {
376
+ content: attr(title);
377
+ color: black;
378
+ vertical-align: middle;
379
+
380
+ box-sizing: border-box;
381
+ text-align: center;
382
+ text-transform: uppercase;
383
+ }
384
+
385
+ #image-palette {
386
+ max-width: 500px;
387
+ }
388
+
389
+ .colorpicker-type {
390
+ display: inline-block;
391
+ width: 270px;
392
+ vertical-align: top;
393
+ }
394
+
395
+ footer {
396
+ padding: 100px;
397
+ background-color: rgb(29, 37, 43);
398
+ color: #ececec;
399
+ }
400
+
401
+ footer .email {
402
+ float: right;
403
+ color: rgba(252, 201, 34, 0.767);
404
+ }
405
+
406
+ .image-select-input > div {
407
+ padding-bottom: 2px;
408
+ }
409
+
410
+ #canvas-image canvas {
411
+ max-width: 300px;
412
+ }
413
+
414
+ </style>
415
+ </head>
416
+ <body>
417
+ <a href="https://github.com/you"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
418
+
419
+ <section class="main">
420
+ <h1 class="title">
421
+ CodeMirror ColorPicker Standalone
422
+ <div>
423
+ <iframe src="https://ghbtns.com/github-btn.html?user=easylogic&repo=ace-colorpicker&type=star&count=true&size=large" frameborder="0" scrolling="0" width="160px" height="30px"></iframe>
424
+ </div>
425
+
426
+ </h1>
427
+ </section>
428
+
429
+ <section class="colorpicker-style-list">
430
+ <h1 >ColorPicker Style</h1>
431
+ <div>
432
+ <div class="colorpicker-type">
433
+ <h3>Chrome Devtool Style</h3>
434
+ <div class="colorpicker-style" data-type="default"></div>
435
+ </div>
436
+ <div class="colorpicker-type">
437
+ <h3>Adobe XD Style</h3>
438
+ <div class="colorpicker-style" data-type="xd"></div>
439
+ </div>
440
+ <div class="colorpicker-type">
441
+ <h3>Sketch Style</h3>
442
+ <div class="colorpicker-style" data-type="sketch"></div>
443
+ </div>
444
+ <div class="colorpicker-type">
445
+ <h3>MacOS Style</h3>
446
+ <div class="colorpicker-style" data-type="macos"></div>
447
+ </div>
448
+ <div class="colorpicker-type">
449
+ <h3>Ring Style</h3>
450
+ <div class="colorpicker-style" data-type="ring"></div>
451
+ </div>
452
+
453
+ <div class="colorpicker-type">
454
+ <h3>Mini Style</h3>
455
+ <div class="colorpicker-style" data-type="mini"></div>
456
+ </div>
457
+
458
+ <div class="colorpicker-type">
459
+ <h3>Mini Vertical Style</h3>
460
+ <div class="colorpicker-style" data-type="mini-vertical"></div>
461
+ </div>
462
+
463
+
464
+ <!-- <div class="colorpicker-type">
465
+ <h3>Only Palette Style</h3>
466
+ <div class="colorpicker-style" data-type="palette"></div>
467
+ </div> -->
468
+ <pre><code class="javascript">{
469
+ colorpicker : {
470
+ type : 'palette' // or 'sketch', default type is 'chromedevtool'
471
+ }
472
+ }</code></pre>
473
+
474
+ </div>
475
+
476
+ </section>
477
+
478
+
479
+ <section class="colorpalette-area">
480
+ <h1> Image Filter </h1>
481
+ <div>
482
+ <div class="area-item">
483
+ <div class="image-select-input">
484
+ <input type="file" id="imageforfilter" />
485
+ <div>
486
+ <button type="button" onclick="view_histogram()">Histogram</button>
487
+ </div>
488
+ <div>
489
+ <button type="button" onclick="filter_image('brownie')">brownie</button>
490
+ </div>
491
+ <div>
492
+ <button type="button" onclick="filter_image(['histogram', 'gray', [ [0, 0], [50, 90], [ 100, 200] , [220, 240], [255, 255] ]])">histogram</button>
493
+ </div>
494
+ <div>
495
+ <button type="button" onclick="filter_image('kodachrome')">kodachrome</button>
496
+ </div>
497
+ <div>
498
+ <button type="button" onclick="filter_image('polaroid')">polaroid</button>
499
+ </div>
500
+ <div>
501
+ <button type="button" onclick="filter_image('technicolor')">technicolor</button>
502
+ </div>
503
+ <div>
504
+ <button type="button" onclick="filter_image('shift')">shift</button>
505
+ </div>
506
+ <div>
507
+ <button type="button" onclick="filter_image(['matrix', 1.1285582396593525,-0.3967382283601348,-0.03992559172921793,0,
508
+ -0.16404339962244616,1.0835251566291304,-0.05498805115633132,0,
509
+ -0.16786010706155763,-0.5603416277695248,0.6014850761964943,0,
510
+ 0,0,0,1])">matrix</button>
511
+ </div>
512
+ <div>
513
+ <button type="button" onclick="filter_image('motionBlur')">motion blur</button>
514
+ </div>
515
+ <div>
516
+ <button type="button" onclick="filter_image('gaussian-blur-5x')">gaussian-blur 5x</button>
517
+ </div>
518
+ <div>
519
+ <button type="button" onclick="filter_image('motionBlur3')">motion blur 3</button>
520
+ </div>
521
+ <div>
522
+ <button type="button" onclick="filter_image(['brightness', +document.getElementById('brightness_value').value])">brightness</button>
523
+ <input type="range" id="brightness_value" value="10" min="-100" max="100" step="1" />
524
+ </div>
525
+ <div>
526
+ <button type="button" onclick="filter_image(['sepia', +document.getElementById('sepia_value').value])">sepia</button>
527
+ <input type="range" id="sepia_value" value="10" min="-100" max="100" step="1" />
528
+ </div>
529
+ <div>
530
+ <button type="button" onclick="filter_image(['threshold', +document.getElementById('threshold_value').value])">threshold</button>
531
+ <input type="number" id="threshold_value" value="100" min="0" max="255" step="1" />
532
+ </div>
533
+ <div>
534
+ <button type="button" onclick="filter_image('sobel')">sobel</button>
535
+ </div>
536
+ <div>
537
+ <button type="button" onclick="filter_image(['rotate', 150])">rotate 150</button>
538
+ <button type="button" onclick="filter_image(['rotate', 75])">rotate 75</button>
539
+ <button type="button" onclick="filter_image(['rotate', 10])">rotate 10</button>
540
+ <button type="button" onclick="filter_image(['rotate', 90])">rotate 90</button>
541
+ <button type="button" onclick="filter_image(['rotate', 180])">rotate 180</button>
542
+ <button type="button" onclick="filter_image(['rotate', 270])">rotate 270</button>
543
+ </div>
544
+ <div>
545
+ <button type="button" onclick="filter_image(['filter', 'gradient(black, yellow 0.5, rgba(255, 0, 0, 0.5) 0.7, white, 100) invert(5)'])">parse</button>
546
+ </div>
547
+ <div>
548
+ <button type="button" onclick="filter_image('sharpen')">sharpen</button>
549
+ </div>
550
+ <div>
551
+ <button type="button" onclick="filter_image('emboss')">emboss</button>
552
+ </div>
553
+ <div>
554
+ <button type="button" onclick="filter_image(['vintage'])">vintage</button>
555
+ </div>
556
+ <div>
557
+ <button type="button" onclick="filter_image(['stack-blur', '100px'])">stack-blur(100px)</button>
558
+ </div>
559
+ <div>
560
+ <button type="button" onclick="filter_image(['flipH'])">flipH</button>
561
+ </div>
562
+ <div>
563
+ <button type="button" onclick="filter_image(['flipV'])">flipV</button>
564
+ </div>
565
+ <div>
566
+ <button type="button" onclick="filter_image(['gradient', 'black, yellow'])">duotone(red, yellow)</button>
567
+ </div>
568
+ <div>
569
+ <button type="button" onclick="filter_image(['gradient', 'black, white, 20'])">duotone(black, white, 20)</button>
570
+ </div>
571
+ <div>
572
+ <button type="button" onclick="filter_image(['grayscale', +document.getElementById('scale-value').value])">Gray</button>
573
+ <input type="range" min="0" max="200" step="1" value="100" id="scale-value" />
574
+ </div>
575
+ <div>
576
+ <button type="button" onclick="filter_image(['contrast', +document.getElementById('contrast-value').value])">Contrast</button>
577
+ <input type="range" min="-128" max="128" step="1" value="100" id="contrast-value" />
578
+ </div>
579
+ <div>
580
+ <button type="button" onclick="filter_image(['saturation', +document.getElementById('saturation-value').value])">Saturation</button>
581
+ <input type="range" min="0" max="100" step="1" value="100" id="saturation-value" />
582
+ </div>
583
+ <div>
584
+ <button type="button" onclick="filter_image(['crop', 0, 0, 200, 200])">crop</button>
585
+ </div>
586
+ <div>
587
+ <button type="button" onclick="filter_image(['invert', +document.getElementById('invert-value').value])">invert</button>
588
+ <input type="range" min="0" max="100" step="1" value="100" id="invert-value" />
589
+ </div>
590
+ <div>
591
+ <button type="button" onclick="filter_image(['solarize', +document.getElementById('solarize-r').value, +document.getElementById('solarize-g').value, +document.getElementById('solarize-b').value])">solarize</button>
592
+ <input type="range" min="0" max="255" step="1" value="100" id="solarize-r" />
593
+ <input type="range" min="0" max="255" step="1" value="100" id="solarize-g" />
594
+ <input type="range" min="0" max="255" step="1" value="100" id="solarize-b" />
595
+ </div>
596
+ <div>
597
+ <button type="button" onclick="filter_image(['partial', {x:50,y:50,width:200,height:200}, 'invert(70) sepia sharpen gradient( white, black)'])">partial</button>
598
+ </div>
599
+
600
+ <div>
601
+ <button type="button" onclick="filter_image(['noise', +document.getElementById('noise-value').value])">Noise</button>
602
+ <input type="range" min="1" max="100" step="1" value="3" id="noise-value" />
603
+ </div>
604
+ <div>
605
+ <button type="button" onclick="filter_image(['clip', +document.getElementById('clip-value').value])">Clip</button>
606
+ <input type="range" min="1" max="100" step="1" value="3" id="clip-value" />
607
+ </div>
608
+ <div>
609
+ <button type="button" onclick="filter_image(['blur', +document.getElementById('blur-value').value])">blur</button>
610
+ <input type="range" min="1" max="100" step="1" value="3" id="blur-value" />
611
+ </div>
612
+
613
+
614
+ </div>
615
+
616
+ </div>
617
+ <div class="area-item">
618
+ <div class="image-palette">
619
+ <img id="sampled-image">
620
+ </div>
621
+ </div>
622
+ <div class="area-item">
623
+ <div class="image-palette">
624
+ <img id="filtered-image" />
625
+ <div id="canvas-image"></div>
626
+ </div>
627
+ </div>
628
+ <pre><code class="javascript"></code></pre>
629
+ </div>
630
+ </section>
631
+
632
+ <section class="colorpalette-area">
633
+ <div class="circle white"></div>
634
+ <div class="circle yellow"></div>
635
+ <h1> Image Palette</h1>
636
+ <div>
637
+ <div class="area-item">
638
+ <div class="image-select-input">
639
+ <input type="file" id="image" />
640
+ <input type="button" value="pick" onclick="generatePalette()" />
641
+ </div>
642
+ <div>
643
+ <img id="palette-image">
644
+ </div>
645
+
646
+ </div>
647
+ <div class="area-item">
648
+ <div class="image-palette" id="image-palette">
649
+
650
+ </div>
651
+ </div>
652
+ <pre><code class="javascript">var Color = CodeMirrorColorPicker.Color;
653
+ Color.ImageToRGB(blob, { maxWidth: 100 }, function (results) {
654
+ const colors = Color.palette(results, 16); // k = 16
655
+
656
+ console.log(colors);
657
+ })</code></pre>
658
+ </div>
659
+ </section>
660
+
661
+ <section class="color-scale-area">
662
+ <h1>Color Scales</h1>
663
+ <div>
664
+ <div class="area-item">
665
+ <h2> Saturation Scale</h2>
666
+ <div class="daimond" data-background-color="yellow" data-target='S'></div>
667
+ </div>
668
+ <div class="area-item">
669
+ <h2> Value Scale</h2>
670
+ <div class="daimond" data-background-color="yellow" data-target='V'></div>
671
+ </div>
672
+ <pre><code class="javascript">var Color = CodeMirrorColorPicker.Color;
673
+ var results = Color.scaleS(color, 100, 'hex'); // Saturation
674
+ var results2 = Color.scaleV(color, 100, 'hex'); // Value
675
+ </code></pre>
676
+ </div>
677
+ </section>
678
+ <section class="color-scale-template-area">
679
+ <h1> Color Scales - Template </h1>
680
+ <div>
681
+
682
+ <h3>parula</h3>
683
+ <div class="color-scale" data-colors="parula" data-count="20"></div>
684
+ <h3>hsv</h3>
685
+
686
+ <div class="color-scale" data-colors="hsv" data-count="40"></div>
687
+ <h3>parula</h3>
688
+
689
+ <div class="color-scale" data-colors="parula" data-count="20"></div>
690
+ <h3>jet</h3>
691
+
692
+ <div class="color-scale" data-colors="jet" data-count="20"></div>
693
+ <h3>hot</h3>
694
+
695
+ <div class="color-scale" data-colors="hot" data-count="20"></div>
696
+ <h3>pink</h3>
697
+
698
+ <div class="color-scale" data-colors="pink" data-count="20"></div>
699
+ <h3>bone</h3>
700
+
701
+ <div class="color-scale" data-colors="bone" data-count="20"></div>
702
+ <h3>copper</h3>
703
+
704
+ <div class="color-scale" data-colors="copper" data-count="20"></div>
705
+ <h3>red,yellow,rgba(255, 0, 255, 0.5)</h3>
706
+
707
+ <div class="color-scale" data-colors="red,yellow,rgba(255, 0, 255, 0.5)" data-count="20"></div>
708
+ <h3>red,yellow</h3>
709
+
710
+ <div class="color-scale" data-colors="red,yellow" data-count="50"></div>
711
+ <h3>red,blue</h3>
712
+
713
+ <div class="color-scale" data-colors="red,blue" data-count="25"></div>
714
+ <h3>red,black</h3>
715
+ <div class="color-scale" data-colors="red,black" data-count="105"></div>
716
+ <pre><code class="javascript">var Color = CodeMirrorColorPicker.Color;
717
+ var colors = ['red', 'green', 'blue']
718
+ var scaleColors = Color.scale(colors, count);
719
+ var scaleColors = Color.scale('red,yellow,rgba(255, 0, 255, 0.5)', count);
720
+ var scaleColors = Color.scale.parula(count); // ['#352a87', '#0f5cdd', '#00b5a6', '#ffc337', '#fdff00']
721
+ var scaleColors = Color.scale.jet(count); // ['#00008f', '#0020ff', '#00ffff', '#51ff77', '#fdff00', '#ff0000', '#800000']
722
+ var scaleColors = Color.scale.hsv(count); // ['#ff0000', '#ffff00', '#00ff00', '#00ffff', '#0000ff', '#ff00ff', '#ff0000']
723
+ var scaleColors = Color.scale.hot(count); // ['#0b0000', '#ff0000', '#ffff00', '#ffffff']
724
+ var scaleColors = Color.scale.pink(count); // ['#1e0000', '#bd7b7b', '#e7e5b2', '#ffffff']
725
+ var scaleColors = Color.scale.bone(count); // ['#000000', '#4a4a68', '#a6c6c6', '#ffffff']
726
+ var scaleColors = Color.scale.copper(count); // ['#000000', '#3d2618', '#9d623e', '#ffa167', '#ffc77f']
727
+ </code></pre>
728
+ </div>
729
+
730
+ </section>
731
+
732
+ <section class="color-gradient-template-area">
733
+ <h1> Color Gradients - Template </h1>
734
+ <div>
735
+
736
+ <h3>white, red 0.5, yellow - count 20</h3>
737
+ <div class="color-gradient" data-title="gradient" data-colors="rgba(255, 255, 255, 0.5), rgba(255, 0, 0, 0.1) 0.5, yellow" data-count="20"></div>
738
+ <h3>white, red 0.2, yellow - count 100</h3>
739
+ <div class="color-gradient" data-title="gradient" data-colors="yellow, red 0.2, green 50%, yellow" data-count="100"></div>
740
+ <h3>white, red 0.2, yellow - count 100</h3>
741
+ <div class="color-gradient" data-title="gradient" data-colors="white, red 0.2, yellow" data-count="100"></div>
742
+ <h3>white, red 0.2, blue 0.6, magenta 0.95, yellow - count 100</h3>
743
+ <div class="color-gradient" data-title="gradient" data-colors="white, red 0.2, blue 0.6, magenta 0.95, yellow" data-count="100"></div>
744
+ </div>
745
+ <pre><code class="javascript">var Color = CodeMirrorColorPicker.Color;
746
+ var gradientColors = Color.graident("white, red 0.5, yellow", count);
747
+ var gradientColors = Color.graident(["white", "red 0.5" , "yellow"], count);
748
+ var gradientColors = Color.graident(["white", "red 50%" , "yellow"], count);
749
+ var gradientColors = Color.graident([['white'], ["red", 0.5] , ["yellow"]], count);
750
+ </code></pre>
751
+ </section>
752
+
753
+
754
+ <section>
755
+ <h1 class="title">Default Html Sample </h1>
756
+
757
+ <div>
758
+ <button type="button" id="gray-scale" >gray scale</button><br />
759
+ <button type="button" onclick="showColor(event)" data-color="green">green</a>
760
+ </div>
761
+ </section>
762
+
763
+ <footer>
764
+ &copy; easylogic colorpicker - MIT license
765
+ <div class="email">cyberuls@gmail.com</div>
766
+ </footer>
767
+
768
+ <script type="text/javascript">
769
+ function generatePalette () {
770
+ var blob = document.getElementById('image').files[0];
771
+ var Color = CodeMirrorColorPicker.Color;
772
+ document.getElementById('palette-image').src = URL.createObjectURL(blob);
773
+
774
+ Color.ImageToRGB(blob, { maxWidth: 100 }, function (results) {
775
+ const colors = Color.palette(results, 16);
776
+
777
+ var fragment = document.createDocumentFragment();
778
+ for (var i = 0, len = colors.length; i < len; i++) {
779
+ var dom = document.createElement('div');
780
+ dom.classList.add('color-item');
781
+
782
+
783
+ dom.setAttribute('title', colors[i]);
784
+ dom.style.backgroundColor = colors[i];
785
+
786
+ fragment.appendChild(dom);
787
+ }
788
+
789
+ document.getElementById('image-palette').innerHTML = "";
790
+ document.getElementById('image-palette').appendChild(fragment);
791
+ })
792
+ }
793
+
794
+ function view_histogram () {
795
+ var args = Array.prototype.slice.call(arguments);
796
+ var file = document.getElementById('imageforfilter').files[0];
797
+ document.getElementById('sampled-image').src = URL.createObjectURL(file);
798
+
799
+ Color.ImageToHistogram(file, function (url) {
800
+ document.getElementById('filtered-image').src = url;
801
+ }, {red: true, green: true})
802
+ }
803
+
804
+ function filter_image (A, B, C) {
805
+ var args = Array.prototype.slice.call(arguments);
806
+ var file = document.getElementById('imageforfilter').files[0];
807
+ var ImageFilter = CodeMirrorColorPicker.ImageFilter;
808
+ document.getElementById('sampled-image').src = URL.createObjectURL(file);
809
+
810
+ Color.ImageToCanvas(file, ImageFilter.merge(args), function (canvas) {
811
+ document.getElementById("canvas-image").innerHTML = ""
812
+ document.getElementById('canvas-image').appendChild(canvas)
813
+ })
814
+ }
815
+
816
+
817
+ function shuffle(a) {
818
+ var j, x, i;
819
+ for (i = a.length - 1; i > 0; i--) {
820
+ j = Math.floor(Math.random() * (i + 1));
821
+ x = a[i];
822
+ a[i] = a[j];
823
+ a[j] = x;
824
+ }
825
+ }
826
+ var colors = [ 'red', 'blue', 'white' ];
827
+
828
+ function showColor(event) {
829
+ var Color = CodeMirrorColorPicker.Color;
830
+ var colorpicker = new CodeMirrorColorPicker.ColorPicker();
831
+
832
+ var color = event.target.getAttribute('data-color');
833
+ var target = event.target;
834
+
835
+ colorpicker.show({
836
+ left : (target.offsetWidth + target.offsetLeft),
837
+ top : event.clientY,
838
+ hideDelay: 0
839
+ }, 'hsla(0,100%,54%,0.67)', function (newColor) {
840
+
841
+ var temp = Color.parse(newColor);
842
+
843
+ var textColor = Color.format(Color.c(temp), 'hex');
844
+
845
+ target.style.backgroundColor = newColor;
846
+ target.style.color = textColor;
847
+ target.textContent = newColor;
848
+
849
+ var rgb = Color.RGBtoGray(temp);
850
+
851
+ var gray = Color.format(rgb, "hex")
852
+ document.getElementById('gray-scale').textContent = gray;
853
+ document.getElementById('gray-scale').style.backgroundColor = gray;
854
+
855
+ });
856
+ }
857
+
858
+ var Color = CodeMirrorColorPicker.Color;
859
+ var nodes = document.querySelectorAll(".color-scale");
860
+ for(var i = 0, len = nodes.length; i < len; i++) {
861
+ var item = nodes[i];
862
+
863
+ var colors = item.getAttribute('data-colors');
864
+ var count = +item.getAttribute('data-count');
865
+
866
+ if (colors.length && Color.scale[colors]) {
867
+ var scaleColors = Color.scale[colors](count);
868
+ } else {
869
+ var scaleColors = Color.scale(colors, count);
870
+ }
871
+
872
+ var fragment = document.createDocumentFragment();
873
+ for (var index = 0, scaleCount = scaleColors.length; index < scaleCount; index++) {
874
+ var dom = document.createElement('div');
875
+ dom.style.backgroundColor = scaleColors[index];
876
+ dom.setAttribute('title', (index+1) + "-" + scaleColors[index])
877
+ fragment.appendChild(dom);
878
+ }
879
+
880
+ item.appendChild(fragment);
881
+
882
+ }
883
+
884
+ var nodes = document.querySelectorAll(".color-gradient");
885
+ for(var i = 0, len = nodes.length; i < len; i++) {
886
+ var item = nodes[i];
887
+
888
+ var colors = item.getAttribute('data-colors');
889
+ var count = +item.getAttribute('data-count');
890
+
891
+ var scaleColors = Color.gradient(colors, count);
892
+
893
+ var fragment = document.createDocumentFragment();
894
+ for (var index = 0, scaleCount = scaleColors.length; index < scaleCount; index++) {
895
+ var dom = document.createElement('div');
896
+ dom.style.backgroundColor = scaleColors[index];
897
+ dom.setAttribute('title', (index+1) + "-" + scaleColors[index])
898
+ fragment.appendChild(dom);
899
+ }
900
+ item.appendChild(fragment);
901
+
902
+ }
903
+
904
+ var nodes = document.querySelectorAll(".daimond");
905
+ for(var index = 0, len = nodes.length; index < len; index++) {
906
+ var item = nodes[index];
907
+
908
+ var color = item.getAttribute('data-background-color');
909
+ var target = item.getAttribute('data-target');
910
+ item.style.backgroundColor = color;
911
+
912
+ var results = Color['scale' + target](color, 100, 'hex');
913
+ var layerCount = 10;
914
+
915
+ var fragment = document.createDocumentFragment();
916
+ for (var i = 0; i < layerCount; i++) {
917
+ var dom = document.createElement('div');
918
+ dom.classList.add('row');
919
+
920
+ for(var j = 0; j < layerCount; j++) {
921
+ var it = document.createElement('div');
922
+ it.classList.add('column');
923
+
924
+ it.setAttribute('title', results[i*layerCount + j]);
925
+ it.style.backgroundColor = results[i*layerCount + j];
926
+
927
+ dom.appendChild(it);
928
+ }
929
+ fragment.appendChild(dom);
930
+ }
931
+
932
+ item.appendChild(fragment);
933
+ }
934
+
935
+
936
+ var Color = CodeMirrorColorPicker.Color;
937
+ var nodes = document.querySelectorAll(".colorpicker-style");
938
+ for(var i = 0, len = nodes.length; i < len; i++) {
939
+ var item = nodes[i];
940
+
941
+ var type = item.getAttribute('data-type');
942
+ var vertical = item.getAttribute('data-vertical');
943
+
944
+ var picker = new CodeMirrorColorPicker.create({
945
+ position: 'inline',
946
+ container: item,
947
+ type: type,
948
+ color: 'blue',
949
+ outputFormat: 'hex',
950
+ hideDelay: 0,
951
+ onHide: function (c) {
952
+ console.log('hide', c)
953
+ },
954
+ onChange : function (c) {
955
+ console.log('change', c);
956
+ }
957
+ });
958
+ /*
959
+ picker.setUserPalette([
960
+ { name : "ttingttong",
961
+ colors: [
962
+ '#F44336', '#E91E63', '#9C27B0', '#673AB7', '#3F51B5'
963
+ ]
964
+ },
965
+ { name : "Custom", "edit" : true, "colors" : [] },
966
+ { name: "Color Scale", "scale" : ['red', 'yellow', 'black' ], count : 5 }
967
+ ])
968
+ */
969
+ }
970
+ </script>
971
+ <script>hljs.initHighlightingOnLoad();</script>
972
+
973
+ </body>
974
+
975
+ </html>