Skip to content
Corrado Canepari edited this page Apr 15, 2017 · 1 revision

In Mare.js you can change your background, stroke and fill color, using the functions Canvas.background(), Canvas.fill() and Canvas.stroke(). They all accept the same arguments, which can be formatted in different ways. Generally they accept three arguments: r, g and b, which are the quantity of red, green and blue that you want for that color.

But that's not all: if you want a grayscale value, just pass in 1 argument between 0 and 255, and MARE will sort it out from there.

You can also pass in an array of 3 numerical values between 0 and 255, so that it resembles an rgb value.

This is particularly good for non-arbitrary color assignments (say, for example, you wanted to have an array with some color values: you could just make it a 2d array and pass each element as a parameter to these functions).

There are two additional color related functions in Mare: noFill() and noStroke(), which remove the stroke and fill colors.

Clone this wiki locally