Skip to content

heksa

Converts a number into hex text — base 16.

In base 16 the digits 0–9 carry on with the letters A–F, so 10 is "A" and 15 is "F". It is how web colours are written, as in #FF8000.

By default heksa returns eight digits padded with leading zeros: heksa(20) is "00000014". For something shorter, pass a second number: heksa(20, 2) is "14".

Given a list, it returns a list of strings. The function that goes the other way is paloYaHeksa.

heksa(boleng, dinomoro)
NameTypeDescription
bolengpaloThe number to convert. A list of numbers is also accepted.
dinomoro (optional)paloHow many hex digits to show. Defaults to eight when omitted.
A colour written in hex
tiro setaLoeto() {
  thalaKanefase(400, 400);
  bokamorago(220);
  tlogelaMothalo();

  diri khibidu = 255;
  diri tala = 128;

  kwala(heksa(khibidu, 2));
  kwala(heksa(tala, 2));
  kwala(heksa(khibidu));

  tlatsaMmala(khibidu, tala, 0);
  thalaKhutlonne(100, 150, 200, 100);
}

paloYaHeksa, letshwao, mokwalo