Qlikview allows customization of the basic eighteen color palette at the Document or User level through property dialogs. For color control beyond the palette, many developers utilize variables.
The set of colors and variables I use for a document or project I refer to as a “color theme”. I’ve built up several themes over the years as well as generously borrowed theme ideas from others.
Wait! Isn’t there an single ideal theme we should all use? No. I find a regular need to update or craft new themes in response to client requirements, the latest understanding of best practices, and frankly, fashion.
In V9 of the Qlikview Components (Qvc) scripting library I’ve added a color theming routine. The SUB Qvc.ColorTheme(themeFile) uses an external file to define color variables. The variables are then referenced by chart objects to implement the theme.
Implementing a color theme with Qvc requires two actions; assigning colors to the variables and assigning the variables to sheet objects.
Qvv.ColorTheme takes it’s input from an xlsx or xlsm file that contains at least these two columns:
ColorVariable — A variable name. Any variable name matching the pattern Qvc.Color.v.* will be kept by the routine. Other variable names may be used as intermediate names to compute final values.
ColorValue — a valid Qlikview script color function such as rgb(0,0,0) or white().
A sample theme is provided with the Qvc distribution in etc\Colors\ColorSample1.xlsm. This sample file also offers the option to use the Excel color picker to assign a color.
In the sample file you’ll see:
Specific colors defined early in the file that are referenced later:
“Logical” color variables that define “good” and “bad” things.
“Object Attributes” that define items like the chart 18 color palette.
After including the qvc.qvs runtime we can add the script statement
and then reload. Great! Now our document contains a bunch of Qvc.Color.v.* variables with proper color values. How do we tell our object color properties to use those variables? Do we have to type them in each object? No.
Also included with the Qvc distribution is etc\QvcColor.qvt, a QV theme file that assigns the Qvc.Color.* variable names to object definition. You apply this qvt theme to your Document as you would any other qvt theme, using the “Layout, Apply Theme” button. Apply Theme is available at the Document level (Settings, Document Properties) or at the individual object level on the layout tab.
After pressing “Apply Theme”, select and apply the etc\QvcColors.qvt file. After Apply, you’ll see that color properties in the object (or all objects if done in Document Settings) reference the Qvc.Color.* properties.
Changes to the theme file will be reflected in the object colors after reload.
You may also assign the QvcColor.qvt theme as the default document theme for new objects in “Settings, Document Properties, Presentation”. This is particularly useful if you are starting a new document.
If you develop a color theme you find useful, please let me know on the QVC User Forum and I’ll include your theme as a sample in a future release.
I’m now teaching a 3 hour on-line course on using the QVC library at http://q-on.bi/. The next course is scheduled for 7 Nov. See http://q-on.bi/courses/qlikview-components-scripting-library/ for details.