Using The Palette

The “Democratic Palette” contract provides 12 colours to use. What happens if griefers set the palette to 12 colours that are almost exactly the same? What happens if you need colours with more or less contrast or hue difference? What if you need more or fewer colours? The only guarantee about them is that they will all be different by at least one point.

To fetch the current palette:

```var withPalette = function (callback) {
var democratic_palette = Democratic_palette.deployed();
var requests = [];
for (var i = 0; i < 12; i++) { requests.push(democratic_palette.palette(i) .then(function(colour) { return {index: i, colour: colour}; }); } Promise.all(requests).then(colours => {
var palette = [];
colours.foreach(function(colour) {
palette[colour.index] = colour.colour;
});
callback(palette);
});
}
};
```

We can then get from one to twelve colours simply by truncating the array, e.g.:

```var my_3_colours = palette.slice(0, 3);
```

Or we can get the bluest colour using a simple comparison:

```var bluest_colour = palette.sort(function(a, b){
return a.blue - b.blue;
})[0];
```

Or we can take the average of the colours, which will probably represent the triumph of statistics over aesthetics.

More complex orderings and comparisons can be achieved using a colour library that allows us to work in HSV space. In particular we can use a version of the algorithm that Harold Cohen used for one version of his program AARON’s colouring system (see figure 15 here), effectively ordering the colours in the palette by brightness then distributing them evenly across a brightness range sufficient to ensure that each is distinct from its neighbours.

What about more colours, or more structured relationships between colours where we are concerned that those relationships may not be present in the colours voted for within the palette? In the first case we can interpolate between existing colours, producing colours in-between those in the palette. Or in both cases we can use colour theory to produce related colours: complements, split-complements, tints and tones, etc. There are libraries to do this in Javascript, for example color-scheme-js will produce entire colour schemes from individual colours.

“Democratic Palette” is intended to provide the equivalent of an aesthetic or colour symbology backed by Blockchain democracy rather than any other ideology or iconography, so it is intended to be easy and significant to us it as-is. But it’s also possible to maintain a direct relationship to the palette while using colours that are not themselves present within it.

Democratic Palette

Democratic Palette, 2016, Ethereum Contract and HTML/JavaScript/CSS.

A palette of twelve colours that anyone can set on the Ethereum blockchain. Every vote for every colour is tracked and the top twelve make up the palette.

The images above show various different visual applications of the palette and the use of the GUI to vote for a colour (the GUI appears if you click in the window displaying the canvas).

Note that the above images are from test runs. The current palette on the live Ethereum blockchain looks like this, ready for people to vote on:

You can download the interface code here, it’s in the dapps/democratic-palette directory.

To use it you’ll need an Ethereum node running locally, and to vote for colours you’ll need some Ether.

Blank Canvas

Blank Canvas, 2016, Ethereum Contract and HTML/JavaScript/CSS.

A blank canvas that anyone can set the colour of on the Ethereum blockchain.

The images above show use of the GUI to change the colour (the GUI appears if you click in the window displaying the canvas).

You can download the interface code here, it’s in the dapps/blank-canvas directory.

To use it you’ll need an Ethereum node running locally, and to change the colour you’ll need some Ether.