Skip to content

Commit

Permalink
Merge pull request #10 from kbackowski/configure_fill_color
Browse files Browse the repository at this point in the history
Allow for configuring fill_color
  • Loading branch information
ksz2k authored Jul 20, 2016
2 parents cb63ffa + 218d307 commit cc268ee
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ $ gem install letter_avatar

```ruby
LetterAvatar.setup do |config|
config.cache_base_path = 'public/system/lets' # default is 'public/system'
config.colors_palette = :iwanthue # default is :google
config.weight = 500 # default is 300
config.annotate_position = '-0+10' # default is -0+5
config.fill_color = 'rgba(255, 255, 255, 1)' # default is 'rgba(255, 255, 255, 0.65)'
config.cache_base_path = 'public/system/lets' # default is 'public/system'
config.colors_palette = :iwanthue # default is :google
config.weight = 500 # default is 300
config.annotate_position = '-0+10' # default is -0+5
end
```

Expand Down
2 changes: 1 addition & 1 deletion lib/letter_avatar/avatar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def generate_fullsize(identity)
-pointsize 140
-font #{FONT_FILENAME}
-weight #{LetterAvatar.weight}
-fill '#{FILL_COLOR}'
-fill '#{LetterAvatar.fill_color}'
-gravity Center
-annotate #{LetterAvatar.annotate_position} '#{identity.letter}'
'#{filename}'
Expand Down
8 changes: 8 additions & 0 deletions lib/letter_avatar/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ def cache_base_path=(v)
@cache_base_path = v
end

def fill_color
@fill_color || Avatar::FILL_COLOR
end

def fill_color=(v)
@fill_color = v
end

def colors_palette
@colors_palette ||= :google
end
Expand Down

0 comments on commit cc268ee

Please sign in to comment.