0.0.4 • Published 8 months ago

git-hash-art v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

git-hash-art

Generate beautiful, deterministic abstract art from git commit hashes. Perfect for creating unique visual representations of your project's commits, generating placeholder images, or creating artistic wallpapers.

Features

  • Generate consistent, deterministic abstract art from any git hash
  • Configurable canvas sizes and output formats
  • Built-in presets for common social media and device sizes
  • Harmonious color schemes based on hash values
  • Grid-based composition system for balanced layouts
  • Multiple shape types and layering effects
  • Customizable output settings

Installation

npm install git-hash-art

Basic Usage

import { generateImageFromHash } from 'git-hash-art';

// Generate art from a git hash with default settings
const gitHash = '46192e59d42f741c761cbea79462a8b3815dd905';
generateImageFromHash(gitHash);

Advanced Usage

// Custom configuration
const config = {
  width: 1920,
  height: 1080,
  gridSize: 6,
  layers: 7,
  shapesPerLayer: 30,
  minShapeSize: 20,
  maxShapeSize: 180,
  baseOpacity: 0.6,
  opacityReduction: 0.1
};

generateImageFromHash(gitHash, config);

Configuration Options

OptionTypeDefaultDescription
widthnumber1024Canvas width in pixels
heightnumber1024Canvas height in pixels
gridSizenumber4Number of grid cells (gridSize x gridSize)
layersnumber5Number of layers to generate
shapesPerLayernumber-Base number of shapes per layer (defaults to grid cells * 1.5)
minShapeSizenumber20Minimum shape size
maxShapeSizenumber180Maximum shape size
baseOpacitynumber0.6Starting opacity for first layer
opacityReductionnumber0.1How much to reduce opacity per layer

Preset Sizes

The package includes several preset configurations for common use cases:

import { PRESETS } from 'git-hash-art-generator';

// Generate an Instagram-sized image
generateImageFromHash(gitHash, PRESETS['instagram'].config);

// Generate a mobile wallpaper
generateImageFromHash(gitHash, PRESETS['phone-wallpaper'].config);

Available presets include:

  • Standard (1024x1024)
  • Banner (1920x480)
  • Ultrawide (3440x1440)
  • Instagram (1080x1080)
  • Instagram Story (1080x1920)
  • Twitter Header (1500x500)
  • LinkedIn Banner (1584x396)
  • Phone Wallpaper (1170x2532)
  • Tablet Wallpaper (2048x2732)
  • Print sizes (A4/A3 at 300 DPI)

CLI Usage

The package includes a command-line interface:

# Generate with default settings
npx git-hash-art current

# Generate from specific hash
npx git-hash-art generate <hash>

# Generate with custom size
npx git-hash-art generate <hash> --width 1920 --height 1080

Integration Examples

GitHub Actions

name: Generate Commit Art
on: [push]
jobs:
  generate-art:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
      - run: npm install git-hash-art-generator
      - run: npx git-hash-art current --output artwork/

Git Hooks

#!/bin/sh
# .git/hooks/post-commit

hash=$(git rev-parse HEAD)
npx git-hash-art generate $hash --output .git/artwork/

Contributing

Contributions are welcome! Please see our Contributing Guidelines for more details.

License

MIT License - see LICENSE for details.

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago