dosubot[bot] commented on issue #29901:
URL: https://github.com/apache/superset/issues/29901#issuecomment-2277221408
<!-- Answer -->
To prevent the dashboard colors from changing on every refresh when the
color scheme is set to "Superset Colors" in Superset version 4.0.2, ensure that
the `color_scheme` and `label_colors` are consistently defined in the
dashboard's `json_metadata`.
Here is an example configuration for `json_metadata`:
```json
{
"color_scheme": "supersetColors",
"label_colors": {
"0": "#FCC700",
"1": "#A868B7",
"15": "#3CCCCB",
"30": "#A38F79",
"45": "#8FD3E4",
"age": "#1FA8C9",
"Yes,": "#1FA8C9",
"Female": "#454E7C",
"Prefer": "#5AC189",
"No,": "#FF7F44",
"Male": "#666666",
"Prefer not to say": "#E04355",
"Ph.D.": "#FCC700",
"associate's degree": "#A868B7",
"bachelor's degree": "#3CCCCB",
"high school diploma or equivalent (GED)": "#A38F79",
"master's degree (non-professional)": "#8FD3E4",
"no high school (secondary school)": "#A1A6BD",
"professional degree (MBA, MD, JD, etc.)": "#ACE1C4",
"some college credit, no degree": "#FEC0A1",
"some high school": "#B2B2B2",
"trade, technical, or vocational training": "#EFA1AA",
"No, not an ethnic minority": "#1FA8C9",
"Yes, an ethnic minority": "#454E7C",
"<NULL>": "#5AC189",
"Yes": "#FF7F44",
"No": "#666666",
"last_yr_income": "#E04355",
"More": "#A1A6BD",
"Less": "#ACE1C4",
"I": "#FEC0A1",
"expected_earn": "#B2B2B2",
"Yes: Willing To": "#EFA1AA",
"No: Not Willing to": "#FDE380",
"No Answer": "#D3B3DA",
"In an Office (with Other Developers)": "#9EE5E5",
"No Preference": "#D1C6BC",
"From Home": "#1FA8C9"
}
}
```
Ensure this configuration is saved and not overwritten on each refresh. If
the colors are still changing, check for any scripts or settings that might
dynamically alter these values on refresh.
Additionally, you can use the `updateDashboardLabelsColor` function to
ensure the color scheme and label colors are correctly applied and
synchronized. This function updates the dashboard metadata with the correct
color settings and ensures the color scheme is applied consistently
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/spec/fixtures/mockDashboardState.js)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/actions/dashboardState.js)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/superset-frontend/src/explore/components/controls/ColorSchemeControl/index.tsx)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]