This project generates PNG images containing grids of 8x8 pixel patterns. It explores different permutations of patterns based on a modular arithmetic logic for colour dithering.
The tool creates a grid where each cell contains a unique 8x8 pattern. It renders a title and labels for the grid. The patterns are generated using a "ColourSource" algorithm that determines the color of each pixel based on its coordinates and a mode index.
To run the project, you need Go installed.
go run ./cmd/eightbyeight allYou can also run specific examples using subcommands:
grid: Generates the standard 8x8 pattern grid variants.floppy: Generates a stylized 90s aesthetic floppy disk to demonstrate drawing shapes.all: Generates both grid and floppy outputs.
Running the all or grid command will generate four files in the current directory:
out_bw.png: Classic Black on Whiteout_terminal.png: Green on Black (Terminal style)out_solarized.png: Solarized Light color schemeout_mixing.png: CGA Color Mixing
The output are PNG images with a title, a grid of patterns, and labels.
You can use ColourSource as a source image in draw.Draw to fill shapes with patterns, like drawing a stylized 90s aesthetic floppy disk:
import (
"image"
"image/color"
"image/draw"
"github.com/arran4/eightbyeight"
)
// ...
// Create a new image to draw into
dst := image.NewRGBA(image.Rect(0, 0, 256, 256))
// Create a ColourSource pattern for the plastic shell
plasticPattern := eightbyeight.NewColourSource(110, color.RGBA{0, 255, 255, 255}, color.RGBA{255, 0, 255, 255})
// Fill the destination image using the pattern
draw.Draw(dst, image.Rect(32, 32, 224, 224), plasticPattern, image.Point{}, draw.Over)Examples of generated patterns can be found in the exampledata/ directory.
Here are the generated outputs:
The project includes a GridBuilder to programmatically configure and generate these pattern grids.
import "github.com/arran4/eightbyeight"
// ...
builder := eightbyeight.NewGridBuilder().
WithTitle("My Custom Grid").
WithDimensions(10, 5). // 10 rows, 5 columns
WithColors([]color.Color{color.White, color.RGBA{255, 0, 0, 255}})
img := builder.Generate()
builder.Save("my_grid.bmp")This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.