You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/01/06 10:40:01 UTC

[GitHub] [superset] villebro commented on a change in pull request #12210: feat: Custom color schemes support

villebro commented on a change in pull request #12210:
URL: https://github.com/apache/superset/pull/12210#discussion_r552497770



##########
File path: docs/src/pages/docs/frequently-asked-questions-page.mdx
##########
@@ -232,6 +232,30 @@ Metadata attribute using the `label_colors` key.
 }
 ```
 
+### Is there a way to add custom color schemes?
+
+It is possible to override EXTRA_CATEGORICAL_COLOR_SCHEMES or EXTRA_SEQUENTIAL_COLOR_SCHEMES to register new color schemes
+
+```
+EXTRA_CATEGORICAL_COLOR_SCHEMES =  [
+    {
+        "id": 'myCustomColors',
+        "description": '',
+        "label": 'My custom Colors',
+        "colors": ['#6BD3B3', '#6BD3B3', '#6BD3B3', '#66CBE2']
+    }]
+
+EXTRA_SEQUENTIAL_COLOR_SCHEMES =  [
+    {
+        "id": 'myCustomColors',
+        "description": '',
+        "isDiverging": true
+        "label": 'My custom Colors',
+        "colors": ['#6BD3B3', '#6BD3B3', '#66CBE2']
+    }]

Review comment:
       I would rather see this example in `config.py` with a reference to it in the FAQ. Also a minor nit, but would be nice to have the schemes having real colors and not repeating `#6BD3B3`, also with the name something like "My custom warm to hot" or similar.

##########
File path: superset/config.py
##########
@@ -368,6 +368,14 @@ def _try_json_readsha(  # pylint: disable=unused-argument
 #     return feature_flags_dict
 GET_FEATURE_FLAGS_FUNC: Optional[Callable[[Dict[str, bool]], Dict[str, bool]]] = None
 
+# EXTRA_CATEGORICAL_COLOR_SCHEMES is used for adding custom categorical color schemes
+# This is merely a default
+EXTRA_CATEGORICAL_COLOR_SCHEMES: List[Dict[str, Any]] = []
+
+# EXTRA_SEQUENTIAL_COLOR_SCHEMES is used for adding custom sequential color schemes
+# This is merely a default
+EXTRA_SEQUENTIAL_COLOR_SCHEMES: List[Dict[str, Any]] = []

Review comment:
       See the comment in FAQ




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org