🏡 random_palette.nim

A random 8-color palette with pixie

import
  std / random, pixie

proc randomColor(): ColorRGB =
  rgb(rand(255).uint8, rand(255).uint8, rand(255).uint8)

const
  radius = 32
  space = 16
let image = newImage(8 * (radius * 2 + space), radius * 2)
var
  center = vec2(radius, radius)
  color: ColorRGB
  palette: seq[ColorRGB]
for _ in 1 .. 8:
  color = randomColor()
  palette.add color
  image.fillCircle(center, radius, color)
  center += vec2(2 * radius + space, 0)
image.writeFile("palette.png")
for c in palette:
  echo $c
(r: 149, g: 233, b: 42)
(r: 252, g: 246, b: 138)
(r: 49, g: 8, b: 132)
(r: 185, g: 254, b: 135)
(r: 112, g: 215, b: 81)
(r: 242, g: 132, b: 65)
(r: 254, g: 71, b: 180)
(r: 235, g: 107, b: 204)