https://github.com/utensils/hexalith
Modern geometric logo generator in Rust - creates unique hexagonal designs with minimal configuration.
https://github.com/utensils/hexalith
Last synced: 26 days ago
JSON representation
Modern geometric logo generator in Rust - creates unique hexagonal designs with minimal configuration.
- Host: GitHub
- URL: https://github.com/utensils/hexalith
- Owner: utensils
- License: mit
- Created: 2025-05-20T03:09:54.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-06-03T01:00:25.000Z (4 months ago)
- Last Synced: 2025-07-02T22:37:57.399Z (3 months ago)
- Language: Rust
- Size: 156 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```bash
cargo install hexalith
```### Using Nix Flakes (No Installation Required)
You can run Hexalith directly without installation using Nix:
```bash
# 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 for deterministic generation
-u, --uuid UUID for deterministic generation (overrides seed)
-t, --theme Color theme [default: classic] [possible values: classic, google, blues, greens, reds, purples, rainbow]
-n, --shapes Number of shapes to generate [default: 4]
-g, --grid-size Grid density (2-8) [default: 4]
-o, --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 Output width in pixels (PNG only) [default: 512]
-H, --height Output height in pixels (PNG only) [default: 512]
-f, --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):
```bash
hexalith
```Generate a logo in SVG format:
```bash
hexalith -f svg my-logo.svg
```Generate a deterministic logo using a seed:
```bash
hexalith --seed 12345 my-logo.png
```Generate a classic style logo:
```bash
hexalith --classic logo.png
```Generate a PNG with custom dimensions:
```bash
hexalith --width 800 --height 800 my-logo.png
```Generate a logo with custom parameters:
```bash
hexalith --grid-size 8 --shapes 5 --opacity 0.7 --verbose logo.svg
```Copy logo to clipboard instead of saving:
```bash
hexalith --copy --format svg
```Generate a logo with a specific color theme:
```bash
hexalith --theme blues --seed 42 logo.svg
```Generate a logo without overlapping shapes:
```bash
hexalith --no-overlap --seed 42 logo.svg
```Generate a classic style logo:
```bash
hexalith --classic --seed 42 logo.svg
```Generate a classic logo with different theme:
```bash
hexalith --classic --theme google classic-logo.svg
```Try different color themes:
```bash
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:
```bash
hexalith --uuid f47ac10b-58cc-4372-a567-0e02b2c3d479 logo.svg
```Copy logo directly to clipboard (no file created):
```bash
# 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:
```bash
# 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:
```bash
# 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 referenceThe 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:
```bash
# 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
```bash
# Clone the repository
git clone https://github.com/utensils/hexalith.git
cd hexalith# Build the project
cargo build
```### Running Tests
```bash
# 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:
```bash
# 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:
```bash
# 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.