ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Drawing functions
  • HTML colors
  • RGB and code editor
  • Miscellaneous
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
Defines a color from its Red, Green and Blue components.
Example
// Color an area in light blue
dFill(10, 50, RGB(0, 255, 255))
Syntax
<Result> = RGB(<Red component> , <Green component> , <Blue component>)
<Result>: Integer
Color (24 bits) corresponding to the selected components. This color is the result of the following formula:
Color = 65536 * Blue Component + 256 * Green Component + Red Component.
WEBDEV - Browser code The color is returned in the format of a character string by the browser.
<Red component>: Integer (from 0 to 255)
Amount of red in the color.
<Green component>: Integer (from 0 to 255)
Amount of green in the color.
<Blue component>: Integer (from 0 to 255)
Amount of blue in the color.
Remarks
WEBDEV - Server codeAjax

HTML colors

In an HTML page, the colors are represented by a character string such as "#RRGGBB". RR, GG and BB represent the hexadecimal value of red, green and blue components.
The following code allows you to convert an HTML color into an RGB color:
nRGB is int
HTMLColor is string
// If the HTML color has no #
nRGB = RGB(Val(Left(HTMLColor, 2), "x"), ...
Val(Middle(HTMLColor, 3, 2), "x"), ...
Val(Right(HTMLColor, 2), "x"))
// If the HTML color contains #
nRGB = RGB(Val(Middle(HTMLColor, 2, 2), "x"), ...
Val(Middle(HTMLColor, 4, 2), "x"), ...
Val(Right(HTMLColor, 2), "x"))
You can also use RGBToHTML.

RGB and code editor

In the code editor, when the RGB function and its parameters are specified, a square appears automatically, showing the corresponding color:
A click in the colored square is used to open the color picker.
Color picker
If the color is modified, the modification is taken into account when validating the color picker.

Miscellaneous

  • The colors specified with RGB can be modified according to the capacity of the current screen mode (VGA, 32 colors, etc.).
  • Important: It is recommended to specify colors using the color constants defined in WLanguage (see the preset colors of WLanguage).
Component: wd290std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help