XF 2.2 Change avatar colours?

Alvin63

Well-known member
So my first forum is one where people rarely use avatars - it's more about words. And it's predominantly male. However a lot of the avatars are various shades of pink. Is there any way of changing avatar colours - and excluding pink?!
 
If you have the default avatar system enabled, there's not a way to pick certain colors for it. The color used for the user is pseudo-randomly generated. The color is based on a hash of the username, so the only way to change the color would be to change the username (and even then it's just a different random color). You could of course disable the default avatar system and just use normal avatars that are image based (and whatever image the user uses).

If you really wanted to go down the road of excluding certain colors, you could make an addon that modified the coloring method: XF\Template\Templater::getDefaultAvatarStyling. That of course will require some coding ability, but then you can make the color logic whatever you want.
 
Cheers. So can I upload a default image instead of the coloured ones based on usernames? But then I guess everyone would have the same image.
Yes, you can set a default avatar. And yes, everybody gets the same avatar.

The "green tinted" ones are the default avatar set for my site.

Screen Shot 2023-06-25 at 4.58.54 PM.png

Disable this

ACP -> Setup -> Options -> User Options

Screen Shot 2023-06-25 at 4.59.43 PM.png

Go into ACP -> Appearance -> Styles -> [your selected style in use] -> Avatars

Screen Shot 2023-06-25 at 5.02.15 PM.png

Choose Image for Default avatar type, then in the Default avatar image URL, upload your optimized image you want to use for the default users.
 
Top Bottom