{"id":15152730,"url":"https://github.com/jnylen/shrine-color","last_synced_at":"2025-09-29T23:32:21.243Z","repository":{"id":10252679,"uuid":"65111560","full_name":"jnylen/shrine-color","owner":"jnylen","description":"Finding the primary color in an image for Shrine.","archived":true,"fork":false,"pushed_at":"2022-10-27T04:01:08.000Z","size":83,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-18T01:46:40.618Z","etag":null,"topics":["activerecord","color","mongoid","rails","ruby","ruby-on-rails","shrine"],"latest_commit_sha":null,"homepage":null,"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/jnylen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-07T02:25:50.000Z","updated_at":"2023-02-20T03:54:08.000Z","dependencies_parsed_at":"2022-08-07T05:15:37.138Z","dependency_job_id":null,"html_url":"https://github.com/jnylen/shrine-color","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnylen%2Fshrine-color","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnylen%2Fshrine-color/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnylen%2Fshrine-color/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnylen%2Fshrine-color/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jnylen","download_url":"https://codeload.github.com/jnylen/shrine-color/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219865593,"owners_count":16554162,"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":["activerecord","color","mongoid","rails","ruby","ruby-on-rails","shrine"],"created_at":"2024-09-26T16:22:03.064Z","updated_at":"2025-09-29T23:32:15.981Z","avatar_url":"https://github.com/jnylen.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shrine Color\n\nGet the dominant color of an image using colorscore (updated version by me). This can be used as a background color while an image is loading or search by color.\n\nThis is based on carrierwave-color by Sunny Ripert (sunny).\n\n**NOTE: The palettes/dominiant_color grabbed from images may differ between imagemagick versions.**\n\n**Current version of imagemagick the test runs towards: 7.0.8-68**\n\n## Requirements\n\nThis gem requires imagemagick (convert) and grabs colors via a command line.\nSo mini_magick, etc. isn't required.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"shrine-color\"\n```\n\nAnd then call:\n\n```sh\n$ bundle\n```\n\n## Add the plugin to your uploader\n\nIn your uploader, include the module and call the processor:\n\n```ruby\nclass ImageUploader \u003c Shrine\n  # plugin add_metadata should be loaded automagically.\n  # otherwise add it here\n  plugin :color\n\n  # dominant color\n  add_metadata :dominant_color do |io, context|\n    dominant_color(io.path)\n  end\n\n  # palette color with version, color count and own array of colors.\n  add_metadata :palette_color do |io, context|\n    if context[:version] == :small\n      palette_color(io.path, 3, ['ff0000', '00ff00', '0000ff'])\n    end\n  end\nend\n```\n\nYou can now use the code below to get a color:\n\n```ruby\n## Dominant color\nphoto.image[:small].metadata[\"dominant_color\"]\n# or\nphoto.image[:small].dominant_color\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjnylen%2Fshrine-color","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjnylen%2Fshrine-color","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjnylen%2Fshrine-color/lists"}