bopaMmala
→ color()Builds a colour value you can store and reuse.
bopaMmala(grey) | bopaMmala(r, g, b) | bopaMmala(r, g, b, alpha)bopaMmala draws nothing. It only builds a value — a stored colour you can hand to tlatsaMmala, mothaloMmala or bokamorago later. When one colour is used in several places, building it once is clearer than retyping three numbers each time.
It accepts several shapes: one number (grey), two numbers (grey and alpha), three numbers (r, g, b), four numbers (r, g, b, alpha), a CSS string such as '#ff8040', or an array of numbers. Given a colour that already exists it returns that same colour — it does not copy it.
Components outside the range are clamped: bopaMmala(300, -20, 0) is the same as bopaMmala(255, 0, 0).
For a colour picker, dirisaMoGo(picker, bopaMmala) reads a colour object. Set the picker with bolengJwaElemente(picker, "#238b9c").
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
r | palo | Red component 0–255, or the grey value when given alone. |
g (optional) | palo | Green component 0–255. |
b (optional) | palo | Blue component 0–255. |
alpha (optional) | palo | Opacity 0–255, where 255 is fully opaque. |
Examples
Section titled “Examples”tiro setaLoeto() {
thalaKanefase(400, 200);
bokamorago(220);
metlha bohibidutona = bopaMmala(230, 60, 90);
tlogelaMothalo();
tlatsaMmala(bohibidutona);
thalaSediko(130, 100, 90);
mothaloMmala(bohibidutona);
boketeMothalo(6);
tlogelaGoTlatsa();
thalaSediko(280, 100, 90);
}tiro setaLoeto() {
thalaKanefase(400, 200);
bokamorago(220);
tlogelaMothalo();
metlha mebala = [
bopaMmala(120),
bopaMmala(230, 60, 90),
bopaMmala(30, 80, 200, 120),
bopaMmala('#f0a030')
];
gopheta (diri i = 0; i < 4; i = i + 1) {
tlatsaMmala(mebala[i]);
thalaKhutlonne(i * 96 + 26, 60, 72, 72);
}
}