mirror of
https://git.ari.lt/ari.lt/ari.lt.git
synced 2025-02-04 17:49:24 +01:00
9d8f66c0f0
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
21 lines
415 B
JavaScript
21 lines
415 B
JavaScript
"use strict";
|
|
|
|
// Get padding
|
|
export function gp(str, pad) {
|
|
let ammount = pad - str.length;
|
|
|
|
if (ammount <= 0) return "";
|
|
|
|
return " ".repeat(ammount);
|
|
}
|
|
|
|
export function component_to_hex(c) {
|
|
let hex = c.toString(16);
|
|
return hex.length === 1 ? "0" + hex : hex;
|
|
}
|
|
|
|
export function rgb_to_hex(rgb) {
|
|
let hex = "";
|
|
rgb.forEach((item) => (hex += component_to_hex(item)));
|
|
return hex;
|
|
}
|