ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

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: Do not use dark theme on a window
  • Programming in WLanguage
  • Overview
  • Specific events
  • WLanguage functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
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 allows you to:
  • automatically adapt to the device theme settings. The dark theme will automatically be used.
  • force the use of dark theme or light theme through programming.
Implementation

Dark theme management

To manage dark theme in one of your mobile applications:
  1. Open the project description window: on the "Project" tab, in the "Project" group, click "Description".
  2. In the "Style" tab, check "Allow switching to dark theme (automatically or manually via ChangeTheme)".
    Activating dark theme
  3. Validate.
Caution: After using this option, the application must be tested to make sure there are no UI errors.
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 if 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: Do not use 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. In 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: modification of system settings, changing the day/night time, activating/deactivating the battery saver, 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: modification of system settings, changing the day/night time, activating/deactivating the 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.
  • It the internal window is loaded when the system automatically changes the theme: modification of system settings, changing the day/night time, activating/deactivating the battery saver, etc.
Remark: These events are not run:
  • 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: 02/26/2024

Send a report | Local help