Skip to content

Commit fe3e953

Browse files
authored
Merge pull request #10 from nikalun/feature/DXTF-5707-ota-fe-make-colorpicker-show-color
[DXTF-5707] Make colorpicker show color which doesnt exist in palette
2 parents c0f8437 + 7068b89 commit fe3e953

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/js/colorpicker.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,6 @@ var Colorpicker = (function(DX) {
255255

256256
var dataForDropDown = prepareDataForDropDown(groups);
257257
dropDown.setDataList(dataForDropDown);
258-
setColor(allColors[0]);
259-
260258
}
261259

262260
/**
@@ -348,13 +346,19 @@ var Colorpicker = (function(DX) {
348346
color = color.toLowerCase();
349347
var index = allColors.indexOf(color);
350348
if (index < 0) {
351-
index = 0;
349+
setColorNotFromThePalette(color);
350+
return;
352351
}
353352
valueElement.style.backgroundColor = allColors[index];
354353
dropDown.setSelectedIndex(index);
355354
input.value = allColors[index];
356355
}
357356

357+
function setColorNotFromThePalette(color) {
358+
valueElement.style.backgroundColor = color;
359+
input.value = color;
360+
}
361+
358362
init();
359363

360364
/**

0 commit comments

Comments
 (0)