6.0.0 • Published 3 months ago

osxlocation v6.0.0

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

Features

  • Create unique, visually appealing icons using mathematical patterns
  • Multiple icon styles: geometric, circular, polygonal, fractal, wave, voronoi
  • Customizable colors, complexity, and other parameters
  • Export as clean SVG for use in web and print
  • Command line interface for generating icons without code
  • Create consistent icon sets with variations

Basic Usage

const { createIcon } = require('mathicon');

// Generate a random icon
const svg = createIcon();
console.log(svg); // SVG string output

// Generate a custom icon
const customIcon = createIcon({
  style: 'fractal',
  size: 256,
  baseColor: '#3498db',
  colorScheme: 'analogous',
  complexity: 4,
  background: '#f5f5f5'
});

API

createIcon(options)

Creates a single icon with the specified options.

Options:

  • size: Icon size in pixels (default: 512)
  • style: Icon style (default: 'geometric')
    • 'geometric' - Random style selection
    • 'circular' - Circular-based patterns
    • 'polygon' - Regular polygon-based pattern
    • 'fractal' - Recursive fractal patterns
    • 'wave' - Wave and oscillation patterns
    • 'voronoi' - Voronoi tessellation patterns
  • complexity: Visual complexity level, 1-5 (default: 3)
  • baseColor: Base color in hex format (default: '#3498db')
  • colorScheme: Color scheme (default: 'monochromatic')
    • 'monochromatic' - Variations of a single color
    • 'complementary' - Base color and its complement
    • 'analogous' - Adjacent colors on the color wheel
    • 'triadic' - Three evenly spaced colors
  • background: Background color or 'transparent' (default: 'transparent')
  • padding: Spacing from edge (default: 0.1, as percentage of size)
  • seed: Random seed for reproducible output (default: random)
  • strokeWidth: Width of strokes (default: 2)

Returns: SVG string

createIconSet(count, baseOptions)

Creates multiple icons with variations based on the same options.

Parameters:

  • count: Number of icons to generate (default: 5)
  • baseOptions: Base options for all icons (same as createIcon)

Returns: Array of SVG strings

createIconForUse(type, options)

Creates an icon optimized for a specific use case.

Parameters:

  • type: Use case type (default: 'avatar')
    • 'avatar' - Circular icon for profile pictures
    • 'app' - App icon style
    • 'logo' - Logo-appropriate style
    • 'favicon' - Small website favicon
  • options: Additional custom options

Returns: SVG string

Command Line Interface

# Basic usage
mathicon create icon.svg

# Custom options
mathicon create custom.svg --style=fractal --color=#3498db --complexity=4

# Create multiple icons
mathicon create-set 5 ./icons --style=wave

# Create for specific use
mathicon avatar profile.svg --scheme=analogous

Run mathicon help to see all available options.

Examples

const { createIcon, createIconSet } = require('mathicon');
const fs = require('fs');

// Generate a polygon icon with 6 sides
const hexagon = createIcon({
  style: 'polygon',
  sides: 6,
  baseColor: '#9b59b6',
  colorScheme: 'complementary'
});

fs.writeFileSync('hexagon.svg', hexagon);

// Create a set of 5 related icons
const iconSet = createIconSet(5, {
  style: 'wave',
  baseColor: '#e74c3c'
});

iconSet.forEach((svg, i) => {
  fs.writeFileSync(`wave-${i+1}.svg`, svg);
});

License

MIT

6.0.0

3 months ago

4.0.0

3 months ago