Forum Discussion
New Style Preset code in JSON - How do I set up my "Default" in the JSON?
I have a json theme file in which I added "Light Mode Preset" and "Dark Mode Preset". I was thinking "name": "Light Mode Preset" was to define what I want as the default setting? Currently the default seems to be the Power BI default. What do I need to do to make the default - "Light Mode Preset"?
My JSON:
"columnChart": {
"*": {
"stylePresets": [
{
"name": "Light Mode Preset"
}
]
},
"Light Mode Preset": {
"legend": [
- Anonymous1 year ago
hI andy808 ,
Thank you for the update!Glad it worked! Consider accepting your answer as solution,so other members in the community can easily find it.
Thanks again for your cooperation.Have a great day! - Anonymous1 year ago
Hi andy808 ,
I would like to confirm whether you have successfully resolved the issue .
If the issue has been resolved, please mark the helpful reply as a "solution" to indicate that the question has been answered and to assist others in the community.
Thank you for your cooperation. Have a great day.
7 Replies
- Sahir_MaharajSuper User
Hello andy808,
Can you please try this approach:
"visualStyles": { "columnChart": { "*": { "stylePresets": [ { "name": "Light Mode Preset" }, { "name": "Dark Mode Preset" } ] }, "Light Mode Preset": { "legend": { // styling } }, "Dark Mode Preset": { "legend": { // styling } } } }- andy808Resolver I
Thank you for your response but there is no change in behavior. This is what I tried:
"columnChart": {
"*": {
"stylePresets": [
{
"name": "Light Mode Preset"
},
{
"name": "Dark Mode Preset"
}
]
},
"Light Mode Preset": {
"legend": [
{- AnonymousNot applicable
Hi andy808 ,
Thank you for sharing the updated JSON and clarifying the issue and thank you Sahir_Maharaj for the helpful response!
Power BI does not automatically apply a named preset as the default. Instead, it uses the settings under the "*" section as the default style for all visuals of that type.In this case, columnChart.
To apply your Light Mode styling by default,try using below :
"visualStyles": {
"columnChart": {
"*": {
"legend": {
// Example Light Mode
"show": true,
"position": "Top",
"fontColor": { "solid": { "color": "#000000" } }
},
"stylePresets": [
{ "name": "Light Mode Preset" },
{ "name": "Dark Mode Preset" }
]
},
"Light Mode Preset": {
"legend": {
// Keep your Light Mode settings here for manual use
}
},
"Dark Mode Preset": {
"legend": {
// Dark Mode settings
}
}
}
}
This way, the Light Mode style is applied by default, and users can still switch to the Dark Mode preset manually in the Format pane if required.
Hope this resolve your query.If so,consider accepting it as solution.
Thank you.
Regards,
Pallavi.
- AnonymousNot applicable
Hi andy808 ,
Has the issue been resolved on your end? If so, please share your solution and mark it as "Accept as Solution." This will assist others in the community who are dealing with similar problems and help them find a solution more quickly.
Thank you. - AnonymousNot applicable
Hi andy808 ,
I would like to confirm whether you have successfully resolved the issue .
If the issue has been resolved, please mark the helpful reply as a "solution" to indicate that the question has been answered and to assist others in the community.
Thank you for your cooperation. Have a great day.