From a010f291f7ac0737c9a2c11f2d970b930bf7bd36 Mon Sep 17 00:00:00 2001 From: Nicholas Erdenberger Date: Sat, 1 Jul 2017 09:49:10 -0700 Subject: [PATCH] custom palettes from config can be used to generate avatars --- lib/letter_avatar/colors.rb | 5 +++++ 1 file changed, 5 insertions(+), 0 deletions(-) diff --git a/lib/letter_avatar/colors.rb b/lib/letter_avatar/colors.rb index 6ca7d77..348c428 100644 --- a/lib/letter_avatar/colors.rb +++ b/lib/letter_avatar/colors.rb @@ -274,6 +274,11 @@ module LetterAvatar end end + def self.with_custom(username) + custom_palette = LetterAvatar.custom_palette + custom_palette[Digest::MD5.hexdigest(username)[0...15].to_i(16) % custom_palette.length] + end + # Colors form Google Inbox # https://inbox.google.com def self.google -- libgit2 0.21.0