{"id":17598944,"url":"https://github.com/thutterer/initials","last_synced_at":"2025-09-09T08:38:54.251Z","repository":{"id":37021429,"uuid":"376354733","full_name":"thutterer/initials","owner":"thutterer","description":"Use colorful SVGs as user avatars in any Ruby and Rails application","archived":false,"fork":false,"pushed_at":"2024-05-30T16:12:30.000Z","size":198,"stargazers_count":48,"open_issues_count":3,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-31T03:00:30.118Z","etag":null,"topics":["avatar","rails","svg"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/initials","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/thutterer.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-12T18:03:13.000Z","updated_at":"2025-08-27T07:32:04.000Z","dependencies_parsed_at":"2024-10-22T19:11:45.207Z","dependency_job_id":null,"html_url":"https://github.com/thutterer/initials","commit_stats":{"total_commits":28,"total_committers":4,"mean_commits":7.0,"dds":0.25,"last_synced_commit":"426d9381cd7f0c152619459eff32b4aeebaa559c"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/thutterer/initials","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thutterer%2Finitials","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thutterer%2Finitials/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thutterer%2Finitials/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thutterer%2Finitials/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thutterer","download_url":"https://codeload.github.com/thutterer/initials/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thutterer%2Finitials/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274268378,"owners_count":25253389,"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","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["avatar","rails","svg"],"created_at":"2024-10-22T10:08:23.188Z","updated_at":"2025-09-09T08:38:54.206Z","avatar_url":"https://github.com/thutterer.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Initials [![Maintainability](https://api.codeclimate.com/v1/badges/fb865ec4adcd0671dc48/maintainability)](https://codeclimate.com/github/thutterer/initials/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/fb865ec4adcd0671dc48/test_coverage)](https://codeclimate.com/github/thutterer/initials/test_coverage)\n\nDon't want to implement user avatar uploads but still have basic avatars to distinguish users and brigthen up your app?\n\nUse colorful SVGs as user avatars in any Ruby and Rails application.\n\n![demo](demo.png)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'initials'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install initials\n\n## Usage\n\nCall `Initials.svg(\"Morty Smith\")` anywhere to get a colorful initials avatar SVG as string.\nThe avatar's background color is based on the provided name and the font-size is adjusted to fit between one and three character initials.\n\n### Rails\n\nNo special configuration is required to work with Ruby on Rails, but for your convinience, you can add this to your `app/helpers/application_helper.rb`:\n\n```ruby\ndef user_avatar(name, **options)\n  Initials.svg(name, **options)\nend\n```\n\nNow you can create SVGs in all views:\n\n```erb\n\u003c%= user_avatar(current_user.name) %\u003e\n```\n\nInitials automatically marks its created SVG strings as `html_safe`.\n\n### Options\n\nYou can pass the following options into `Initials.svg` or your `user_avatar` helper:\n\n```ruby\nuser_avatar(current_user.name,\n  colors: 8,    # number of different colors, default: 12\n  limit: 1,     # maximal initials length, default: 3\n  shape: :rect, # background shape, default: :circle\n  size: 96      # SVG height and width in pixel, default: 32\n)\n```\n\nOf course, you can also use CSS to make the SVG have different sizes in different places of your HTML.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/thutterer/initials.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthutterer%2Finitials","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthutterer%2Finitials","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthutterer%2Finitials/lists"}