Skip to main content
Participating Frequently
January 5, 2021
Question

'Random' color AI script with no adjacent colors the same

  • January 5, 2021
  • 1 reply
  • 1780 views

Could an Illustrator script like RandomSwatchesFill be modified to apply colors in such a way that no two colors from a group of swatches would be repeated in shapes that immediately border each other? I don't think this is truly random, but it's meant to make the distribution of colors feel more varied.

 

From what I've seen online, this would be an application of the four color theorem — or whatever number of colors are involved. For my own purposes, I would typically have more colors in a group of swatches — at least five or more.

 

Appreciate any insights and guidance!

This topic has been closed for replies.

1 reply

femkeblanco
Legend
January 6, 2021

Firstly, you'll need to define what "adjacent" means in terms of path items in Illustrator.  

midmodAuthor
Participating Frequently
January 10, 2021

By adjacent, I mean shapes that immediately border each other. In my case, the simplest example might be a checkerboard-like grid where colors are assigned so that no squares that border each other are colored the same. Thanks.

femkeblanco
Legend
January 10, 2021

It could be done using an adjacency matrix, but I'm not familiar with implementing graphs in JS.