How Can We Help?
< All Topics
Print

$rgb

Calculates the integer value of a RGB color by providing the corresponding Red, Green and Blue values.

Syntax

$rgb(Red Value, Green Value, Blue Value)

where

Red Valuean integer or an expression that evaluates to an integer between 0 and 255
Green Valuean integer or an expression that evaluates to an integer between 0 and 255
Blue Valuean integer or an expression that evaluates to an integer between 0 and 255

Return Value

A positive integer representing a RGB value.

Comments

Although the value returned is an integer, it inherently represents the internal representation of a given RGB combination based on the following example:

out $rgb(255, 0, 0)
16711680

In fact, this value internally means 0x00ff0000, accepted by any HTML syntax.

The great advantage of the function $rgb is to make available all RGB colors within Zim applications because, tradionally, Zim was only able to deal with very specific colors like Red, Light Blue, etc.

Example

To dynamically set a specific color to a particular form field:

$form set (fillcolor rgb $rgb(230, 40, 80)) MyForm.MyFormField

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

pt_BRPortuguese