Skip to Content Skip to Menu

Default Profile Image Settings: Initials with custom background color?

  • bwold
  • bwold
  • OFFLINE
  • Posts: 3
  • Thanks: 1
  • Karma: 0
2 years 8 months ago #328511 by bwold
Hello, we are setting up our user profile pages with the default (no user image uploaded) of First and Last Initial. Looks great, but the random colored backgrounds have triggered our designers, who want use to only use shades from our site's color palette. How can I set the background of the circle to choose only one color (or choose from a set of colors)?

In other words, in the example image: we only want the circle profiles to be shades of blue -- no green, no brown, etc.

Thanks in advance.
Attachments:

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48424
  • Thanks: 8274
  • Karma: 1443
2 years 8 months ago #328524 by krileon
It's a SVG with a inline style so you absolutely can set its color from CSS to whatever you'd like. Example as follows.

Code:
svg.cbImgAvatar > rect { fill: red; }

That'll make all of them red for example. To change the color of the text you'd use the below for example.

Code:
svg.cbImgAvatar > text { fill: blue; }

That would make all of their initial text color blue.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • bwold
  • bwold
  • OFFLINE
  • Posts: 3
  • Thanks: 1
  • Karma: 0
2 years 8 months ago #328528 by bwold
This is awesome, thank you! That works great for them all to be the same colors. For fun, if I wanted to explore using a range of colors, where is this SVG code set?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48424
  • Thanks: 8274
  • Karma: 1443
2 years 8 months ago #328529 by krileon
The _avatarHtml function in /components/com_comprofiler/plugin/user/plug_cbcore/cb.core.php is responsible for outputting the SVG image. We're using a helper function to convert strings to unique colors and I guess you could just replace that behavior. Neither have triggers to do this though so you'd be making core modifications that would be lost every time you update CB.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • bwold
  • bwold
  • OFFLINE
  • Posts: 3
  • Thanks: 1
  • Karma: 0
2 years 8 months ago #328530 by bwold
Appreciate the extra info. We'll probably stay away from that, but it's good info to know. Thanks again!
The following user(s) said Thank You: krileon

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum