ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / Developing an application or website / WINDEV Mobile specific features
  • Overview
  • Implementation
  • Dark theme management
  • Testing an application that uses dark theme in the simulator
  • Special case: don't use the dark theme on a window
  • Programming in WLanguage
  • Overview
  • Specific events
  • WLanguage functions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview
The latest versions of mobile OSs allow you to switch applications to a dark theme to reduce battery consumption or to make the device easier to use in a low-light environment.
WINDEV Mobile allows you to use dark theme in your mobile applications. It is possible to:
  • automatically adapt to the device theme settings. The dark theme will automatically be used.
  • force the use of dark theme or light theme programmatically.
Implementation

Dark theme management

To manage dark theme in one of your mobile applications:
  1. Open the project description window. To do so, go to the "Project" tab, "Project" group, and click "Description".
  2. On the "Style" tab, check "Allow switching to dark theme (automatically or manually via ChangeTheme)".
    Activating dark theme
  3. Validate.
Caution: After using this option, it is necessary to test the application to ensure that the UI is correct..
Remarks:
  • The project is associated with a single skin template. This skin template corresponds to the light theme. Windows are always edited in light theme. The skin template used for the dark theme is BlackStellar.
  • Tip: Use skin template styles where possible. If colors or images are fixed through programming, use the optional events "Application of light/dark theme" to use a specific color according to the theme used.

Testing an application that uses dark theme in the simulator

When dark theme is enabled in a WINDEV Mobile project, the simulator offers an additional option () allowing to switch the application from one theme to another.
Example:
  1. Start the application test:
    Window test with light theme

    The light theme is used by default.
  2. Click the icon to switch to dark mode: Switch to dark theme.
  3. Window displayed with dark theme during test.
    Window test with dark theme

Special case: don't use the dark theme on a window

To not apply dark theme on one of the windows of the application:
  1. Open the window description (e.g. "Description", in the context menu).
  2. On the "Style" tab, check "Do not apply dark theme".
  3. Confirm changes and close the description window.
Programming in WLanguage

Overview

After enabling dark mode management, WINDEV Mobile proposes:
  • "Application of light/dark theme", a new event to customize the switch to dark mode if necessary.
  • WLanguage functions to find out, modify and retrieve the theme used.

Specific events

When dark theme management is enabled, the "Application of light/dark theme" event becomes available for the project, for windows and internal windows.
The event "Application of light/dark theme" of the project is run in the following cases:
  • When the application starts (after the "Initialization" event of the project).
  • When the theme is changed in the code with ChangeTheme only if the withCodeExecution constant has been specified.
  • When the system automatically changes the theme. This may be related to changes in the system settings, day/night time, battery saver mode, etc.
The event "Application of light/dark theme" of the windows is an optional event. This event is run in the following cases:
  • When the window is opened, after the "Global declarations" event and before the initialization events of the window controls.
  • If the window is open when the theme is changed with ChangeTheme, only if the withCodeExecution constant has been specified.
  • If the window is open when the system automatically changes the theme: modifying system parameters, changing day/night time, activating/deactivating battery saver, etc.
The event "Application of light/dark theme" of the internal windows is an optional event. This event is run in the following cases:
  • When loading the internal window, after the "Global declarations" event and before the initialization events of the internal window controls.
  • If the internal window is loaded when changing the theme through programming with ChangeTheme, only if the withCodeExecution constant has been specified.
  • If the internal window is loaded when the system automatically changes theme: changing system parameters, changing day/night time, activating/deactivating battery saver, etc.
Note: These events are not executed:
  • if the application does not support dark theme.
  • if the window ignores dark theme.

WLanguage functions

The following WLanguage functions are used to manage the dark theme:
ChangeThemeIs used to change, through programming, the theme (dark or light) used by the mobile application.
GetThemeGets the current theme of a mobile application.
SysThemeReturns the visual theme currently displayed on the current workstation.
Minimum version required
  • Version 25
Comments
Click [Add] to post a comment

Last update: 09/21/2024

Send a report | Local help