question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create new named color scales in config section

See original GitHub issue

Is it possible to add new named color scales in config section? Like this example:

"config":{
  . . .
    "newColorScaleName":["#800000","#FF0000","#FFA07A"]
  . . .
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jheercommented, Apr 23, 2020

I believe the issue is that here the spec is defining new named scale ranges and then trying to look them up dynamically. However, named ranges like "category10" are added to the specification at parse time, and so can not be accessed at runtime using signals.

While schemes can be dynamically added (via the Vega API) we do not currently support defining new scheme entries directly in the config. In general this would be difficult to do, as schemes are not defined per-view but rather for the entire Vega library. So if multiple specifications were used on the same page, they might conflict in their use of schemes. We’d have to invent a tiered approach that allowed schemes to be name-spaced within a View only.

As a way of avoiding all of this, I would recommend defining your custom color palettes in an individual signal instead, and then looking them up by key to provide dynamic scale ranges. Here’s an example.

0reactions
domoritzcommented, Apr 18, 2020

As far as I understand the issue is that

  "config":{
    "range": {
      "mycolors": ["red", "yellow", "blue"]
    }
  },

does not create a new color scale but instead sets the default range. I marked this issue as a feature request since I don’t know whether we support what you are asking for right now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Continuous color scales and color bars in Python - Plotly
How to set, create and control continuous color scales and color bars in scatter, bar, map and heatmap figures. New to Plotly?
Read more >
How to create color scales [Conditional Formatting]
To create a new color scale and also edit settings before creation then follow these steps: Select cells. Go to tab "Home" on...
Read more >
<named-color> - CSS: Cascading Style Sheets | MDN
The <named-color> CSS data type is the name of a color, such as red , blue , black , or lightseagreen . Syntactically,...
Read more >
Python Plotly: How to set up a color palette? - GeeksforGeeks
Let's see a few approaches to how we can set up a color palette. Method 1: Setting up the color palette for continuous...
Read more >
12.6 Using a Manually Defined Palette for a Continuous ...
In the example here, we'll specify the colors for a continuous variable using various gradient scales (Figure 12.12). The colors can be named, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found