Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
powerkriya
Frequent Visitor

Assigning default Color to formatting pane color field

I started with the circle card master visual project, and adding stuffs to that.

I have a default color to the circle as "gold" and I want to set this default value to the circle color setting on the formatting pane. 

Is there any way we can do this?

 

Please find my code in the location : https://drive.google.com/open?id=1enuJlByDBmNTvkkEQTvGFX9U9aiV6q-i

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @powerkriya,

You need to set defaults using HTML (HEX) codes - CSS named colours don't work. So, if I change the variable assignement in your settings.ts for circleColor to the HEX value for Gold, e.g.:

export class CircleSettings {
  public circleColor: string = "#D9B300";
  /** Rest of your properties... */
}

This will then work based on your current binding in visual.ts (which is correct 🙂 ), e.g.:

2020-05-08_16-22-10.gif

(it's not easy to see but I'm clicking 'Revert to Default' in the bottom of the palette to confirm your colour defaults back to gold)

Hopefully that's all you need to crack on - good luck!

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

2 REPLIES 2
dm-p
Super User
Super User

Hi @powerkriya,

You need to set defaults using HTML (HEX) codes - CSS named colours don't work. So, if I change the variable assignement in your settings.ts for circleColor to the HEX value for Gold, e.g.:

export class CircleSettings {
  public circleColor: string = "#D9B300";
  /** Rest of your properties... */
}

This will then work based on your current binding in visual.ts (which is correct 🙂 ), e.g.:

2020-05-08_16-22-10.gif

(it's not easy to see but I'm clicking 'Revert to Default' in the bottom of the palette to confirm your colour defaults back to gold)

Hopefully that's all you need to crack on - good luck!

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Wow!  I didn't know the HEX code will fix the problem.  Thank you so much.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors