]> git.r.bdr.sh - rbdr/tomato-sauce/blame_incremental - lib/screens/random.js
Update code and dpendencies
[rbdr/tomato-sauce] / lib / screens / random.js
... / ...
CommitLineData
1'use strict';
2
3/**
4 * Draws random colors
5 *
6 * @function RandomScreen
7 * @implements IScreen
8 */
9module.exports = function (modulation, width, height, renderer) {
10
11 let response = '';
12
13 for (let i = 0; i < height; ++i) {
14 for (let j = 0; j < width; ++j) {
15 const red = Math.floor(Math.random() * 255);
16 const blue = Math.floor(Math.random() * 255);
17 const green = Math.floor(Math.random() * 255);
18
19 response = response + renderer(red, blue, green);
20 response = response + ' ';
21 }
22
23 if (i < height - 1) {
24 response = response + '\n';
25 }
26 }
27
28 return response;
29};