Skip to content

Modern geometric logo generator in Rust - creates unique hexagonal designs with minimal configuration.

License

Notifications You must be signed in to change notification settings

utensils/hexalith

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hexalith

Modern geometric logo generator in Rust - creates unique hexagonal designs with minimal configuration.

Overview

Hexalith (HexLogoGen) is a command-line tool that generates random, geometric logos based on triangles within a hexagonal grid. The logos are visually distinctive, minimal, and ideal for open-source projects, microservices, or any application that needs a clean, modern identity.

Features

  • Hexagonal Grid Generation: Creates a hexagonal grid divided into equilateral triangular cells
  • Shape Creation: Generates polygon shapes made up of connected triangles that grow from the center outward
  • Equiangular Triangles: All triangles have equal 60-degree angles for clean, balanced designs
  • Connected Edges: All triangles share edges with adjacent triangles for cohesive patterns
  • Center-Out Growth: All shapes grow from the center outward for balanced, harmonious designs
  • Angular Style: Default mode creates logos similar to the original hexagonal logo generator
  • Classic Mode: Fixed 24-triangle layout with 2 overlapping shapes for a distinctive geometric style
  • Shape Overlapping: By default, shapes overlap with color blending at intersections for richer designs
  • Multiple Color Themes: Choose from various color themes including Classic (default), Google, Blues, Greens, Reds, Purples, and Rainbow
  • SVG and PNG Output: Generates clean, optimized SVG files or PNG images (PNG is default)
  • Clipboard Support: Copy logos directly to clipboard without saving files (CLI and web)
  • Deterministic Mode: Generate the same logo consistently with the same seed or UUID
  • Customization Options: Customize themes, opacity, and grid density
  • Web Interface: Includes a built-in web interface with PNG and SVG download options

Installation

Using Cargo

cargo install hexalith

Using Nix Flakes (No Installation Required)

You can run Hexalith directly without installation using Nix:

# Run the CLI tool to generate a logo
nix run github:utensils/hexalith

# Run with specific options
nix run github:utensils/hexalith -- --theme blues --verbose logo.svg

# Run the web interface
nix run github:utensils/hexalith#web

Usage

Command Line Interface

Usage: hexalith [OPTIONS] [OUTPUT]

Arguments:
  [OUTPUT]  Output file path [default: logo.png]

Options:
  -s, --seed <SEED>            Seed for deterministic generation
  -u, --uuid <UUID>            UUID for deterministic generation (overrides seed)
  -t, --theme <THEME>          Color theme [default: classic] [possible values: classic, google, blues, greens, reds, purples, rainbow]
  -n, --shapes <SHAPES>        Number of shapes to generate [default: 4]
  -g, --grid-size <GRID_SIZE>  Grid density (2-8) [default: 4]
  -o, --opacity <OPACITY>      Shape opacity [default: 0.8]
  --overlap                    Allow shapes to overlap with blended colors [default: true]
  --unique-shapes              Generate unique shapes that don't necessarily grow from center
  -w, --width <WIDTH>          Output width in pixels (PNG only) [default: 512]
  -H, --height <HEIGHT>        Output height in pixels (PNG only) [default: 512]
  -f, --format <FORMAT>        Output format [default: png] [possible values: svg, png]
  -c, --copy                   Copy to clipboard instead of saving to file
  -v, --verbose                Enable verbose output
      --classic                Use classic style generation with fixed triangle layout
  -h, --help                   Print help
  -V, --version                Print version

Examples

Generate a random logo (PNG by default):

hexalith

Generate a logo in SVG format:

hexalith -f svg my-logo.svg

Generate a deterministic logo using a seed:

hexalith --seed 12345 my-logo.png

Generate a classic style logo:

hexalith --classic logo.png

Generate a PNG with custom dimensions:

hexalith --width 800 --height 800 my-logo.png

Generate a logo with custom parameters:

hexalith --grid-size 8 --shapes 5 --opacity 0.7 --verbose logo.svg

Copy logo to clipboard instead of saving:

hexalith --copy --format svg

Generate a logo with a specific color theme:

hexalith --theme blues --seed 42 logo.svg

