|
|
|
|
|
- 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
Dark theme on mobile devices
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.
Dark theme management To manage dark theme in one of your mobile applications: - Open the project description window. To do so, go to the "Project" tab, "Project" group, and click "Description".
- On the "Style" tab, check "Allow switching to dark theme (automatically or manually via ChangeTheme)".
- 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: - Start the application test:
The light theme is used by default. - Click the icon to switch to dark mode:
. - Window displayed with dark theme during test.
Special case: don't use the dark theme on a window To not apply dark theme on one of the windows of the application: - Open the window description (e.g. "Description", in the context menu).
- On the "Style" tab, check "Do not apply dark theme".
- Confirm changes and close the description window.
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:
| | ChangeTheme | Is used to change, through programming, the theme (dark or light) used by the mobile application. | GetTheme | Gets the current theme of a mobile application. | SysTheme | Returns the visual theme currently displayed on the current workstation. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|