Skip to content

📐 Create beautiful generative image patterns from a string in golang.

License

Notifications You must be signed in to change notification settings

pravj/geopattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

geo_pattern

now create beautiful generative background images from a strinig in golang.

Go port of Jason Long's awesome GeoPattern library.

GoDoc

Nested Squares Pattern

Generate beautiful tiling SVG patterns from a string. The string is converted into a SHA and a color and pattern are determined based on the values in the hash. The color is determined by shifting the hue from a default (or passed in) base color. One of 16 patterns is used (or you can specify one) and the sizing of the pattern elements is also determined by the hash values.

You can use the generated pattern as the background-image for a container. Using the base64 representation of the pattern still results in SVG rendering, so it looks great on retina displays.

See the GitHub Guides site as an example of this library in action. GitHub Guides use Original Ruby implementation.

####Installation go get github.com/pravj/geo_pattern

####Usage Example directory contains sample go programs that explains use of geo_pattern

####API

#####Arguments for functions returning pattern's string

######phrase : custom pattern phrase

args := map[string]string{"phrase": "My Custom Phrase"}

######generator : custom pattern type

args := map[string]string{"generator": "plaid"}

######color : custom background color

args := map[string]string{"color": "#3b5998"}

######base_color : custom base color that decides background color

args := map[string]string{"base_color": "#ffcc00"}

#####Functions provided by package for pattern's string representation

######Get the SVG string :

Generate(args)

######Get the Base64 encoded string :

Base64_string(args)

######Get uri image string :

Uri_image(args)

####Available Pattern

  • chevrons
  • concentric_circles
  • diamonds
  • hexagons
  • mosaic_squares
  • nested_squares
  • octagons
  • overlapping_circles
  • overlapping_rings
  • plaid
  • plus_signs
  • sine_waves
  • squares
  • tessellation
  • triangles
  • xes

####Dependencies go-colorful : for color space conversion

About

📐 Create beautiful generative image patterns from a string in golang.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages