<reponame>dmmdjs/dmmd.js
"use strict";

// Imports
const bColor = require("../utils/bColor.js");
const parse = require("../utils/parse.js");

/**
 * Creates a color from rgb value
 * @param {string} s String
 * @param {number} r Red
 * @param {number} g Green
 * @param {number} b Blue
 * @param {boolean} bg Background mode
 * @returns {string} 
 */
function rgb(s, r, g, b, bg) {
    let { r: pr, g: pg, b: pb } = parse("rgb", r, g, b);
    return bColor(`38;2;${pr};${pg};${pb}`, `48;2;${pr};${pg};${pb}`, s, bg);
};

// Exports
module.exports = rgb;