Commit da50df2f1ab7d41d0396a7e4aca239575a6cb066
Committed by
GitHub
Exists in
master
Merge pull request #1 from ksz2k/master
update from source
Showing
3 changed files
with
21 additions
and
2 deletions
Show diff stats
CHANGELOG.md
README.md
... | ... | @@ -61,12 +61,23 @@ end |
61 | 61 | |
62 | 62 | #### Color palette |
63 | 63 | |
64 | -We have two color palettes implemented: `iwanthue` and `google`. | |
64 | +We have three color palettes implemented: `iwanthue`, `google` and `custom`. | |
65 | 65 | |
66 | 66 | Each of them have different colors, but the `iwanthue` also differently calculates the color for specified username. |
67 | 67 | |
68 | 68 | The `google` selected will generate the same avatar for both, "Krzysiek" and "ksz2k" usernames given (both of them starts with letter "k"), but `iwanthue` will calculate it's md5 and then selects color, so there's huge chance that these usernames get different colors. |
69 | 69 | |
70 | +##### Custom palette definition | |
71 | + | |
72 | +You can define your own `custom` palette: | |
73 | + | |
74 | +```ruby | |
75 | +LetterAvatar.setup do |config| | |
76 | + config.colors_palette = :custom | |
77 | + config.custom_palette = [[120, 132, 205], [91, 149, 249], [72, 194, 249], [69, 208, 226]] | |
78 | +end | |
79 | +``` | |
80 | + | |
70 | 81 | ## Usage |
71 | 82 | |
72 | 83 | ```ruby |
... | ... | @@ -102,6 +113,8 @@ There's also helper for this. To use it, you need: |
102 | 113 | Say, you have a model `User` (which must have attribute or method `name`) |
103 | 114 | |
104 | 115 | ```ruby |
116 | +require 'letter_avatar/has_avatar' | |
117 | + | |
105 | 118 | class User |
106 | 119 | include LetterAvatar::HasAvatar |
107 | 120 | ... | ... | ... |
lib/letter_avatar/version.rb