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.

Customize color scale and palette

See original GitHub issue

Enter Custom Palatte

Color Palette customization (done) https://github.com/keplergl/kepler.gl/pull/601

User should be able to design custom color palette, they should be able to

  • Click using custom color palette to toggle color palette editor
  • Start from blank, or start from an existing palette, (advanced: paste an array of hex values into an input box)
  • Edit color value using a color picker, or input rgb, hex value
  • Add and remove colors
  • Drag to reorder colors

Color Value customization (in progress)

User should be able to import values next to each color, using dropdown for ordinal values and input box for numeric values. There will be a distribution graph for numeric values, user can drag the slider handle to adjust value range of each bin

Ordinal values

Screen Shot 2019-11-09 at 3 38 35 AM

Implementation Step:

  1. Store value color Map in layer.config.colorUI.colorRange.customPalette, create a new prop colorMap and save it as a JS Map
const colorMap = new Map([["foo", "#FFFFFF"], ["bar", "#000000"], ["foo1", "#FF0000"]]);

only store values manually selected by user. if user is using the “assign rest to one color” option, don’t store all the rest of the values to the map, later when create color scale, use the .unknown() method to assign color to the rest of values.

  1. When calculate color based on custom color scale in layer.getVisChannelScale(base-layer.js). Use D3.ordinalScale and pass in the colorMap and a value for unknown
m = d3.scaleOrdinal()
  .domain(colorMap.keys())
  .range(colorMap.values())
.unknown('#fff000') // assign rest value to a color value 
Screen Shot 2019-11-09 at 3 39 12 AM [Numeric values]

Add more color scale options

  • Add log, sqrt and Jenkins natural break scale

Implementation steps:

  1. add log and sqrt scale (done) https://github.com/keplergl/kepler.gl/pull/670 1.5 add Jenkins natural breaks scale (in progress)
  2. Add a 'Use custom color palette ’ toggle under the reserved toggle (done) https://github.com/keplergl/kepler.gl/pull/601
  3. Allow edit color value using a color picker, or input rgb, hex value (done) https://github.com/keplergl/kepler.gl/pull/601
  4. Add input box to custom value domain for each color (ordinal and numeric value has different input UI) (not started)
  5. Add distribution graph for numeric values (not started)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:38
  • Comments:25 (2 by maintainers)

github_iconTop GitHub Comments

12reactions
heshan0131commented, Nov 9, 2019

Adding value customization is in progress:

Screen Shot 2019-11-09 at 3 39 12 AM Screen Shot 2019-11-09 at 3 38 35 AM
10reactions
davidwedekindcommented, Aug 19, 2019

Hi, Will this also include manual color range specification? It would be very useful not only to have automatic color range determination such as by quantile or quantize but manual range specification like in QGIS. E. g. color “#FFC300” for values between 0 and 50, “#F1920E” for values between 51 and … Thx, David

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating custom color palettes and color scales - Qlik | Help
These examples show how to create color palettes and color scales for your custom themes. All properties referenced in the examples below are...
Read more >
color scale generator - Hayk An
Color scale generator by Hayk An.
Read more >
Data Viz Color Palette Generator (for Charts & Dashboards)
Use the palette chooser to create a series of colors that are visually equidistant. This is useful for many data visualizations, like pie...
Read more >
Create Custom Color Palettes - Tableau Help
Tableau Desktop comes with color palettes that have been carefully designed to work well together and effectively apply color to data in many...
Read more >
12.6 Using a Manually Defined Palette for a Continuous ...
Mapping continuous values to a color scale requires a continuously changing palette of colors. Table 12.2. lists the continuous color and fill scales....
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