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
@@ -0,0 +1,172 @@
1
+ &.sketch {
2
+ border-radius: 5px;
3
+
4
+ > .colorpicker-body {
5
+
6
+ > .color {
7
+ margin: 10px 10px 2px 10px;
8
+ box-sizing: border-box;
9
+ height: 150px;
10
+ }
11
+
12
+ > .control {
13
+ padding: 0px;
14
+
15
+ > .color, > .empty {
16
+ position: absolute;
17
+ right: 10px;
18
+ left: auto;
19
+ top: 1px;
20
+ width: 26px;
21
+ height: 26px;
22
+ border-radius: 2px;
23
+ box-sizing: border-box;
24
+ }
25
+
26
+ > .color {
27
+ box-shadow: inset 0px 0px 1px 0px rgba(0, 0, 0, 0.5);
28
+ }
29
+
30
+ > .hue {
31
+ position: relative;
32
+ padding: 2px 2px 2px 10px;
33
+ margin: 0px 38px 0px 0px;
34
+
35
+ > .hue-container {
36
+ border-radius: 0px;
37
+ }
38
+ }
39
+
40
+ > .opacity {
41
+ position: relative;
42
+ padding: 2px 2px 2px 10px;
43
+ margin: 0px 38px 0px 0px;
44
+
45
+ > .opacity-container {
46
+ border-radius: 0px;
47
+ }
48
+ }
49
+
50
+ .drag-bar, .drag-bar2 {
51
+ border-radius: 0px;
52
+ top: 50%;
53
+ left: 0px;
54
+ width: 2px;
55
+ height: 50%;
56
+ transform: translateX(-50%) translateY(-50%);
57
+ border-radius: 1px;
58
+ bottom: 1px !important;
59
+
60
+ &.first {
61
+ left: 0px;
62
+ transform: translateX(50%) translateY(-50%) !important;
63
+ }
64
+
65
+ &.last {
66
+ transform: translateX(-150%) translateY(-50%) !important;
67
+ }
68
+ }
69
+ }
70
+
71
+ > .information {
72
+ .information-change {
73
+ display: none;
74
+ }
75
+
76
+ &.rgb {
77
+ .information-item.rgb {
78
+ display: inherit;
79
+ }
80
+
81
+ .information-item.hsl {
82
+ display: none !important;
83
+ }
84
+ }
85
+
86
+ &.hex {
87
+ .information-item.hex {
88
+ display: inherit;
89
+ }
90
+ .information-item.hsl {
91
+ display: none !important;
92
+ }
93
+ }
94
+
95
+ &.hsl {
96
+ .information-item.rgb {
97
+ display: none !important;
98
+ }
99
+
100
+ .information-item.hsl {
101
+ display: inherit;
102
+ }
103
+ }
104
+
105
+ .information-item {
106
+ display: inline-flex !important;
107
+ margin-right: 0px;
108
+
109
+
110
+ > .input-field {
111
+
112
+ padding-left: 0px;
113
+
114
+ &:last-child {
115
+ padding-right: 0px;
116
+ }
117
+
118
+ > .title {
119
+ color: black;
120
+ font-size: 11px;
121
+ cursor: pointer;
122
+
123
+ }
124
+ }
125
+
126
+ > .input-field:last-child:not(:first-child) {
127
+ padding-right: 0px;
128
+ }
129
+ }
130
+
131
+
132
+ .information-item.hex {
133
+ width: 74px;
134
+ padding-right: 0px;
135
+ padding-left: 5px;
136
+ }
137
+
138
+ .information-item.rgb {
139
+ width: 140px;
140
+ padding-left: 0px;
141
+ padding-right: 0px;
142
+ }
143
+
144
+ .information-item.hsl {
145
+ display: none;
146
+ width: 140px;
147
+ padding-left: 0px;
148
+ padding-right: 0px;
149
+ }
150
+ }
151
+
152
+ > .colorsets {
153
+ > .menu {
154
+ // display: none;
155
+ }
156
+
157
+ > .color-list {
158
+ margin-right: 0px;
159
+ padding-right: 12px;
160
+
161
+ .color-item {
162
+ width: 16px;
163
+ height: 16px;
164
+ border-radius: 3px;
165
+ margin-right: 9px;
166
+ margin-bottom: 10px;
167
+ }
168
+ }
169
+ }
170
+ }
171
+
172
+ }
@@ -0,0 +1,93 @@
1
+ &.vscode {
2
+ width: 335px;
3
+ display: inline-block;
4
+ background-color: #333;
5
+ border: 1px solid #ececec;
6
+ box-sizing: border-box;
7
+ border-radius: 0px;
8
+
9
+ .colorpicker-body {
10
+ border-radius: 0px;
11
+ display: inline-block;
12
+
13
+ .color-view {
14
+ height: 34px;
15
+ @include transparent-background();
16
+
17
+ .color-view-container {
18
+ line-height: 34px;
19
+ font-size: 14px;
20
+ text-align: center;
21
+ width: 100%;
22
+ height: 100%;
23
+ cursor: pointer;
24
+ user-select: none;
25
+ text-shadow: 0 0 3px rgb(83, 83, 83);
26
+ }
27
+ }
28
+
29
+ .color-tool {
30
+ padding: 8px;
31
+ }
32
+ }
33
+
34
+ .color {
35
+ display:inline-block;
36
+ width: 239px;
37
+ height: 160px;
38
+ vertical-align: middle;
39
+ }
40
+
41
+ .control {
42
+ height: 160px;
43
+ vertical-align: middle;
44
+ display:inline-block;
45
+ padding: 0px 0px 0px 4px;
46
+
47
+ .hue, .opacity {
48
+ margin: 0px;
49
+ padding:0px;
50
+ width: 30px;
51
+ display:inline-block;
52
+ vertical-align: middle;
53
+ height: 100%;
54
+ position: relative;
55
+ }
56
+
57
+
58
+ .hue {
59
+ padding-left: 5px;
60
+ width: 35px;
61
+ }
62
+
63
+ .hue > .hue-container {
64
+ border-radius:0px;
65
+ height: 100%;
66
+ background: linear-gradient(to top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
67
+ }
68
+
69
+
70
+ .opacity > .opacity-container {
71
+ border-radius: 0px;
72
+ height: 100%;
73
+ width: 30px;
74
+ }
75
+
76
+
77
+ .drag-bar, .drag-bar2 {
78
+ background-color: transparent;
79
+ height:5px;
80
+ width:33px;
81
+ box-sizing: border-box;
82
+ box-shadow: none;
83
+ transform: translateY(-50%) translateX(-2px);
84
+ border: 1px solid rgba(255, 255, 255, 1);
85
+ border-radius: 0px;
86
+ box-shadow: 0 0 2px 0 rgba(0, 0, 0, 1), inset 0 0 0 0 rgba(0, 0, 0, 1);
87
+
88
+
89
+ }
90
+
91
+ }
92
+
93
+ }
@@ -0,0 +1,88 @@
1
+ &.xd {
2
+ display: inline-block;
3
+ // padding: 12px;
4
+ padding-top: 12px;
5
+ width: 245px;
6
+
7
+ .color {
8
+ display:inline-block;
9
+ margin-left: 12px;
10
+ margin-bottom: 12px;
11
+ width: 170px;
12
+ height: 170px;
13
+ vertical-align: middle;
14
+ border-radius: 3px;
15
+ overflow: hidden;
16
+ box-sizing: border-box;
17
+ border: 1px solid #cecece;
18
+
19
+ > .saturation {
20
+ > .value {
21
+ > .drag-pointer {
22
+ border: 2px solid white;
23
+ width: 7px;
24
+ height: 7px;
25
+ box-shadow: 0 0 1px 0px rgba(0, 0, 0, 1), inset 0 0 1px 0px rgba(0, 0, 0, 1);
26
+ }
27
+ }
28
+ }
29
+
30
+ }
31
+
32
+ .control {
33
+ height: 170px;
34
+ padding: 0px;
35
+ vertical-align: middle;
36
+ display:inline-block;
37
+ margin-right: 12px;
38
+ margin-bottom: 12px;
39
+
40
+ .hue, .opacity {
41
+ margin: 0px;
42
+ padding:0px;
43
+ width: 13px;
44
+ display:inline-block;
45
+ vertical-align: middle;
46
+ height: 100%;
47
+ position: relative;
48
+ overflow: hidden;
49
+ border-radius: 3px;
50
+ margin-left: 8px;
51
+ }
52
+
53
+ .hue > .hue-container {
54
+ border-radius:0px;
55
+ overflow:hidden;
56
+ height: 100%;
57
+ background: linear-gradient(to top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
58
+ }
59
+
60
+
61
+ .opacity > .opacity-container {
62
+ border-radius: 0px;
63
+ overflow: hidden;
64
+ height: 100%;
65
+ }
66
+
67
+
68
+ .drag-bar, .drag-bar2 {
69
+ border:0px;
70
+ background-color: transparent;
71
+ border: 2px solid white;
72
+ box-shadow: 0 0 1px 0px rgba(0, 0, 0, 1), inset 0 0 1px 0px rgba(0, 0, 0, 1);
73
+ width: 10px;
74
+ height: 10px;
75
+ box-sizing: border-box;
76
+ transform: none;
77
+ overflow: hidden;
78
+ left: 50%;
79
+ transform: translateX(-50%) translateY(-50%);
80
+ }
81
+
82
+ }
83
+
84
+ .information {
85
+ margin-top: 5px;
86
+ }
87
+
88
+ }
@@ -0,0 +1,29 @@
1
+ import separable from './blend/separable'
2
+ import nonseparable from './blend/non-separable'
3
+ import composite from './blend/composite'
4
+
5
+ function num(n) {
6
+ if (n < 0) return 0;
7
+ return n > 255 ? 255 : n;
8
+ }
9
+
10
+ function Blender (back, source, blendFunction, blendMode = 'normal', compositeOperation = 'source-over') {
11
+
12
+ const compositeFunction = composite[compositeOperation];
13
+
14
+ return compositeFunction(back, blendFunction(back, source, blendMode));
15
+
16
+ }
17
+
18
+ Object.keys(separable).forEach(mode => {
19
+ Blender[mode] = function (back, source, compositeOperation = 'source-over') {
20
+ return Blender(back, source, separable[mode],mode, compositeOperation)
21
+ }
22
+ })
23
+ Object.keys(nonseparable).forEach(mode => {
24
+ Blender[mode] = function (back, source, compositeOperation = 'source-over') {
25
+ return Blender(back, source, nonseparable[mode],mode, compositeOperation)
26
+ }
27
+ })
28
+
29
+ export default Blender
@@ -0,0 +1,128 @@
1
+ import Color from './Color'
2
+
3
+ function each(len, callback) {
4
+ for (var i = 0; i < len; i += 4) {
5
+ callback(i);
6
+ }
7
+ }
8
+
9
+ function pack(bitmap, callback) {
10
+
11
+ each(bitmap.pixels.length, (i) => {
12
+ callback(bitmap.pixels, i)
13
+ })
14
+ }
15
+
16
+ const Canvas = {
17
+
18
+ create (width, height) {
19
+ var canvas = document.createElement('canvas');
20
+ canvas.width = width || 0;
21
+ canvas.height = height || 0;
22
+
23
+ return canvas;
24
+ },
25
+
26
+ drawPixels(bitmap) {
27
+ var canvas = this.create(bitmap.width, bitmap.height);
28
+
29
+ var context = canvas.getContext('2d');
30
+ var imagedata = context.getImageData(0, 0, canvas.width, canvas.height);
31
+
32
+ imagedata.data.set(bitmap.pixels);
33
+
34
+ context.putImageData(imagedata, 0, 0);
35
+
36
+ return canvas;
37
+ },
38
+
39
+ createHistogram (width, height, histogram, callback, opt = { black: true, red: false, green : false, blue: false}) {
40
+ var canvas = this.create(width, height)
41
+ const context = canvas.getContext('2d')
42
+ context.clearRect(0, 0, width, height)
43
+ context.fillStyle = "white"
44
+ context.fillRect(0, 0, width, height)
45
+ context.globalAlpha = 0.7
46
+
47
+ var omit = { black: false }
48
+ if (opt.black) {omit.black = false } else {omit.black = true}
49
+ if (opt.red) {omit.red = false } else {omit.red = true}
50
+ if (opt.green) {omit.green = false } else {omit.green = true}
51
+ if (opt.blue) {omit.blue = false } else {omit.blue = true}
52
+
53
+
54
+ Object.keys(histogram).forEach(color => {
55
+
56
+ if (!omit[color]) {
57
+
58
+ var array = histogram[color]
59
+ const ymax = Math.max.apply(Math, array)
60
+ const unitWith = width / array.length
61
+
62
+ context.fillStyle = color
63
+ array.forEach((it, index) => {
64
+ const currentHeight = height * (it / ymax)
65
+ const x = index * unitWith
66
+
67
+ context.fillRect(x, height - currentHeight, unitWith, currentHeight);
68
+ });
69
+ }
70
+
71
+ })
72
+
73
+
74
+ if (typeof callback == 'function') callback(canvas)
75
+
76
+ },
77
+
78
+ getHistogram (bitmap) {
79
+ let black = new Array(256)
80
+ let red = new Array(256)
81
+ let green = new Array(256)
82
+ let blue = new Array(256)
83
+ for(var i = 0; i < 256; i++) {
84
+ black[i] = 0
85
+ red[i] = 0
86
+ green[i] = 0
87
+ blue[i] = 0
88
+ }
89
+
90
+ pack(bitmap, (pixels, i) => {
91
+ // gray scale
92
+ const grayIndex = Math.round(Color.brightness(pixels[i], pixels[i+1], pixels[i+2]))
93
+ black[grayIndex]++
94
+
95
+ red[pixels[i]]++
96
+ green[pixels[i+1]]++
97
+ blue[pixels[i+2]]++
98
+
99
+ })
100
+
101
+ return {black, red, green, blue }
102
+ },
103
+
104
+ getBitmap(bitmap, area) {
105
+ var canvas = this.drawPixels(bitmap);
106
+
107
+ var context = canvas.getContext('2d');
108
+ var pixels = context.getImageData(area.x || 0, area.y || 0, area.width || canvas.width, area.height || canvas.height).data;
109
+
110
+ return { pixels, width: area.width, height: area.height };
111
+ },
112
+
113
+ putBitmap(bitmap, subBitmap, area) {
114
+
115
+ var canvas = this.drawPixels(bitmap);
116
+ var subCanvas = this.drawPixels(subBitmap);
117
+
118
+ var context = canvas.getContext('2d');
119
+ context.drawImage(subCanvas, area.x, area.y);
120
+
121
+ bitmap.pixels = context.getImageData(0, 0, bitmap.width, bitmap.height).data;
122
+
123
+ return bitmap;
124
+ }
125
+
126
+ }
127
+
128
+ export default Canvas;
@@ -0,0 +1,27 @@
1
+ import formatter from "./functions/formatter";
2
+ import math from './functions/math'
3
+ import fromRGB from './functions/fromRGB'
4
+ import fromCMYK from './functions/fromCMYK'
5
+ import fromLAB from './functions/fromLAB'
6
+ import fromHSV from './functions/fromHSV'
7
+ import fromHSL from './functions/fromHSL'
8
+ import fromYCrCb from './functions/fromYCrCb'
9
+ import mixin from "./functions/mixin";
10
+ import parser from "./functions/parser";
11
+ import image from "./functions/image";
12
+
13
+
14
+ export default {
15
+ ...formatter,
16
+ ...math,
17
+ ...mixin,
18
+ ...parser,
19
+ ...fromYCrCb,
20
+ ...fromRGB,
21
+ ...fromCMYK,
22
+ ...fromHSV,
23
+ ...fromHSL,
24
+ ...fromLAB,
25
+ ...image
26
+ }
27
+
@@ -0,0 +1,14 @@
1
+ export const color_names = { aliceblue: "rgb(240, 248, 255)", antiquewhite: "rgb(250, 235, 215)", aqua: "rgb(0, 255, 255)", aquamarine: "rgb(127, 255, 212)", azure: "rgb(240, 255, 255)", beige: "rgb(245, 245, 220)", bisque: "rgb(255, 228, 196)", black: "rgb(0, 0, 0)", blanchedalmond: "rgb(255, 235, 205)", blue: "rgb(0, 0, 255)", blueviolet: "rgb(138, 43, 226)", brown: "rgb(165, 42, 42)", burlywood: "rgb(222, 184, 135)", cadetblue: "rgb(95, 158, 160)", chartreuse: "rgb(127, 255, 0)", chocolate: "rgb(210, 105, 30)", coral: "rgb(255, 127, 80)", cornflowerblue: "rgb(100, 149, 237)", cornsilk: "rgb(255, 248, 220)", crimson: "rgb(237, 20, 61)", cyan: "rgb(0, 255, 255)", darkblue: "rgb(0, 0, 139)", darkcyan: "rgb(0, 139, 139)", darkgoldenrod: "rgb(184, 134, 11)", darkgray: "rgb(169, 169, 169)", darkgrey: "rgb(169, 169, 169)", darkgreen: "rgb(0, 100, 0)", darkkhaki: "rgb(189, 183, 107)", darkmagenta: "rgb(139, 0, 139)", darkolivegreen: "rgb(85, 107, 47)", darkorange: "rgb(255, 140, 0)", darkorchid: "rgb(153, 50, 204)", darkred: "rgb(139, 0, 0)", darksalmon: "rgb(233, 150, 122)", darkseagreen: "rgb(143, 188, 143)", darkslateblue: "rgb(72, 61, 139)", darkslategray: "rgb(47, 79, 79)", darkslategrey: "rgb(47, 79, 79)", darkturquoise: "rgb(0, 206, 209)", darkviolet: "rgb(148, 0, 211)", deeppink: "rgb(255, 20, 147)", deepskyblue: "rgb(0, 191, 255)", dimgray: "rgb(105, 105, 105)", dimgrey: "rgb(105, 105, 105)", dodgerblue: "rgb(30, 144, 255)", firebrick: "rgb(178, 34, 34)", floralwhite: "rgb(255, 250, 240)", forestgreen: "rgb(34, 139, 34)", fuchsia: "rgb(255, 0, 255)", gainsboro: "rgb(220, 220, 220)", ghostwhite: "rgb(248, 248, 255)", gold: "rgb(255, 215, 0)", goldenrod: "rgb(218, 165, 32)", gray: "rgb(128, 128, 128)", grey: "rgb(128, 128, 128)", green: "rgb(0, 128, 0)", greenyellow: "rgb(173, 255, 47)", honeydew: "rgb(240, 255, 240)", hotpink: "rgb(255, 105, 180)", indianred: "rgb(205, 92, 92)", indigo: "rgb(75, 0, 130)", ivory: "rgb(255, 255, 240)", khaki: "rgb(240, 230, 140)", lavender: "rgb(230, 230, 250)", lavenderblush: "rgb(255, 240, 245)", lawngreen: "rgb(124, 252, 0)", lemonchiffon: "rgb(255, 250, 205)", lightblue: "rgb(173, 216, 230)", lightcoral: "rgb(240, 128, 128)", lightcyan: "rgb(224, 255, 255)", lightgoldenrodyellow: "rgb(250, 250, 210)", lightgreen: "rgb(144, 238, 144)", lightgray: "rgb(211, 211, 211)", lightgrey: "rgb(211, 211, 211)", lightpink: "rgb(255, 182, 193)", lightsalmon: "rgb(255, 160, 122)", lightseagreen: "rgb(32, 178, 170)", lightskyblue: "rgb(135, 206, 250)", lightslategray: "rgb(119, 136, 153)", lightslategrey: "rgb(119, 136, 153)", lightsteelblue: "rgb(176, 196, 222)", lightyellow: "rgb(255, 255, 224)", lime: "rgb(0, 255, 0)", limegreen: "rgb(50, 205, 50)", linen: "rgb(250, 240, 230)", magenta: "rgb(255, 0, 255)", maroon: "rgb(128, 0, 0)", mediumaquamarine: "rgb(102, 205, 170)", mediumblue: "rgb(0, 0, 205)", mediumorchid: "rgb(186, 85, 211)", mediumpurple: "rgb(147, 112, 219)", mediumseagreen: "rgb(60, 179, 113)", mediumslateblue: "rgb(123, 104, 238)", mediumspringgreen: "rgb(0, 250, 154)", mediumturquoise: "rgb(72, 209, 204)", mediumvioletred: "rgb(199, 21, 133)", midnightblue: "rgb(25, 25, 112)", mintcream: "rgb(245, 255, 250)", mistyrose: "rgb(255, 228, 225)", moccasin: "rgb(255, 228, 181)", navajowhite: "rgb(255, 222, 173)", navy: "rgb(0, 0, 128)", oldlace: "rgb(253, 245, 230)", olive: "rgb(128, 128, 0)", olivedrab: "rgb(107, 142, 35)", orange: "rgb(255, 165, 0)", orangered: "rgb(255, 69, 0)", orchid: "rgb(218, 112, 214)", palegoldenrod: "rgb(238, 232, 170)", palegreen: "rgb(152, 251, 152)", paleturquoise: "rgb(175, 238, 238)", palevioletred: "rgb(219, 112, 147)", papayawhip: "rgb(255, 239, 213)", peachpuff: "rgb(255, 218, 185)", peru: "rgb(205, 133, 63)", pink: "rgb(255, 192, 203)", plum: "rgb(221, 160, 221)", powderblue: "rgb(176, 224, 230)", purple: "rgb(128, 0, 128)", rebeccapurple: "rgb(102, 51, 153)", red: "rgb(255, 0, 0)", rosybrown: "rgb(188, 143, 143)", royalblue: "rgb(65, 105, 225)", saddlebrown: "rgb(139, 69, 19)", salmon: "rgb(250, 128, 114)", sandybrown: "rgb(244, 164, 96)", seagreen: "rgb(46, 139, 87)", seashell: "rgb(255, 245, 238)", sienna: "rgb(160, 82, 45)", silver: "rgb(192, 192, 192)", skyblue: "rgb(135, 206, 235)", slateblue: "rgb(106, 90, 205)", slategray: "rgb(112, 128, 144)", slategrey: "rgb(112, 128, 144)", snow: "rgb(255, 250, 250)", springgreen: "rgb(0, 255, 127)", steelblue: "rgb(70, 130, 180)", tan: "rgb(210, 180, 140)", teal: "rgb(0, 128, 128)", thistle: "rgb(216, 191, 216)", tomato: "rgb(255, 99, 71)", turquoise: "rgb(64, 224, 208)", violet: "rgb(238, 130, 238)", wheat: "rgb(245, 222, 179)", white: "rgb(255, 255, 255)", whitesmoke: "rgb(245, 245, 245)", yellow: "rgb(255, 255, 0)", yellowgreen: "rgb(154, 205, 50)", transparent: "rgba(0, 0, 0, 0)" };
2
+
3
+ function isColorName (name) {
4
+ return !!color_names[name];
5
+ }
6
+
7
+ function getColorByName (name) {
8
+ return color_names[name];
9
+ }
10
+
11
+ export default {
12
+ isColorName,
13
+ getColorByName
14
+ }