Generate a logo without overlapping shapes:

hexalith --no-overlap --seed 42 logo.svg

Generate a classic style logo:

hexalith --classic --seed 42 logo.svg

Generate a classic logo with different theme:

hexalith --classic --theme google classic-logo.svg

Try different color themes:

hexalith --theme google logo_google.svg
hexalith --theme rainbow logo_rainbow.svg
hexalith --theme greens logo_green.svg
hexalith --theme purples logo_purple.svg

Use a UUID for deterministic generation:

hexalith --uuid f47ac10b-58cc-4372-a567-0e02b2c3d479 logo.svg

Copy logo directly to clipboard (no file created):

# Copy as PNG (default)
hexalith --copy

# Copy as SVG
hexalith --copy --format svg

# Copy with specific parameters
hexalith --copy --theme rainbow --shapes 6

Generate classic style logo with fixed triangle layout:

# Classic mode uses exactly 2 shapes with 6-10 triangles each
hexalith --classic --seed 42 logo.svg

# Classic mode works well with smaller grid sizes
hexalith --classic --grid-size 2 --theme google classic_logo.png

Web Interface

Hexalith also includes a web interface for rapid logo design and experimentation. The web interface provides a visual way to adjust parameters and immediately see the results.

To run the web interface:

# Using cargo
cargo run --bin hexweb

# Using nix develop
nix develop -c web-run

# Without installing (using nix run)
nix run github:utensils/hexalith#web

This will start a web server at http://localhost:3000 where you can:

  • Adjust all logo parameters in real-time
  • See immediate previews of your changes
  • Generate random logos with different seeds
  • Download SVG files of your designs
  • Copy logos directly to clipboard
  • Save your favorite designs for reference

The web interface is particularly useful for:

  • Quickly experimenting with different parameters
  • Finding the perfect color theme for your project
  • Testing how grid density affects design complexity
  • Comparing multiple logo variations side by side

Development

Prerequisites

  • Rust 1.60 or later
  • Nix with flakes enabled (optional)

Setup with Nix

If you have Nix with flakes enabled and direnv installed:

# Clone the repository
git clone https://github.com/utensils/hexalith.git
cd hexalith

# Allow direnv
direnv allow

# Build the project
cargo build

Setup without Nix

# Clone the repository
git clone https://github.com/utensils/hexalith.git
cd hexalith

# Build the project
cargo build

Running Tests

# Run all tests
cargo test

# Run specific tests
cargo test grid  # Run grid-related tests
cargo test svg   # Run SVG output tests

Code Coverage

If you have Nix with flakes enabled:

# Generate code coverage report
nix develop -c rs-coverage

# The HTML report will open in your browser
# Or you can find it at ./target/coverage/html/index.html

For non-Nix users, you can generate coverage using grcov directly:

# Install necessary tools
rustup component add llvm-tools-preview
cargo install grcov

# Set up environment variables
export CARGO_INCREMENTAL=0
export RUSTFLAGS="-Cinstrument-coverage -Ccodegen-units=1 -Copt-level=0"
export LLVM_PROFILE_FILE="hexalith-%p-%m.profraw"

# Run tests
cargo test

# Generate coverage report
grcov . --binary-path ./target/debug/deps/ \
  --source-dir . \
  --output-path ./target/coverage/ \
  --output-type html \
  --branch \
  --ignore "target/*" \
  --ignore "tests/*" \
  --ignore-not-existing \
  --llvm

Note: The current coverage report provides reliable metrics for line coverage but has limitations with branch coverage measurement. This is a known issue with LLVM instrumentation in stable Rust. For more accurate branch coverage, a specialized setup with nightly Rust and additional tools may be required in the future.

Project Structure

  • src/generator/grid/: Hexagonal grid geometry and triangular subdivision
  • src/generator/shape/: Shape generation algorithms
  • src/generator/color/: Color management and blending
  • src/svg/: SVG output generation
  • src/png/: PNG conversion from SVG
  • src/cli/: Command line interface handling
  • src/web/: Web interface implementation

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Modern geometric logo generator in Rust - creates unique hexagonal designs with minimal configuration.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published