ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WINDEV and WINDEV Mobile 2025 feature!
Help / WLanguage / WLanguage functions / Controls, pages and windows / Palette functions
  • Overview
  • How to use a color palette?
  • Associating a palette with a project
  • Associating a palette with a window
  • Remarks
  • Manipulating a color palette programmatically
  • Creating a color palette
  • Changing palettes dynamically
  • Creating a color palette based on the Windows theme
  • Icons, images, buttons and color palettes
  • Edit control
  • Image control
  • Radio Button / Check Box control
  • Button control
  • Table control
  • Slider control
  • Color palettes and WLanguage
  • WLanguage functions
  • Handling color palettes as JSON files
  • JSON file contents
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview
Starting with version 2025, WINDEV and WINDEV Mobile include color palettes for projects and windows.
A palette is a set of about a hundred colors.
Each color is intended for a specific use in the skin template, e.g., background, text, border, etc.
Each color is named according to its use: background-window, background-input, background-hover, background-button, etc.
A palette allocates a color to each "color name". For example, window-background = "#be677f" or button-background-color = RGB(190,103,127)
When a new palette is applied, all controls automatically switch to the new colors.
This mechanism lets you change the look of an application easily and dynamically.
Example:
A series of functions allow you to create and manipulate color palettes. A color palette is a JSON file that can be easily modified in WLanguage.
Improvements available in version 2025:
  • Ability to use icons, images and buttons (available from version 2025 Update 1). For more details, see Icons, images, buttons and color palettes.
  • Transparency (available from version 2025 Update 1). For more details, see Color palettes and WLanguage.
  • Color palette support in WINDEV and WINDEV Mobile skin templates. From version 2025 Update 2, the "Apollo" and "Eleven_Palette" skin templates are available.
Warning
Note: Starting with version 2025 Update 2, skin template palettes and palettes generated with PaletteGenerate use a new format. Palettes generated with a previous version can still be used, but are not compatible with those included in skin templates. These palettes can still be associated with the project.
How to use a color palette?
WINDEV skin templates include a color palette. This color palette is automatically linked to the project when the skin template is applied.
Several color palettes can be defined for a single project.

Associating a palette with a project

To associate a palette with a project:
  1. Open the project description window. To do so, go to the "Project" tab, "Project" group, and click "Description".
  2. Go to the "Style" tab, "Palettes" section to see the list of palettes associated with the project.
    You can:
    • Add a palette (). This button opens the palette selection window.
    • Delete a palette ().
    • Set the default palette (). This palette will be used by default in the editor and when the application is launched.
  3. Confirm.

Associating a palette with a window

You can associate a color palette with the entire project. However, you can also associate a color palette with a specific window. In this case, the window's color palette takes precedence over the project's color palette.
To associate a palette with a window:
  1. Open the window description ("Description" option in the context menu).
  2. In the "Style" tab, in "Skin template and palette", select the .wdpalette file in "Color palette".
  3. Confirm. The color palette is immediately associated with the window in the editor.

Remarks

  • To dynamically associate a color palette with a project or window, simply use PaletteChange.
  • Color palettes correspond to JSON files. This makes it possible to use the same color palette in multiple projects. You can also share color palettes via the Source Code Manager, for example.
Manipulating a color palette programmatically

Creating a color palette

You can create color palettes programmatically with PaletteGenerate. This function generates a color palette based on the specified base color. This palette corresponds to a variable of type Palette.
This color palette can then be saved as a file using PaletteSave.
Examples:
RedPalette is Palette
RedPalette = PaletteGenerate(0x7F67BE)
PaletteSave(RedPalette, "RedPalette.wdpalette")
GreenPalette is Palette
GreenPalette = PaletteGenerate(DarkGreen)
PaletteSave(GreenPalette, "GreenPalette.wdpalette")
The resulting .wdpalette file can then be associated with the project or window (in the editor or programmatically).
Note: PaletteGenerate can also be used to generate a palette using a main color and a secondary color.
  • If the secondary color is not specified, it is automatically defined to obtain the best effect.
  • If a secondary color is specified, it will be used in all the styles that use a secondary color (see JSON file contents).
Note: This feature is only available from WINDEV 2025 - Update 2.

Changing palettes dynamically

Color palettes can be changed dynamically, using PaletteChange. This change can be applied to the entire project or to a single window.
All the elements associated with a color defined in the project or window color palette are automatically updated.
PaletteChange is used to:
  • change the palette associated with a project or window using a variable of type Palette.
    Example:
    GreenPalette is Palette
    GreenPalette = PaletteGenerate(DarkGreen)
    PaletteSave(GreenPalette, "GreenPalette.wdpalette")
    PaletteChange(GreenPalette)
  • change the palette associated with a project using a "wdpalette" file. By default, accessible wdpalette files appear in the code suggestions.
    To change the current syntax in the code editor, press Ctrl + Up or Down arrow key.

Creating a color palette based on the Windows theme

In Windows, users can choose a main color for their UI. This is referred to as "accent color". This color is used to highlight different UI elements.
You can use the accent color to create a color palette.
  1. Use SysWindowsAccentColor to get the Windows accent color.
  2. Generate the corresponding color palette (PaletteGenerate).
  3. Change the palette used (PaletteChange).
For example:
WindowsPalette is Palette

WindowsPalette = PaletteGenerate(SysWindowsAccentColor())
PaletteSave(WindowsPalette, "WindowsPalette.wdpalette")
PaletteChange(WindowsPalette)
Tip: To determine if the user changes the Windows accent color while the application is running, use the Windows EVT_THEME event (with the Event function).
// Listen for the event to generate the palette adapted to the system
CONSTANT
	EVT_THEME = 0x001A
END

Event(_ChangeAccentColor, "WIN_CountryStats", EVT_THEME)

INTERNAL PROCEDURE _ChangeAccentColor(nWindowsMessage int<useful>, ...
	nWParam int<useful>, nLParam int<useful>)
		// Change palette
		WindowsPalette is Palette
		WindowsPalette = PaletteGenerate(SysWindowsAccentColor())
		PaletteSave(WindowsPalette, "WindowsPalette.wdpalette")
		PaletteChange(WindowsPalette)
END
Icons, images, buttons and color palettes
By default, when your project is associated with a skin template, all the elements of that skin template (controls, icons, etc.) are associated with a color palette. These elements will automatically adapt if a new palette is applied.
If your project contains icons, images, etc., when you apply a new palette, these elements must adapt to the color used in the palette. This is particularly important for monochrome icons and images.
The following section explains how to configure specific elements.
To achieve this, you can use monochrome images/icons, then define the palette color to be used for these images. This way, colors will follow any changes made to the palette.
Monochrome image mode is supported for most standard controls:
Note: Images in monochrome mode are supported from version 2025 Update 1.

Edit control

An Edit control can display buttons to the left or right of the input field. You can specify whether the image should be forced to monochrome. If so, you can also define whether it should use to the text color or style color.
If you select text color, the color of the image will match the color of the text in the Edit control.
If you select style color, the color of the image will match to the color defined in "Force monochrome mode".

Image control

In an Image control, you can force the image to monochrome mode:
  1. Open the control description window.
  2. In the "General" tab, check "Monochrome".
  3. In the "Style" tab, select "Force to monochrome mode" and specify the palette color to be used.
  4. Confirm.

Radio Button / Check Box control

In a Radio Button control or Check Box control, you can use monochrome mode for checkmarks and check boxes.
  1. Open the control description window.
  2. In the "Style" tab, expand "Element", select "Checkmark border" (or "Checkmark"), and check "Adapt image with the colors defined in this window". You can then select the desired palette color.
  3. Confirm.

Button control

A Button control can contain one or more images. To force images in the control to monochrome mode using a specific color:
  1. Open the control description window.
  2. In the "Style" tab, expand "Element", select "Force to monochrome mode" and choose the desired color. You can use a color from a color palette.
  3. Confirm.

Table control

Table controls use multiple images: filter and sort icons, etc. To force images in the control to monochrome mode using a specific color:
  1. Open the control description window.
  2. In the "Style" tab, expand "Element", select "Force to monochrome mode" and choose the desired color. You can use a color from a color palette.
  3. Confirm.

Slider control

In a Slider control, you can force the cursor to monochrome mode.
  1. Open the control description window.
  2. In the "Style" tab, expand "Element", select "Cursor", and check "Adapt image with the colors defined in this window". You can then select the desired palette color.
  3. Confirm.
Color palettes and WLanguage
Palettes are JSON files that can be manipulated:
  • using specific WLanguage functions,
  • using functions for JSON variables.

WLanguage functions

WLanguage allows you to manipulate color palettes:
  • via the Palette type.
  • via different WLanguage functions:
    New in version 2025
    PaletteChange
    Changes the palette used by the project or by a window.
    New in version 2025
    PaletteGenerate
    Generates a palette from a base color.
    New in version 2025
    PaletteGet
    Gets the palette currently used by the project or window.
    New in version 2025
    PaletteLoad
    Loads a palette from a .wdpalette file.
    New in version 2025
    PaletteSave
    Saves a palette to a file.

Handling color palettes as JSON files

A color palette corresponds to a JSON file containing a description of the different colors in the palette.
JSON file example:
// Apollo_Palette
// version 0.1
// Light theme
{
   // primary / theme color
   "primary":"#344BF9",
   "primary_text":"#FFFFFF",
   "primary_border":"=primary",
   "primary_red_background":"#DB2635",

   // UI base color
   "secondary":"#6273FF",
   "text":"#000000",
   "border":"#C0C7DE",

   // backgrounds    
   "window_background":"#EEF0F8",
   "container_background":"#FFFFFF",
   "input_background":"#EEF0F8",

   // Button effects
   "pressed_mix":"#00000014",
   "hovered_mix":"#0000000A",
   "grayed_mix":"#FFFFFF73",

   // Focus outline
   "focus_outline":"=BGOK(window_background)",

   // Other effects
   "accent_background":"=MIX(window_background,text,10)",
   "text_light":"=MIX(input_background,text,45)",
   "border_strong":"=MIX(border,text,30)",
   "primary_dark":"=MIX(primary,#000000,60)",

   // selection bar and hover    
   "selected_background":"=MIX(primary,#FFFFFF,85)",
   "selected_text":"=TEXTOK(selected_background)",
   "hovered_background":"=MIX(window_background,primary,15)",
   
   // other texts
   "windows_title_text":"#5F6368",
   "title_text":"=text",
   "subtitle_text":"=title_text",
   "section_text":"=MIX(primary,text,30)",
   "red_text":"=primary_red_background",
   "gray_text":"#808080", "link_text":"=primary",

   // negatif
   "negative_text":"=TEXTOK(text)",
   "negative_background":"=BGOK(negative_text)",

   // Grayed out
   "disabled_text":"#A0A0A0",
"disabled_bkg_text":"=window_background",

// Series
"graph_series_1": "=primary",
"graph_series_2": "=SERIES(2)",
"graph_series_3": "=SERIES(3)",
"graph_series_4": "=SERIES(4)",
"graph_series_5": "=SERIES(5)",
"graph_series_6": "=SERIES(6)",
"graph_series_7": "=SERIES(7)",
"graph_series_8": "=SERIES(8)",
"graph_series_9": "=SERIES(9)",
"graph_series_10": "=SERIES(10)",
"graph_series_11": "=SERIES(11)",
}
You can edit this JSON file and add your own colors.
In this file, you can indicate that a color is derived from another named color, and apply a filter to it. You can change the lightness, hue, etc. This makes it possible to create cascading colors.
For example:
  • To add a custom color to the "WD_Eco.palette" file:
    MyPalette is Palette
    ...
    MyPalette["CustomColor"] = RGB(255,15,21)
  • To adjust the opacity of one of the colors of the palette, you can directly modify the color using the Opacity property:
    MyPalette is Palette
    ...
    MyPalette["CustomColor"] = RGB(255,15,21)
    MyPalette["CustomColor"].Opacity = 127
    Transparency is defined by an alpha channel.
    After saving and loading the palette, the opacity (transparency) value will be applied to "CustomColor". It will then be available in the list of colors of the different controls. A specific color preview shows that the color supports transparency.

    Attention: Opacity is only supported from version 2025 Update 1.

JSON file contents

Palettes use the colors and functions listed below.
Colors
  • Primary colors
    • Primary: Main accent color. Determines the overall look of the UI.
    • Primary Text: Text color meant to be visible on a background that uses the primary color.
    • Primary Border: Main color for control borders.
    • Primary Red Background: Contrasting red background for primary_text.
  • Secondary colors and text
    • Secondary: Secondary theme color.
    • Text: Main text color, readable on the following backgrounds: secondary, windows_background, container_background.
    • Border: Border color to distinguish controls on secondary backgrounds.
  • Background colors
    • Window Background: Window background.
    • Container Background: Background of container controls (cell, tab, supercontrol, etc.).
    • Input Background: Background for Edit and Combo Box controls.
    Tip: These colors can also be used to alternate the colors of odd and even rows in Table and Looper controls.
  • Interaction effects
    • Pressed Mix: Mixed color for the pressed state.
    • Hovered Mix: Mixed color for the hovered state.
    • Grayed Mix: Mixed color for the grayed out effect.
  • Other effects
    • Focus Outline: Focus outline color.
    • Accent Background: Background for progress bars or indicators.
    • Text Light: Lighter text color for information text.
    • Border Strong: Stronger border color.
    • Primary Light: Lighter version of primary.
    • Primary Dark: Darker version of primary.
  • Selection and hover bars
    • Selected Background: Selection bar background.
    • Selected Text: Text readable on selected_background.
    • Hovered Background: Hovered background.
  • Other texts
    • Windows Title Text: Window title text.
    • Title Text: Section title color.
    • Subtitle Text: Subtitle color.
    • Section Text: Section label color.
    • Red Text: Red text readable on windows_background and container_background.
    • Gray Text: Gray text readable on windows_background and container_background.
    • Link Text: Color for buttons and links.
  • Negative
    • Negative Text: Text in negative mode.
    • Negative Background: Background in negative mode.
  • Grayed out
    • Disabled Text: Grayed-out text.
    • Disabled Background Text: Grayed-out text background (raised effect).
  • Series colors:
    • graph_series_N: Where N is a number from 1 to 11 (see example above).
Palette functions
Palette functions can be used to achieve specific effects. The following functions are supported:
  • Referencing a color from the palette
    You can directly reference another color in the palette:
    "link_text":"=primary"
  • MIX: Mixes color1 and color2 according to the specified percentage.
    Syntax:
    MIX(<color1>, <color2>, <color2 percentage>)
  • MIXGRAY: Has the same effect as MIX, then converts the result to grayscale (extracts the luminosity of the resulting color).
    Syntax:
    MIXGRAY(<color1>, <color2>, <color2 percentage>)
  • TEXTOK: Returns white or black to ensure optimum text readability against <backgroundcolor>.
    Syntax:
    TEXTOK(<backgroundcolor>)
  • BGOK: Returns a white or black background to ensure optimal readability of a text that uses <textcolor>.
    Syntax:
    BGOK(<textcolor>)
  • SERIES: Returns the series color corresponding to the given index (hard-coded preset color).
    Syntax:
    SERIES(<index 0 to 10>)
  • IFLUMLT: Returns <colorIfLighter> or <colorIfDarker> depending on the luminance of <color1> compared to the <nLuminance> threshold.
    Syntax:
    IFLUMLT(<color1>, <nLuminance>, <colorIfLighter>, <colorIfDarker>)
Note: If a color manipulated by one of the functions is modified, the color that uses that function is also modified.
Minimum version required
  • Version 2025
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/12/2025

Send a report | Local help