From a4d56a39f36873270a655342c030eb8d4435f196 Mon Sep 17 00:00:00 2001 From: Albert Backenhof Date: Wed, 26 Jun 2019 14:56:36 +0200 Subject: [PATCH] ColorPicker picking correct color Issue: DEB-257 --- src/definition.js | 4 ++-- src/theme.js | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/definition.js b/src/definition.js index 7e2b1ad..367952c 100644 --- a/src/definition.js +++ b/src/definition.js @@ -28,8 +28,8 @@ define([], function () { component: "color-picker", dualOutput: true, defaultValue: { - index: 6, - color: null + index: -1, + color: "#4477aa" }, show: (a) => !a.color.auto }, diff --git a/src/theme.js b/src/theme.js index bfd1277..d13f8dc 100644 --- a/src/theme.js +++ b/src/theme.js @@ -47,7 +47,12 @@ class ThemeManager { static colorFromTheme(index) { if (typeof ThemeManager.qlikTheme != 'undefined') { - return ThemeManager.qlikTheme.properties.palettes.ui[0].colors[index - 1]; + const colors = ThemeManager.qlikTheme.properties.palettes.ui[0].colors; + let i = index; + if (colors[0] !== "none") { + i--; + } + return ThemeManager.qlikTheme.properties.palettes.ui[0].colors[i]; } else { return colors[index]; }