{"id":13483713,"url":"https://github.com/jasonlong/geo_pattern","last_synced_at":"2025-04-13T04:00:14.644Z","repository":{"id":13590501,"uuid":"16283275","full_name":"jasonlong/geo_pattern","owner":"jasonlong","description":"Create beautiful generative geometric background images from a string.","archived":false,"fork":false,"pushed_at":"2023-12-20T16:42:22.000Z","size":1755,"stargazers_count":1259,"open_issues_count":1,"forks_count":89,"subscribers_count":21,"default_branch":"main","last_synced_at":"2025-04-13T04:00:01.666Z","etag":null,"topics":["generative","procedural","ruby","visualization"],"latest_commit_sha":null,"homepage":"http://jasonlong.github.io/geo_pattern/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jasonlong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-01-27T15:38:07.000Z","updated_at":"2025-04-11T05:55:33.000Z","dependencies_parsed_at":"2024-01-08T17:24:51.492Z","dependency_job_id":null,"html_url":"https://github.com/jasonlong/geo_pattern","commit_stats":{"total_commits":283,"total_committers":23,"mean_commits":"12.304347826086957","dds":0.5724381625441697,"last_synced_commit":"47fed7fb0a1cfdf5c47d593ebd17f72b9d5ad87a"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonlong%2Fgeo_pattern","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonlong%2Fgeo_pattern/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonlong%2Fgeo_pattern/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonlong%2Fgeo_pattern/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasonlong","download_url":"https://codeload.github.com/jasonlong/geo_pattern/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248661706,"owners_count":21141450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generative","procedural","ruby","visualization"],"created_at":"2024-07-31T17:01:14.482Z","updated_at":"2025-04-13T04:00:14.580Z","avatar_url":"https://github.com/jasonlong.png","language":"Ruby","readme":"### This project is largely unmaintained now.\n\n#### I'll happily accept PRs to keep things in working order, but I no longer plan to make updates.\n\n----\n\n[![](https://img.shields.io/gem/v/geo_pattern.svg?style=flat)](http://rubygems.org/gems/geo_pattern)\n![Ruby](https://github.com/jasonlong/geo_pattern/workflows/Ruby/badge.svg)\n[![](https://img.shields.io/gem/dt/geo_pattern.svg?style=flat)](http://rubygems.org/gems/geo_pattern)\n[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)\n\n# GeoPattern\n\nGenerate beautiful tiling SVG patterns from a string. The string is converted\ninto a SHA and a color and pattern are determined based on the values in the\nhash. The color is determined by shifting the hue and saturation from a default\n(or passed in) base color. One of 16 patterns is used (or you can specify one)\nand the sizing of the pattern elements is also determined by the hash values.\n\nYou can use the generated pattern as the `background-image` for a container.\nUsing the `base64` representation of the pattern still results in SVG\nrendering, so it looks great on retina displays.\n\nSee the [GitHub Guides](https://guides.github.com/) site and the [Explore section\nof GitHub](https://github.com/explore) are examples of this library in action.\nBrandon Mills has put together an awesome [live preview\npage](http://btmills.github.io/geopattern/geopattern.html) that's built on his\nJavascript port.\n\n## Installation\n\n**Note:** as of version `1.4.0`, Ruby version 2 or greater is required.\n\nAdd this line to your application's Gemfile:\n\n    gem 'geo_pattern'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install geo_pattern\n\n## Usage\n\nMake a new pattern:\n\n```ruby\npattern = GeoPattern.generate('Mastering Markdown')\n```\n\nTo specify a base background color (with a hue and saturation that adjusts depending on the string):\n\n```ruby\npattern = GeoPattern.generate('Mastering Markdown', base_color: '#fc0')\n```\n\nTo use a specific background color (w/o any hue or saturation adjustments):\n\n```ruby\npattern = GeoPattern.generate('Mastering Markdown', color: '#fc0')\n```\n\nTo use a specific [pattern generator](#available-patterns):\n\n```ruby\npattern = GeoPattern.generate('Mastering Markdown', patterns: :sine_waves)\n```\n\nTo use a subset of the [available patterns](#available-patterns):\n\n```ruby\npattern = GeoPattern.generate('Mastering Markdown', patterns: [:sine_waves, :xes])\n```\n\nGet the SVG string:\n\n```ruby\nputs pattern.to_svg\n# =\u003e \u003csvg xmlns=\"http://www.w3.org/2000/svg\" ...\n```\n\nGet the Base64 encoded string:\n\n```ruby\nputs pattern.to_base64\n# =\u003e PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC...\n```\n\nYou can then use this string to set the background:\n\n```html\n\u003cdiv style=\"background-image: \u003c%= pattern.to_data_uri %\u003e\"\u003e\u003c/div\u003e\n```\n\n## Available patterns\n\n*Note: As of version `1.3.0`, string references (e.g. `overlapping_circles`)\nare deprecated in favor of symbol references (e.g. `:overlapping_circles`).*\n\n### :chevrons\n\n![](http://jasonlong.github.io/geo_pattern/examples/chevrons.png)\n\n\n### :octagons\n\n![](http://jasonlong.github.io/geo_pattern/examples/octogons.png)\n\n### :overlapping_circles\n\n![](http://jasonlong.github.io/geo_pattern/examples/overlapping_circles.png)\n\n### :plus_signs\n\n![](http://jasonlong.github.io/geo_pattern/examples/plus_signs.png)\n\n### :xes\n\n![](http://jasonlong.github.io/geo_pattern/examples/xes.png)\n\n### :sine_waves\n\n![](http://jasonlong.github.io/geo_pattern/examples/sine_waves.png)\n\n### :hexagons\n\n![](http://jasonlong.github.io/geo_pattern/examples/hexagons.png)\n\n### :overlapping_rings\n\n![](http://jasonlong.github.io/geo_pattern/examples/overlapping_rings.png)\n\n### :plaid\n\n![](http://jasonlong.github.io/geo_pattern/examples/plaid.png)\n\n### :triangles\n\n![](http://jasonlong.github.io/geo_pattern/examples/triangles.png)\n\n### :squares\n\n![](http://jasonlong.github.io/geo_pattern/examples/squares.png)\n\n### :nested_squares\n\n![](http://jasonlong.github.io/geo_pattern/examples/nested_squares.png)\n\n### :mosaic_squares\n\n![](http://jasonlong.github.io/geo_pattern/examples/mosaic_squares.png)\n\n### :concentric_circles\n\n![](http://jasonlong.github.io/geo_pattern/examples/concentric_circles.png)\n\n### :diamonds\n\n![](http://jasonlong.github.io/geo_pattern/examples/diamonds.png)\n\n### :tessellation\n\n![](http://jasonlong.github.io/geo_pattern/examples/tessellation.png)\n\n\n## Inspection of pattern\n\nIf you want to get some more information about a pattern, please use the\nfollowing methods.\n\n```ruby\npattern = GeoPattern.generate('Mastering Markdown', patterns: [:sine_waves, :xes])\n\n# The color of the background in html notation\npattern.background.color.to_html\n\n# The color of the background in svg notation\npattern.background.color.to_svg\n\n\n# The input colors\npattern.background.preset.color\npattern.background.preset.base_color\n\n# The generator\npattern.background.generator\n```\n\nTo get more information about the structure of the pattern, please use the following methods:\n\n```ruby\npattern = GeoPattern.generate('Mastering Markdown', patterns: [:sine_waves, :xes])\n\n# The name of the structure\npattern.structure.name\n\n# The generator of the structure\npattern.structure.generator\n```\n\n## Rake Support\n\n```ruby\nstring = 'Mastering markdown'\n\nrequire 'geo_pattern/geo_pattern_task'\n\nGeoPattern::GeoPatternTask.new(\n  name: 'generate',\n  description: 'Generate patterns to make them available as fixtures',\n  data: {\n    'fixtures/generated_patterns/diamonds_with_color.svg'      =\u003e { input: string, patterns: [:diamonds], color: '#00ff00' },\n    'fixtures/generated_patterns/diamonds_with_base_color.svg' =\u003e { input: string, patterns: [:diamonds], base_color: '#00ff00' }\n  }\n)\n```\n\n## Developing\n\n### Generate Fixtures\n\n```ruby\nrake fixtures:generate\n```\n\n### Run tests\n\n```ruby\nrake test\n```\n\n## Contributing\n\n1. Fork it ( https://github.com/jasonlong/geo_pattern/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## Development\n\nPrefix rspec-commandline with `RSPEC_PROFILE=1` to output the ten slowest\nexamples of the test suite.\n\n```bash\nRSPEC_PROFILE=1 bundle exec rspec\n```\n\n## Ports \u0026 related projects\n\nJavaScript port by Brandon Mills:\nhttps://github.com/btmills/geopattern\n\nTypeScript port by MooYeol Lee:\nhttps://github.com/mooyoul/geo-pattern\n\nPython port by Bryan Veloso:\nhttps://github.com/bryanveloso/geopatterns\n\nElixir port by Anne Johnson:\nhttps://github.com/annejohnson/geo_pattern\n\nPHP port by Anand Capur:\nhttps://github.com/redeyeventures/geopattern-php\n\nGo port by Pravendra Singh:\nhttps://github.com/pravj/geopattern\n\nCoffeeScript port by Aleks (muchweb):\nhttps://github.com/muchweb/geo-pattern-coffee\n\nCocoa port by Matt Faluotico:\nhttps://github.com/mattfxyz/GeoPattern-Cocoa\n\nMiddleman extension by @maxmeyer:\nhttps://github.com/fedux-org/middleman-geo_pattern\n\nDart(Flutter) port by @suyash:\nhttps://github.com/suyash/geopattern\n\nLua port by Ivan Azoyan:\nhttps://github.com/azoyan/geopattern\n","funding_links":[],"categories":["Ruby","Multimedia","Data Visualization","ruby","1. language"],"sub_categories":["Image and pictures","1.1 ruby"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonlong%2Fgeo_pattern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasonlong%2Fgeo_pattern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonlong%2Fgeo_pattern/lists"}