Skip to content

Commit

Permalink
Add Observable10 categorical palette, fix #9
Browse files Browse the repository at this point in the history
  • Loading branch information
mthh committed Mar 14, 2024
1 parent bf302e1 commit 67e1d3c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
20 changes: 20 additions & 0 deletions generate-palette-descriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,26 @@ def interpolate(startcolor, goalcolor):
}
}

# Add the palette Observable10 from d3-scale-chromatic
res['d3'] = {
"Observable10": {
"type": "qualitative",
"values": { 10:
compress_colors(['#4269d0',
'#efb118',
'#ff725c',
'#6cc5b0',
'#3ca951',
'#ff8ab7',
'#a463f2',
'#97bbf5',
'#9c6b4e',
'#9498a0'])
},
"url": "https://d3js.org/d3-scale-chromatic/categorical#schemeObservable10",
}
}

# Add palettes from Joshua Stevens:
res['joshuastevens'] = {}
# Carrots Palette : https://gist.github.com/jscarto/167b38829aa9eb3758a4f8b1bc3d723f / https://twitter.com/jscarto/status/998627052608729088
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export enum PaletteType {
* @property {string} WESANDERSON - Wes Anderson palettes
* @property {string} OKABEITO - Okabe & Ito's palette
* @property {string} JOSHUASTEVENS - Joshua Stevens' palettes
* @property {string} D3 - D3 / Observable palette
*/
export enum Provider {
CARTOCOLORS = 'cartocolors',
Expand All @@ -48,6 +49,7 @@ export enum Provider {
WESANDERSON = 'wesanderson',
OKABEITO = 'okabeito',
JOSHUASTEVENS = 'joshuastevens',
D3 = 'd3',
}

/**
Expand Down
9 changes: 9 additions & 0 deletions src/palettes.json
Original file line number Diff line number Diff line change
Expand Up @@ -2693,6 +2693,15 @@
"url": "https://jfly.uni-koeln.de/color/"
}
},
"d3": {
"Observable10": {
"type": "qualitative",
"values": {
"10": "4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"
},
"url": "https://d3js.org/d3-scale-chromatic/categorical#schemeObservable10"
}
},
"joshuastevens": {
"Carrots": {
"type": "sequential",
Expand Down

0 comments on commit 67e1d3c

Please sign in to comment.