MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / onChange

Function onChange

src/dialogs/color.js:163–184  ·  view source on GitHub ↗
(c)

Source from the content-addressed store, hash-verified

161 }
162
163 function onChange(c) {
164 if (!c) return;
165
166 const alpha = c.rgba[3] < 1 ? true : false;
167 if (type === "hex") {
168 if (alpha) color = c.hex;
169 else color = c.hex.slice(0, -2);
170 } else if (type === "rgb") {
171 if (alpha) color = c.rgbaString;
172 else color = c.rgbString;
173 } else {
174 if (alpha) color = c.hslaString;
175 else color = c.hslString;
176 }
177
178 if (color) {
179 setTimeout(() => {
180 const $editor = box.get(".picker_editor");
181 if ($editor) $editor.style.backgroundColor = color;
182 }, 0);
183 }
184 }
185 });
186}
187

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected