/**
 *
 * @param {CanvasRenderingContext2D} ctx
 * @param {string} text
 * @param {number} x
 * @param {number} y
 * @param {string} [color] CSS color
 * @param {number} [fontSize] in pixels
 * @param {string} [outline] CSS color
 */
export function canvas2d_draw_label({
                                        ctx,
                                        text,
                                        x,
                                        y,
                                        color = 'white',
                                        fontSize = 10,
                                        outline = `rgba(0, 0, 0, 0.5)`
                                    }) {

    ctx.fillStyle = color;
    ctx.font = `${Math.ceil(fontSize)}px Tahoma`;

    ctx.strokeStyle = outline;
    ctx.lineWidth = 2;
    ctx.strokeText(text, x, y);
    ctx.fillText(text, x, y);
}
