function makeColorComp(n) {
  return Math.floor(Math.max(0, Math.min(1, n)) * 255)
    .toString(16)
    .padStart(2, "0");
}
PLEASE NOTE: This file is currently imported in both the `../display/` and
             `../scripting_api/` folders, hence be EXTREMELY careful about
             introducing any dependencies here since that can lead to an
             unexpected/unnecessary size increase of the *built* files.