Commit a010f291f7ac0737c9a2c11f2d970b930bf7bd36
1 parent
bfbb6ebc
Exists in
master
custom palettes from config can be used to generate avatars
Showing
1 changed file
with
5 additions
and
0 deletions
Show diff stats
lib/letter_avatar/colors.rb
@@ -274,6 +274,11 @@ module LetterAvatar | @@ -274,6 +274,11 @@ module LetterAvatar | ||
274 | end | 274 | end |
275 | end | 275 | end |
276 | 276 | ||
277 | + def self.with_custom(username) | ||
278 | + custom_palette = LetterAvatar.custom_palette | ||
279 | + custom_palette[Digest::MD5.hexdigest(username)[0...15].to_i(16) % custom_palette.length] | ||
280 | + end | ||
281 | + | ||
277 | # Colors form Google Inbox | 282 | # Colors form Google Inbox |
278 | # https://inbox.google.com | 283 | # https://inbox.google.com |
279 | def self.google | 284 | def self.google |