-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1627 from CartoDB/jarroyo/ch72852/fix-viz-palettes
Fix viz palettes
- Loading branch information
Showing
4 changed files
with
102 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
class Palettes: # pylint: disable=too-few-public-methods | ||
"""Color palettes applied to Map visualizations in the style helper methods. | ||
By default, each color helper method has its own default palette. | ||
More information at https://carto.com/carto-colors/ | ||
Example: | ||
Create color bins style with the burg palette | ||
>>> color_bins_style('column name', palette=palettes.burg) | ||
""" | ||
pass | ||
|
||
|
||
PALETTES = [ | ||
'BURG', | ||
'BURGYL', | ||
'REDOR', | ||
'ORYEL', | ||
'PEACH', | ||
'PINKYL', | ||
'MINT', | ||
'BLUGRN', | ||
'DARKMINT', | ||
'EMRLD', | ||
'AG_GRNYL', | ||
'BLUYL', | ||
'TEAL', | ||
'TEALGRN', | ||
'PURP', | ||
'PURPOR', | ||
'SUNSET', | ||
'MAGENTA', | ||
'SUNSETDARK', | ||
'AG_SUNSET', | ||
'BRWNYL', | ||
'ARMYROSE', | ||
'FALL', | ||
'GEYSER', | ||
'TEMPS', | ||
'TEALROSE', | ||
'TROPIC', | ||
'EARTH', | ||
'ANTIQUE', | ||
'BOLD', | ||
'PASTEL', | ||
'PRISM', | ||
'SAFE', | ||
'VIVID' | ||
'CB_YLGN', | ||
'CB_YLGNBU', | ||
'CB_GNBU', | ||
'CB_BUGN', | ||
'CB_PUBUGN', | ||
'CB_PUBU', | ||
'CB_BUPU', | ||
'CB_RDPU', | ||
'CB_PURD', | ||
'CB_ORRD', | ||
'CB_YLORRD', | ||
'CB_YLORBR', | ||
'CB_PURPLES', | ||
'CB_BLUES', | ||
'CB_GREENS', | ||
'CB_ORANGES', | ||
'CB_REDS', | ||
'CB_GREYS', | ||
'CB_PUOR', | ||
'CB_BRBG', | ||
'CB_PRGN', | ||
'CB_PIYG', | ||
'CB_RDBU', | ||
'CB_RDGY', | ||
'CB_RDYLBU', | ||
'CB_SPECTRAL', | ||
'CB_RDYLGN', | ||
'CB_ACCENT', | ||
'CB_DARK2', | ||
'CB_PAIRED', | ||
'CB_PASTEL1', | ||
'CB_PASTEL2', | ||
'CB_SET1', | ||
'CB_SET2', | ||
'CB_SET3' | ||
] | ||
|
||
for palette in PALETTES: | ||
setattr(Palettes, palette.lower(), palette) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from cartoframes.viz import palettes | ||
|
||
|
||
class TestPalettes(object): | ||
def test_is_defined(self): | ||
"palettes" | ||
assert palettes is not None | ||
|
||
def test_has_defined_palettes(self): | ||
"palettes content" | ||
assert palettes.burg == 'BURG' | ||
assert palettes.burgyl == 'BURGYL' | ||
assert palettes.cb_set3 == 'CB_SET3' |