aboutsummaryrefslogtreecommitdiff
path: root/docs/_book/gitbook/gitbook-plugin-pretty-term/terminal.js
blob: feecc248cadd3362717845a3394f755b1903e8b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"use strict";

const red = "#f15056";
const yellow = "#f9c536";
const green = "#39e949";

/**
 * Creates a circular window button.
 * @param fill The fill to create with.
 */
function createButton(fill) {
    let button = "<svg width='20' height='22'>";
    button += "<circle cx='8' cy='15' r='7' fill='" + fill + "'></circle>";
    button += "</svg>";

    return button;
}

/**
 * Exported members.
 */
module.exports = {
    /**
     * Create a terminal representation based on a body of text.
     * @param body The text/command to include in the terminal.
     */
    createTerm: function (body) {
        const termWindow = "<div class='top term'>" + createButton(yellow) + createButton(green) + createButton(red) + "</div>";
        const termBody = "<div class='term text bottom'><span class='normalUser'>&#36;</span>" + body + "</div>";

        return termWindow + termBody;
    }
}