├── .circleci ├── config.yml ├── create_env.sh └── run_tests.sh ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── MANIFEST ├── MANIFEST.in ├── README.md ├── colorlover └── __init__.py ├── dist ├── colorlover-0.1.tar.gz └── colorlover-0.2.tar.gz ├── recipe ├── LICENSE.txt └── meta.yaml ├── setup.py └── tests.py /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | jobs: 4 | 5 | python-2.7-core: 6 | docker: 7 | - image: continuumio/miniconda3:4.5.12 8 | environment: 9 | PYTHON_VERSION: 2.7 10 | 11 | steps: 12 | - run: 13 | name: checkout project 14 | command: | 15 | git clone https://github.com/jackparmer/colorlover.git 16 | cd colorlover 17 | git checkout ${CIRCLE_BRANCH} 18 | - run: 19 | name: create environemnt 20 | command: 21 | colorlover/.circleci/create_env.sh 22 | - run: 23 | name: run tests and create coverage artifact 24 | command: colorlover/.circleci/run_tests.sh 25 | - store_artifacts: 26 | path: artifacts/ 27 | 28 | python-3.4-core: 29 | docker: 30 | - image: continuumio/miniconda3:4.5.12 31 | environment: 32 | PYTHON_VERSION: 3.4 33 | 34 | steps: 35 | - run: 36 | name: checkout project 37 | command: | 38 | git clone https://github.com/jackparmer/colorlover.git 39 | cd colorlover 40 | git checkout ${CIRCLE_BRANCH} 41 | - run: 42 | name: create environemnt 43 | command: 44 | colorlover/.circleci/create_env.sh 45 | - run: 46 | name: run tests and create coverage artifact 47 | command: colorlover/.circleci/run_tests.sh 48 | - store_artifacts: 49 | path: artifacts/ 50 | 51 | 52 | python-3.7-core: 53 | docker: 54 | - image: continuumio/miniconda3:4.5.12 55 | environment: 56 | PYTHON_VERSION: 3.7 57 | BUILD_COVERAGE_REPORT: 1 58 | 59 | steps: 60 | - run: 61 | name: checkout project 62 | command: | 63 | git clone https://github.com/jackparmer/colorlover.git 64 | cd colorlover 65 | git checkout ${CIRCLE_BRANCH} 66 | - run: 67 | name: create environemnt 68 | command: 69 | colorlover/.circleci/create_env.sh 70 | - run: 71 | name: run tests and create coverage artifact 72 | command: colorlover/.circleci/run_tests.sh 73 | - store_artifacts: 74 | path: artifacts/ 75 | 76 | workflows: 77 | version: 2 78 | build: 79 | jobs: 80 | - python-2.7-core 81 | - python-3.4-core 82 | - python-3.7-core 83 | -------------------------------------------------------------------------------- /.circleci/create_env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | conda create -y -n colorlover_env python=$PYTHON_VERSION nose coverage zip 3 | source activate colorlover_env 4 | pip install -I colorlover/ -------------------------------------------------------------------------------- /.circleci/run_tests.sh: -------------------------------------------------------------------------------- 1 | source activate colorlover_env 2 | cd colorlover 3 | nosetests -xv tests.py --with-coverage 4 | mkdir ../artifacts/ 5 | 6 | if [ "$BUILD_COVERAGE_REPORT" = "1" ] 7 | then 8 | coverage html -d ./coverage --title=$PYTHON_VERSION 9 | zip ../artifacts/coverage_$PYTHON_VERSION.zip coverage/* 10 | fi 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | env/ 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | lib/ 17 | lib64/ 18 | parts/ 19 | sdist/ 20 | var/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | 25 | # PyInstaller 26 | # Usually these files are written by a python script from a template 27 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 28 | *.manifest 29 | *.spec 30 | 31 | # Installer logs 32 | pip-log.txt 33 | pip-delete-this-directory.txt 34 | 35 | # Unit test / coverage reports 36 | htmlcov/ 37 | .tox/ 38 | .coverage 39 | .cache 40 | nosetests.xml 41 | coverage.xml 42 | 43 | # Translations 44 | *.mo 45 | *.pot 46 | 47 | # Django stuff: 48 | *.log 49 | 50 | # Sphinx documentation 51 | docs/_build/ 52 | 53 | # PyBuilder 54 | target/ 55 | 56 | # iPython Checkpoints 57 | .ipynb_checkpoints/ 58 | 59 | .DS_Store 60 | 61 | vv/* 62 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at accounts@plot.ly. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.4, available at [http://contributor-covenant.org/version/1/4](http://contributor-covenant.org/version/1/4/), and may also be found online at . 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Jack Parmer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | Contact GitHub API Training Shop Blog About 23 | -------------------------------------------------------------------------------- /MANIFEST: -------------------------------------------------------------------------------- 1 | # file GENERATED by distutils, do NOT edit 2 | LICENSE 3 | README.md 4 | setup.py 5 | colorlover/__init__.py 6 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include README.md 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # colorlover 2 | 3 | Color scales for humans 4 | 5 |
6 | 7 | Maintained by Plotly 8 | 9 |
10 | 11 | 12 | IPython notebook: https://plot.ly/ipython-notebooks/color-scales/ 13 | 14 | ``` 15 | import colorlover as cl 16 | from IPython.display import HTML 17 | HTML(cl.to_html( cl.flipper()['seq']['3'] )) 18 | ``` 19 | 20 | ![alt tag](http://i.imgur.com/XUUYEKy.png) 21 | 22 | 23 | ## Install 24 | 25 | ``` 26 | sudo pip install colorlover 27 | ``` 28 | 29 | ## IPython notebook (demo) 30 | 31 | https://plot.ly/ipython-notebooks/color-scales/ 32 | 33 | ## Docs 34 | 35 | ### cl.scales 36 | 37 | All of the color scales in colorlover 38 | 39 | ``` 40 | >>> import colorlover as cl 41 | >>> cl.scales['3']['div']['RdYlBu'] 42 | 43 | ['rgb(252,141,89)', 'rgb(255,255,191)', 'rgb(145,191,219)'] 44 | ``` 45 | 46 | ### cl.to_numeric( scale ) 47 | 48 | Converts scale of RGB or HSL strings to list of tuples with RGB integer values 49 | 50 | ``` 51 | >>> cl.to_numeric( cl.scales['3']['div']['RdYlBu'] ) 52 | 53 | [(252.0, 141.0, 89.0), (255.0, 255.0, 191.0), (145.0, 191.0, 219.0)] 54 | ``` 55 | 56 | ### cl.to_hsl( scale ) 57 | 58 | Converts a string RGB or numeric RGB colorscale to HSL 59 | 60 | ``` 61 | >>> cl.to_hsl( cl.scales['3']['div']['RdYlBu'] ) 62 | 63 | ['hsl(19.0, 96.0%, 67.0%)', 'hsl(60.0, 100.0%, 87.0%)', 'hsl(203.0, 51.0%, 71.0%)'] 64 | ``` 65 | 66 | ### cl.to_rgb( scale ) 67 | 68 | Convert an HSL or numeric RGB color scale to string RGB color scale 69 | 70 | ``` 71 | >>> cl.to_rgb( cl.scales['3']['div']['RdYlBu'] ) 72 | 73 | ['rgb(252,141,89)', 'rgb(255,255,191)', 'rgb(145,191,219)'] 74 | ``` 75 | 76 | ### cl.to_html( scale ) 77 | 78 | Traverse color scale dictionary and return available color scales as HTML string 79 | 80 | ``` 81 | >>> cl.to_html( cl.scales['3']['div']['RdYlBu'] ) 82 | 83 | '
' 84 | ``` 85 | 86 | ### cl.flipper( scale=None ) 87 | 88 | Return the inverse of the color scale dictionary cl.scale 89 | 90 | ``` 91 | >>> cl.flipper()['div']['3']['RdYlBu'] 92 | 93 | ['rgb(252,141,89)', 'rgb(255,255,191)', 'rgb(145,191,219)'] 94 | ``` 95 | 96 | ### cl.interp( scale, r ) 97 | 98 | def interp(scl, r): 99 | 100 | Interpolate a color scale "scale" to a new one with length "r" 101 | 102 | ``` 103 | # fun usage in IPython notebook 104 | from IPython.display import HTML 105 | HTML( to_html( to_hsl( interp( cl.scales['11']['qual']['Paired'], 5000 ) ) ) ) 106 | ``` 107 | 108 | ## All colors in cl.scales 109 | 110 | ``` 111 | # (in IPython notebook) 112 | from IPython.display import HTML 113 | HTML(cl.to_html( cl.scales )) 114 | ``` 115 | -------------------------------------------------------------------------------- /colorlover/__init__.py: -------------------------------------------------------------------------------- 1 | import colorsys 2 | from collections import defaultdict 3 | import math 4 | 5 | scales = {'10': {'div': {'BrBG': ['rgb(84,48,5)', 6 | 'rgb(140,81,10)', 7 | 'rgb(191,129,45)', 8 | 'rgb(223,194,125)', 9 | 'rgb(246,232,195)', 10 | 'rgb(199,234,229)', 11 | 'rgb(128,205,193)', 12 | 'rgb(53,151,143)', 13 | 'rgb(1,102,94)', 14 | 'rgb(0,60,48)'], 15 | 'PRGn': ['rgb(64,0,75)', 16 | 'rgb(118,42,131)', 17 | 'rgb(153,112,171)', 18 | 'rgb(194,165,207)', 19 | 'rgb(231,212,232)', 20 | 'rgb(217,240,211)', 21 | 'rgb(166,219,160)', 22 | 'rgb(90,174,97)', 23 | 'rgb(27,120,55)', 24 | 'rgb(0,68,27)'], 25 | 'PiYG': ['rgb(142,1,82)', 26 | 'rgb(197,27,125)', 27 | 'rgb(222,119,174)', 28 | 'rgb(241,182,218)', 29 | 'rgb(253,224,239)', 30 | 'rgb(230,245,208)', 31 | 'rgb(184,225,134)', 32 | 'rgb(127,188,65)', 33 | 'rgb(77,146,33)', 34 | 'rgb(39,100,25)'], 35 | 'PuOr': ['rgb(127,59,8)', 36 | 'rgb(179,88,6)', 37 | 'rgb(224,130,20)', 38 | 'rgb(253,184,99)', 39 | 'rgb(254,224,182)', 40 | 'rgb(216,218,235)', 41 | 'rgb(178,171,210)', 42 | 'rgb(128,115,172)', 43 | 'rgb(84,39,136)', 44 | 'rgb(45,0,75)'], 45 | 'RdBu': ['rgb(103,0,31)', 46 | 'rgb(178,24,43)', 47 | 'rgb(214,96,77)', 48 | 'rgb(244,165,130)', 49 | 'rgb(253,219,199)', 50 | 'rgb(209,229,240)', 51 | 'rgb(146,197,222)', 52 | 'rgb(67,147,195)', 53 | 'rgb(33,102,172)', 54 | 'rgb(5,48,97)'], 55 | 'RdGy': ['rgb(103,0,31)', 56 | 'rgb(178,24,43)', 57 | 'rgb(214,96,77)', 58 | 'rgb(244,165,130)', 59 | 'rgb(253,219,199)', 60 | 'rgb(224,224,224)', 61 | 'rgb(186,186,186)', 62 | 'rgb(135,135,135)', 63 | 'rgb(77,77,77)', 64 | 'rgb(26,26,26)'], 65 | 'RdYlBu': ['rgb(165,0,38)', 66 | 'rgb(215,48,39)', 67 | 'rgb(244,109,67)', 68 | 'rgb(253,174,97)', 69 | 'rgb(254,224,144)', 70 | 'rgb(224,243,248)', 71 | 'rgb(171,217,233)', 72 | 'rgb(116,173,209)', 73 | 'rgb(69,117,180)', 74 | 'rgb(49,54,149)'], 75 | 'RdYlGn': ['rgb(165,0,38)', 76 | 'rgb(215,48,39)', 77 | 'rgb(244,109,67)', 78 | 'rgb(253,174,97)', 79 | 'rgb(254,224,139)', 80 | 'rgb(217,239,139)', 81 | 'rgb(166,217,106)', 82 | 'rgb(102,189,99)', 83 | 'rgb(26,152,80)', 84 | 'rgb(0,104,55)'], 85 | 'Spectral': ['rgb(158,1,66)', 86 | 'rgb(213,62,79)', 87 | 'rgb(244,109,67)', 88 | 'rgb(253,174,97)', 89 | 'rgb(254,224,139)', 90 | 'rgb(230,245,152)', 91 | 'rgb(171,221,164)', 92 | 'rgb(102,194,165)', 93 | 'rgb(50,136,189)', 94 | 'rgb(94,79,162)']}, 95 | 'qual': {'Paired': ['rgb(166,206,227)', 96 | 'rgb(31,120,180)', 97 | 'rgb(178,223,138)', 98 | 'rgb(51,160,44)', 99 | 'rgb(251,154,153)', 100 | 'rgb(227,26,28)', 101 | 'rgb(253,191,111)', 102 | 'rgb(255,127,0)', 103 | 'rgb(202,178,214)', 104 | 'rgb(106,61,154)'], 105 | 'Set3': ['rgb(141,211,199)', 106 | 'rgb(255,255,179)', 107 | 'rgb(190,186,218)', 108 | 'rgb(251,128,114)', 109 | 'rgb(128,177,211)', 110 | 'rgb(253,180,98)', 111 | 'rgb(179,222,105)', 112 | 'rgb(252,205,229)', 113 | 'rgb(217,217,217)', 114 | 'rgb(188,128,189)']}, 115 | 'seq': {}}, 116 | '11': {'div': {'BrBG': ['rgb(84,48,5)', 117 | 'rgb(140,81,10)', 118 | 'rgb(191,129,45)', 119 | 'rgb(223,194,125)', 120 | 'rgb(246,232,195)', 121 | 'rgb(245,245,245)', 122 | 'rgb(199,234,229)', 123 | 'rgb(128,205,193)', 124 | 'rgb(53,151,143)', 125 | 'rgb(1,102,94)', 126 | 'rgb(0,60,48)'], 127 | 'PRGn': ['rgb(64,0,75)', 128 | 'rgb(118,42,131)', 129 | 'rgb(153,112,171)', 130 | 'rgb(194,165,207)', 131 | 'rgb(231,212,232)', 132 | 'rgb(247,247,247)', 133 | 'rgb(217,240,211)', 134 | 'rgb(166,219,160)', 135 | 'rgb(90,174,97)', 136 | 'rgb(27,120,55)', 137 | 'rgb(0,68,27)'], 138 | 'PiYG': ['rgb(142,1,82)', 139 | 'rgb(197,27,125)', 140 | 'rgb(222,119,174)', 141 | 'rgb(241,182,218)', 142 | 'rgb(253,224,239)', 143 | 'rgb(247,247,247)', 144 | 'rgb(230,245,208)', 145 | 'rgb(184,225,134)', 146 | 'rgb(127,188,65)', 147 | 'rgb(77,146,33)', 148 | 'rgb(39,100,25)'], 149 | 'PuOr': ['rgb(127,59,8)', 150 | 'rgb(179,88,6)', 151 | 'rgb(224,130,20)', 152 | 'rgb(253,184,99)', 153 | 'rgb(254,224,182)', 154 | 'rgb(247,247,247)', 155 | 'rgb(216,218,235)', 156 | 'rgb(178,171,210)', 157 | 'rgb(128,115,172)', 158 | 'rgb(84,39,136)', 159 | 'rgb(45,0,75)'], 160 | 'RdBu': ['rgb(103,0,31)', 161 | 'rgb(178,24,43)', 162 | 'rgb(214,96,77)', 163 | 'rgb(244,165,130)', 164 | 'rgb(253,219,199)', 165 | 'rgb(247,247,247)', 166 | 'rgb(209,229,240)', 167 | 'rgb(146,197,222)', 168 | 'rgb(67,147,195)', 169 | 'rgb(33,102,172)', 170 | 'rgb(5,48,97)'], 171 | 'RdGy': ['rgb(103,0,31)', 172 | 'rgb(178,24,43)', 173 | 'rgb(214,96,77)', 174 | 'rgb(244,165,130)', 175 | 'rgb(253,219,199)', 176 | 'rgb(255,255,255)', 177 | 'rgb(224,224,224)', 178 | 'rgb(186,186,186)', 179 | 'rgb(135,135,135)', 180 | 'rgb(77,77,77)', 181 | 'rgb(26,26,26)'], 182 | 'RdYlBu': ['rgb(165,0,38)', 183 | 'rgb(215,48,39)', 184 | 'rgb(244,109,67)', 185 | 'rgb(253,174,97)', 186 | 'rgb(254,224,144)', 187 | 'rgb(255,255,191)', 188 | 'rgb(224,243,248)', 189 | 'rgb(171,217,233)', 190 | 'rgb(116,173,209)', 191 | 'rgb(69,117,180)', 192 | 'rgb(49,54,149)'], 193 | 'RdYlGn': ['rgb(165,0,38)', 194 | 'rgb(215,48,39)', 195 | 'rgb(244,109,67)', 196 | 'rgb(253,174,97)', 197 | 'rgb(254,224,139)', 198 | 'rgb(255,255,191)', 199 | 'rgb(217,239,139)', 200 | 'rgb(166,217,106)', 201 | 'rgb(102,189,99)', 202 | 'rgb(26,152,80)', 203 | 'rgb(0,104,55)'], 204 | 'Spectral': ['rgb(158,1,66)', 205 | 'rgb(213,62,79)', 206 | 'rgb(244,109,67)', 207 | 'rgb(253,174,97)', 208 | 'rgb(254,224,139)', 209 | 'rgb(255,255,191)', 210 | 'rgb(230,245,152)', 211 | 'rgb(171,221,164)', 212 | 'rgb(102,194,165)', 213 | 'rgb(50,136,189)', 214 | 'rgb(94,79,162)']}, 215 | 'qual': {'Paired': ['rgb(166,206,227)', 216 | 'rgb(31,120,180)', 217 | 'rgb(178,223,138)', 218 | 'rgb(51,160,44)', 219 | 'rgb(251,154,153)', 220 | 'rgb(227,26,28)', 221 | 'rgb(253,191,111)', 222 | 'rgb(255,127,0)', 223 | 'rgb(202,178,214)', 224 | 'rgb(106,61,154)', 225 | 'rgb(255,255,153)'], 226 | 'Set3': ['rgb(141,211,199)', 227 | 'rgb(255,255,179)', 228 | 'rgb(190,186,218)', 229 | 'rgb(251,128,114)', 230 | 'rgb(128,177,211)', 231 | 'rgb(253,180,98)', 232 | 'rgb(179,222,105)', 233 | 'rgb(252,205,229)', 234 | 'rgb(217,217,217)', 235 | 'rgb(188,128,189)', 236 | 'rgb(204,235,197)']}, 237 | 'seq': {}}, 238 | '12': {'div': {}, 239 | 'qual': {'Paired': ['rgb(166,206,227)', 240 | 'rgb(31,120,180)', 241 | 'rgb(178,223,138)', 242 | 'rgb(51,160,44)', 243 | 'rgb(251,154,153)', 244 | 'rgb(227,26,28)', 245 | 'rgb(253,191,111)', 246 | 'rgb(255,127,0)', 247 | 'rgb(202,178,214)', 248 | 'rgb(106,61,154)', 249 | 'rgb(255,255,153)', 250 | 'rgb(177,89,40)'], 251 | 'Set3': ['rgb(141,211,199)', 252 | 'rgb(255,255,179)', 253 | 'rgb(190,186,218)', 254 | 'rgb(251,128,114)', 255 | 'rgb(128,177,211)', 256 | 'rgb(253,180,98)', 257 | 'rgb(179,222,105)', 258 | 'rgb(252,205,229)', 259 | 'rgb(217,217,217)', 260 | 'rgb(188,128,189)', 261 | 'rgb(204,235,197)', 262 | 'rgb(255,237,111)']}, 263 | 'seq': {}}, 264 | '3': {'div': {'BrBG': ['rgb(216,179,101)', 265 | 'rgb(245,245,245)', 266 | 'rgb(90,180,172)'], 267 | 'PRGn': ['rgb(175,141,195)', 'rgb(247,247,247)', 'rgb(127,191,123)'], 268 | 'PiYG': ['rgb(233,163,201)', 'rgb(247,247,247)', 'rgb(161,215,106)'], 269 | 'PuOr': ['rgb(241,163,64)', 'rgb(247,247,247)', 'rgb(153,142,195)'], 270 | 'RdBu': ['rgb(239,138,98)', 'rgb(247,247,247)', 'rgb(103,169,207)'], 271 | 'RdGy': ['rgb(239,138,98)', 'rgb(255,255,255)', 'rgb(153,153,153)'], 272 | 'RdYlBu': ['rgb(252,141,89)', 'rgb(255,255,191)', 'rgb(145,191,219)'], 273 | 'RdYlGn': ['rgb(252,141,89)', 'rgb(255,255,191)', 'rgb(145,207,96)'], 274 | 'Spectral': ['rgb(252,141,89)', 'rgb(255,255,191)', 'rgb(153,213,148)']}, 275 | 'qual': {'Accent': ['rgb(127,201,127)', 276 | 'rgb(190,174,212)', 277 | 'rgb(253,192,134)'], 278 | 'Dark2': ['rgb(27,158,119)', 'rgb(217,95,2)', 'rgb(117,112,179)'], 279 | 'Paired': ['rgb(166,206,227)', 'rgb(31,120,180)', 'rgb(178,223,138)'], 280 | 'Pastel1': ['rgb(251,180,174)', 'rgb(179,205,227)', 'rgb(204,235,197)'], 281 | 'Pastel2': ['rgb(179,226,205)', 'rgb(253,205,172)', 'rgb(203,213,232)'], 282 | 'Set1': ['rgb(228,26,28)', 'rgb(55,126,184)', 'rgb(77,175,74)'], 283 | 'Set2': ['rgb(102,194,165)', 'rgb(252,141,98)', 'rgb(141,160,203)'], 284 | 'Set3': ['rgb(141,211,199)', 'rgb(255,255,179)', 'rgb(190,186,218)']}, 285 | 'seq': {'Blues': ['rgb(222,235,247)', 'rgb(158,202,225)', 'rgb(49,130,189)'], 286 | 'BuGn': ['rgb(229,245,249)', 'rgb(153,216,201)', 'rgb(44,162,95)'], 287 | 'BuPu': ['rgb(224,236,244)', 'rgb(158,188,218)', 'rgb(136,86,167)'], 288 | 'GnBu': ['rgb(224,243,219)', 'rgb(168,221,181)', 'rgb(67,162,202)'], 289 | 'Greens': ['rgb(229,245,224)', 'rgb(161,217,155)', 'rgb(49,163,84)'], 290 | 'Greys': ['rgb(240,240,240)', 'rgb(189,189,189)', 'rgb(99,99,99)'], 291 | 'OrRd': ['rgb(254,232,200)', 'rgb(253,187,132)', 'rgb(227,74,51)'], 292 | 'Oranges': ['rgb(254,230,206)', 'rgb(253,174,107)', 'rgb(230,85,13)'], 293 | 'PuBu': ['rgb(236,231,242)', 'rgb(166,189,219)', 'rgb(43,140,190)'], 294 | 'PuBuGn': ['rgb(236,226,240)', 'rgb(166,189,219)', 'rgb(28,144,153)'], 295 | 'PuRd': ['rgb(231,225,239)', 'rgb(201,148,199)', 'rgb(221,28,119)'], 296 | 'Purples': ['rgb(239,237,245)', 'rgb(188,189,220)', 'rgb(117,107,177)'], 297 | 'RdPu': ['rgb(253,224,221)', 'rgb(250,159,181)', 'rgb(197,27,138)'], 298 | 'Reds': ['rgb(254,224,210)', 'rgb(252,146,114)', 'rgb(222,45,38)'], 299 | 'YlGn': ['rgb(247,252,185)', 'rgb(173,221,142)', 'rgb(49,163,84)'], 300 | 'YlGnBu': ['rgb(237,248,177)', 'rgb(127,205,187)', 'rgb(44,127,184)'], 301 | 'YlOrBr': ['rgb(255,247,188)', 'rgb(254,196,79)', 'rgb(217,95,14)'], 302 | 'YlOrRd': ['rgb(255,237,160)', 'rgb(254,178,76)', 'rgb(240,59,32)']}}, 303 | '4': {'div': {'BrBG': ['rgb(166,97,26)', 304 | 'rgb(223,194,125)', 305 | 'rgb(128,205,193)', 306 | 'rgb(1,133,113)'], 307 | 'PRGn': ['rgb(123,50,148)', 308 | 'rgb(194,165,207)', 309 | 'rgb(166,219,160)', 310 | 'rgb(0,136,55)'], 311 | 'PiYG': ['rgb(208,28,139)', 312 | 'rgb(241,182,218)', 313 | 'rgb(184,225,134)', 314 | 'rgb(77,172,38)'], 315 | 'PuOr': ['rgb(230,97,1)', 316 | 'rgb(253,184,99)', 317 | 'rgb(178,171,210)', 318 | 'rgb(94,60,153)'], 319 | 'RdBu': ['rgb(202,0,32)', 320 | 'rgb(244,165,130)', 321 | 'rgb(146,197,222)', 322 | 'rgb(5,113,176)'], 323 | 'RdGy': ['rgb(202,0,32)', 324 | 'rgb(244,165,130)', 325 | 'rgb(186,186,186)', 326 | 'rgb(64,64,64)'], 327 | 'RdYlBu': ['rgb(215,25,28)', 328 | 'rgb(253,174,97)', 329 | 'rgb(171,217,233)', 330 | 'rgb(44,123,182)'], 331 | 'RdYlGn': ['rgb(215,25,28)', 332 | 'rgb(253,174,97)', 333 | 'rgb(166,217,106)', 334 | 'rgb(26,150,65)'], 335 | 'Spectral': ['rgb(215,25,28)', 336 | 'rgb(253,174,97)', 337 | 'rgb(171,221,164)', 338 | 'rgb(43,131,186)']}, 339 | 'qual': {'Accent': ['rgb(127,201,127)', 340 | 'rgb(190,174,212)', 341 | 'rgb(253,192,134)', 342 | 'rgb(255,255,153)'], 343 | 'Dark2': ['rgb(27,158,119)', 344 | 'rgb(217,95,2)', 345 | 'rgb(117,112,179)', 346 | 'rgb(231,41,138)'], 347 | 'Paired': ['rgb(166,206,227)', 348 | 'rgb(31,120,180)', 349 | 'rgb(178,223,138)', 350 | 'rgb(51,160,44)'], 351 | 'Pastel1': ['rgb(251,180,174)', 352 | 'rgb(179,205,227)', 353 | 'rgb(204,235,197)', 354 | 'rgb(222,203,228)'], 355 | 'Pastel2': ['rgb(179,226,205)', 356 | 'rgb(253,205,172)', 357 | 'rgb(203,213,232)', 358 | 'rgb(244,202,228)'], 359 | 'Set1': ['rgb(228,26,28)', 360 | 'rgb(55,126,184)', 361 | 'rgb(77,175,74)', 362 | 'rgb(152,78,163)'], 363 | 'Set2': ['rgb(102,194,165)', 364 | 'rgb(252,141,98)', 365 | 'rgb(141,160,203)', 366 | 'rgb(231,138,195)'], 367 | 'Set3': ['rgb(141,211,199)', 368 | 'rgb(255,255,179)', 369 | 'rgb(190,186,218)', 370 | 'rgb(251,128,114)']}, 371 | 'seq': {'Blues': ['rgb(239,243,255)', 372 | 'rgb(189,215,231)', 373 | 'rgb(107,174,214)', 374 | 'rgb(33,113,181)'], 375 | 'BuGn': ['rgb(237,248,251)', 376 | 'rgb(178,226,226)', 377 | 'rgb(102,194,164)', 378 | 'rgb(35,139,69)'], 379 | 'BuPu': ['rgb(237,248,251)', 380 | 'rgb(179,205,227)', 381 | 'rgb(140,150,198)', 382 | 'rgb(136,65,157)'], 383 | 'GnBu': ['rgb(240,249,232)', 384 | 'rgb(186,228,188)', 385 | 'rgb(123,204,196)', 386 | 'rgb(43,140,190)'], 387 | 'Greens': ['rgb(237,248,233)', 388 | 'rgb(186,228,179)', 389 | 'rgb(116,196,118)', 390 | 'rgb(35,139,69)'], 391 | 'Greys': ['rgb(247,247,247)', 392 | 'rgb(204,204,204)', 393 | 'rgb(150,150,150)', 394 | 'rgb(82,82,82)'], 395 | 'OrRd': ['rgb(254,240,217)', 396 | 'rgb(253,204,138)', 397 | 'rgb(252,141,89)', 398 | 'rgb(215,48,31)'], 399 | 'Oranges': ['rgb(254,237,222)', 400 | 'rgb(253,190,133)', 401 | 'rgb(253,141,60)', 402 | 'rgb(217,71,1)'], 403 | 'PuBu': ['rgb(241,238,246)', 404 | 'rgb(189,201,225)', 405 | 'rgb(116,169,207)', 406 | 'rgb(5,112,176)'], 407 | 'PuBuGn': ['rgb(246,239,247)', 408 | 'rgb(189,201,225)', 409 | 'rgb(103,169,207)', 410 | 'rgb(2,129,138)'], 411 | 'PuRd': ['rgb(241,238,246)', 412 | 'rgb(215,181,216)', 413 | 'rgb(223,101,176)', 414 | 'rgb(206,18,86)'], 415 | 'Purples': ['rgb(242,240,247)', 416 | 'rgb(203,201,226)', 417 | 'rgb(158,154,200)', 418 | 'rgb(106,81,163)'], 419 | 'RdPu': ['rgb(254,235,226)', 420 | 'rgb(251,180,185)', 421 | 'rgb(247,104,161)', 422 | 'rgb(174,1,126)'], 423 | 'Reds': ['rgb(254,229,217)', 424 | 'rgb(252,174,145)', 425 | 'rgb(251,106,74)', 426 | 'rgb(203,24,29)'], 427 | 'YlGn': ['rgb(255,255,204)', 428 | 'rgb(194,230,153)', 429 | 'rgb(120,198,121)', 430 | 'rgb(35,132,67)'], 431 | 'YlGnBu': ['rgb(255,255,204)', 432 | 'rgb(161,218,180)', 433 | 'rgb(65,182,196)', 434 | 'rgb(34,94,168)'], 435 | 'YlOrBr': ['rgb(255,255,212)', 436 | 'rgb(254,217,142)', 437 | 'rgb(254,153,41)', 438 | 'rgb(204,76,2)'], 439 | 'YlOrRd': ['rgb(255,255,178)', 440 | 'rgb(254,204,92)', 441 | 'rgb(253,141,60)', 442 | 'rgb(227,26,28)']}}, 443 | '5': {'div': {'BrBG': ['rgb(166,97,26)', 444 | 'rgb(223,194,125)', 445 | 'rgb(245,245,245)', 446 | 'rgb(128,205,193)', 447 | 'rgb(1,133,113)'], 448 | 'PRGn': ['rgb(123,50,148)', 449 | 'rgb(194,165,207)', 450 | 'rgb(247,247,247)', 451 | 'rgb(166,219,160)', 452 | 'rgb(0,136,55)'], 453 | 'PiYG': ['rgb(208,28,139)', 454 | 'rgb(241,182,218)', 455 | 'rgb(247,247,247)', 456 | 'rgb(184,225,134)', 457 | 'rgb(77,172,38)'], 458 | 'PuOr': ['rgb(230,97,1)', 459 | 'rgb(253,184,99)', 460 | 'rgb(247,247,247)', 461 | 'rgb(178,171,210)', 462 | 'rgb(94,60,153)'], 463 | 'RdBu': ['rgb(202,0,32)', 464 | 'rgb(244,165,130)', 465 | 'rgb(247,247,247)', 466 | 'rgb(146,197,222)', 467 | 'rgb(5,113,176)'], 468 | 'RdGy': ['rgb(202,0,32)', 469 | 'rgb(244,165,130)', 470 | 'rgb(255,255,255)', 471 | 'rgb(186,186,186)', 472 | 'rgb(64,64,64)'], 473 | 'RdYlBu': ['rgb(215,25,28)', 474 | 'rgb(253,174,97)', 475 | 'rgb(255,255,191)', 476 | 'rgb(171,217,233)', 477 | 'rgb(44,123,182)'], 478 | 'RdYlGn': ['rgb(215,25,28)', 479 | 'rgb(253,174,97)', 480 | 'rgb(255,255,191)', 481 | 'rgb(166,217,106)', 482 | 'rgb(26,150,65)'], 483 | 'Spectral': ['rgb(215,25,28)', 484 | 'rgb(253,174,97)', 485 | 'rgb(255,255,191)', 486 | 'rgb(171,221,164)', 487 | 'rgb(43,131,186)']}, 488 | 'qual': {'Accent': ['rgb(127,201,127)', 489 | 'rgb(190,174,212)', 490 | 'rgb(253,192,134)', 491 | 'rgb(255,255,153)', 492 | 'rgb(56,108,176)'], 493 | 'Dark2': ['rgb(27,158,119)', 494 | 'rgb(217,95,2)', 495 | 'rgb(117,112,179)', 496 | 'rgb(231,41,138)', 497 | 'rgb(102,166,30)'], 498 | 'Paired': ['rgb(166,206,227)', 499 | 'rgb(31,120,180)', 500 | 'rgb(178,223,138)', 501 | 'rgb(51,160,44)', 502 | 'rgb(251,154,153)'], 503 | 'Pastel1': ['rgb(251,180,174)', 504 | 'rgb(179,205,227)', 505 | 'rgb(204,235,197)', 506 | 'rgb(222,203,228)', 507 | 'rgb(254,217,166)'], 508 | 'Pastel2': ['rgb(179,226,205)', 509 | 'rgb(253,205,172)', 510 | 'rgb(203,213,232)', 511 | 'rgb(244,202,228)', 512 | 'rgb(230,245,201)'], 513 | 'Set1': ['rgb(228,26,28)', 514 | 'rgb(55,126,184)', 515 | 'rgb(77,175,74)', 516 | 'rgb(152,78,163)', 517 | 'rgb(255,127,0)'], 518 | 'Set2': ['rgb(102,194,165)', 519 | 'rgb(252,141,98)', 520 | 'rgb(141,160,203)', 521 | 'rgb(231,138,195)', 522 | 'rgb(166,216,84)'], 523 | 'Set3': ['rgb(141,211,199)', 524 | 'rgb(255,255,179)', 525 | 'rgb(190,186,218)', 526 | 'rgb(251,128,114)', 527 | 'rgb(128,177,211)']}, 528 | 'seq': {'Blues': ['rgb(239,243,255)', 529 | 'rgb(189,215,231)', 530 | 'rgb(107,174,214)', 531 | 'rgb(49,130,189)', 532 | 'rgb(8,81,156)'], 533 | 'BuGn': ['rgb(237,248,251)', 534 | 'rgb(178,226,226)', 535 | 'rgb(102,194,164)', 536 | 'rgb(44,162,95)', 537 | 'rgb(0,109,44)'], 538 | 'BuPu': ['rgb(237,248,251)', 539 | 'rgb(179,205,227)', 540 | 'rgb(140,150,198)', 541 | 'rgb(136,86,167)', 542 | 'rgb(129,15,124)'], 543 | 'GnBu': ['rgb(240,249,232)', 544 | 'rgb(186,228,188)', 545 | 'rgb(123,204,196)', 546 | 'rgb(67,162,202)', 547 | 'rgb(8,104,172)'], 548 | 'Greens': ['rgb(237,248,233)', 549 | 'rgb(186,228,179)', 550 | 'rgb(116,196,118)', 551 | 'rgb(49,163,84)', 552 | 'rgb(0,109,44)'], 553 | 'Greys': ['rgb(247,247,247)', 554 | 'rgb(204,204,204)', 555 | 'rgb(150,150,150)', 556 | 'rgb(99,99,99)', 557 | 'rgb(37,37,37)'], 558 | 'OrRd': ['rgb(254,240,217)', 559 | 'rgb(253,204,138)', 560 | 'rgb(252,141,89)', 561 | 'rgb(227,74,51)', 562 | 'rgb(179,0,0)'], 563 | 'Oranges': ['rgb(254,237,222)', 564 | 'rgb(253,190,133)', 565 | 'rgb(253,141,60)', 566 | 'rgb(230,85,13)', 567 | 'rgb(166,54,3)'], 568 | 'PuBu': ['rgb(241,238,246)', 569 | 'rgb(189,201,225)', 570 | 'rgb(116,169,207)', 571 | 'rgb(43,140,190)', 572 | 'rgb(4,90,141)'], 573 | 'PuBuGn': ['rgb(246,239,247)', 574 | 'rgb(189,201,225)', 575 | 'rgb(103,169,207)', 576 | 'rgb(28,144,153)', 577 | 'rgb(1,108,89)'], 578 | 'PuRd': ['rgb(241,238,246)', 579 | 'rgb(215,181,216)', 580 | 'rgb(223,101,176)', 581 | 'rgb(221,28,119)', 582 | 'rgb(152,0,67)'], 583 | 'Purples': ['rgb(242,240,247)', 584 | 'rgb(203,201,226)', 585 | 'rgb(158,154,200)', 586 | 'rgb(117,107,177)', 587 | 'rgb(84,39,143)'], 588 | 'RdPu': ['rgb(254,235,226)', 589 | 'rgb(251,180,185)', 590 | 'rgb(247,104,161)', 591 | 'rgb(197,27,138)', 592 | 'rgb(122,1,119)'], 593 | 'Reds': ['rgb(254,229,217)', 594 | 'rgb(252,174,145)', 595 | 'rgb(251,106,74)', 596 | 'rgb(222,45,38)', 597 | 'rgb(165,15,21)'], 598 | 'YlGn': ['rgb(255,255,204)', 599 | 'rgb(194,230,153)', 600 | 'rgb(120,198,121)', 601 | 'rgb(49,163,84)', 602 | 'rgb(0,104,55)'], 603 | 'YlGnBu': ['rgb(255,255,204)', 604 | 'rgb(161,218,180)', 605 | 'rgb(65,182,196)', 606 | 'rgb(44,127,184)', 607 | 'rgb(37,52,148)'], 608 | 'YlOrBr': ['rgb(255,255,212)', 609 | 'rgb(254,217,142)', 610 | 'rgb(254,153,41)', 611 | 'rgb(217,95,14)', 612 | 'rgb(153,52,4)'], 613 | 'YlOrRd': ['rgb(255,255,178)', 614 | 'rgb(254,204,92)', 615 | 'rgb(253,141,60)', 616 | 'rgb(240,59,32)', 617 | 'rgb(189,0,38)']}}, 618 | '6': {'div': {'BrBG': ['rgb(140,81,10)', 619 | 'rgb(216,179,101)', 620 | 'rgb(246,232,195)', 621 | 'rgb(199,234,229)', 622 | 'rgb(90,180,172)', 623 | 'rgb(1,102,94)'], 624 | 'PRGn': ['rgb(118,42,131)', 625 | 'rgb(175,141,195)', 626 | 'rgb(231,212,232)', 627 | 'rgb(217,240,211)', 628 | 'rgb(127,191,123)', 629 | 'rgb(27,120,55)'], 630 | 'PiYG': ['rgb(197,27,125)', 631 | 'rgb(233,163,201)', 632 | 'rgb(253,224,239)', 633 | 'rgb(230,245,208)', 634 | 'rgb(161,215,106)', 635 | 'rgb(77,146,33)'], 636 | 'PuOr': ['rgb(179,88,6)', 637 | 'rgb(241,163,64)', 638 | 'rgb(254,224,182)', 639 | 'rgb(216,218,235)', 640 | 'rgb(153,142,195)', 641 | 'rgb(84,39,136)'], 642 | 'RdBu': ['rgb(178,24,43)', 643 | 'rgb(239,138,98)', 644 | 'rgb(253,219,199)', 645 | 'rgb(209,229,240)', 646 | 'rgb(103,169,207)', 647 | 'rgb(33,102,172)'], 648 | 'RdGy': ['rgb(178,24,43)', 649 | 'rgb(239,138,98)', 650 | 'rgb(253,219,199)', 651 | 'rgb(224,224,224)', 652 | 'rgb(153,153,153)', 653 | 'rgb(77,77,77)'], 654 | 'RdYlBu': ['rgb(215,48,39)', 655 | 'rgb(252,141,89)', 656 | 'rgb(254,224,144)', 657 | 'rgb(224,243,248)', 658 | 'rgb(145,191,219)', 659 | 'rgb(69,117,180)'], 660 | 'RdYlGn': ['rgb(215,48,39)', 661 | 'rgb(252,141,89)', 662 | 'rgb(254,224,139)', 663 | 'rgb(217,239,139)', 664 | 'rgb(145,207,96)', 665 | 'rgb(26,152,80)'], 666 | 'Spectral': ['rgb(213,62,79)', 667 | 'rgb(252,141,89)', 668 | 'rgb(254,224,139)', 669 | 'rgb(230,245,152)', 670 | 'rgb(153,213,148)', 671 | 'rgb(50,136,189)']}, 672 | 'qual': {'Accent': ['rgb(127,201,127)', 673 | 'rgb(190,174,212)', 674 | 'rgb(253,192,134)', 675 | 'rgb(255,255,153)', 676 | 'rgb(56,108,176)', 677 | 'rgb(240,2,127)'], 678 | 'Dark2': ['rgb(27,158,119)', 679 | 'rgb(217,95,2)', 680 | 'rgb(117,112,179)', 681 | 'rgb(231,41,138)', 682 | 'rgb(102,166,30)', 683 | 'rgb(230,171,2)'], 684 | 'Paired': ['rgb(166,206,227)', 685 | 'rgb(31,120,180)', 686 | 'rgb(178,223,138)', 687 | 'rgb(51,160,44)', 688 | 'rgb(251,154,153)', 689 | 'rgb(227,26,28)'], 690 | 'Pastel1': ['rgb(251,180,174)', 691 | 'rgb(179,205,227)', 692 | 'rgb(204,235,197)', 693 | 'rgb(222,203,228)', 694 | 'rgb(254,217,166)', 695 | 'rgb(255,255,204)'], 696 | 'Pastel2': ['rgb(179,226,205)', 697 | 'rgb(253,205,172)', 698 | 'rgb(203,213,232)', 699 | 'rgb(244,202,228)', 700 | 'rgb(230,245,201)', 701 | 'rgb(255,242,174)'], 702 | 'Set1': ['rgb(228,26,28)', 703 | 'rgb(55,126,184)', 704 | 'rgb(77,175,74)', 705 | 'rgb(152,78,163)', 706 | 'rgb(255,127,0)', 707 | 'rgb(255,255,51)'], 708 | 'Set2': ['rgb(102,194,165)', 709 | 'rgb(252,141,98)', 710 | 'rgb(141,160,203)', 711 | 'rgb(231,138,195)', 712 | 'rgb(166,216,84)', 713 | 'rgb(255,217,47)'], 714 | 'Set3': ['rgb(141,211,199)', 715 | 'rgb(255,255,179)', 716 | 'rgb(190,186,218)', 717 | 'rgb(251,128,114)', 718 | 'rgb(128,177,211)', 719 | 'rgb(253,180,98)']}, 720 | 'seq': {'Blues': ['rgb(239,243,255)', 721 | 'rgb(198,219,239)', 722 | 'rgb(158,202,225)', 723 | 'rgb(107,174,214)', 724 | 'rgb(49,130,189)', 725 | 'rgb(8,81,156)'], 726 | 'BuGn': ['rgb(237,248,251)', 727 | 'rgb(204,236,230)', 728 | 'rgb(153,216,201)', 729 | 'rgb(102,194,164)', 730 | 'rgb(44,162,95)', 731 | 'rgb(0,109,44)'], 732 | 'BuPu': ['rgb(237,248,251)', 733 | 'rgb(191,211,230)', 734 | 'rgb(158,188,218)', 735 | 'rgb(140,150,198)', 736 | 'rgb(136,86,167)', 737 | 'rgb(129,15,124)'], 738 | 'GnBu': ['rgb(240,249,232)', 739 | 'rgb(204,235,197)', 740 | 'rgb(168,221,181)', 741 | 'rgb(123,204,196)', 742 | 'rgb(67,162,202)', 743 | 'rgb(8,104,172)'], 744 | 'Greens': ['rgb(237,248,233)', 745 | 'rgb(199,233,192)', 746 | 'rgb(161,217,155)', 747 | 'rgb(116,196,118)', 748 | 'rgb(49,163,84)', 749 | 'rgb(0,109,44)'], 750 | 'Greys': ['rgb(247,247,247)', 751 | 'rgb(217,217,217)', 752 | 'rgb(189,189,189)', 753 | 'rgb(150,150,150)', 754 | 'rgb(99,99,99)', 755 | 'rgb(37,37,37)'], 756 | 'OrRd': ['rgb(254,240,217)', 757 | 'rgb(253,212,158)', 758 | 'rgb(253,187,132)', 759 | 'rgb(252,141,89)', 760 | 'rgb(227,74,51)', 761 | 'rgb(179,0,0)'], 762 | 'Oranges': ['rgb(254,237,222)', 763 | 'rgb(253,208,162)', 764 | 'rgb(253,174,107)', 765 | 'rgb(253,141,60)', 766 | 'rgb(230,85,13)', 767 | 'rgb(166,54,3)'], 768 | 'PuBu': ['rgb(241,238,246)', 769 | 'rgb(208,209,230)', 770 | 'rgb(166,189,219)', 771 | 'rgb(116,169,207)', 772 | 'rgb(43,140,190)', 773 | 'rgb(4,90,141)'], 774 | 'PuBuGn': ['rgb(246,239,247)', 775 | 'rgb(208,209,230)', 776 | 'rgb(166,189,219)', 777 | 'rgb(103,169,207)', 778 | 'rgb(28,144,153)', 779 | 'rgb(1,108,89)'], 780 | 'PuRd': ['rgb(241,238,246)', 781 | 'rgb(212,185,218)', 782 | 'rgb(201,148,199)', 783 | 'rgb(223,101,176)', 784 | 'rgb(221,28,119)', 785 | 'rgb(152,0,67)'], 786 | 'Purples': ['rgb(242,240,247)', 787 | 'rgb(218,218,235)', 788 | 'rgb(188,189,220)', 789 | 'rgb(158,154,200)', 790 | 'rgb(117,107,177)', 791 | 'rgb(84,39,143)'], 792 | 'RdPu': ['rgb(254,235,226)', 793 | 'rgb(252,197,192)', 794 | 'rgb(250,159,181)', 795 | 'rgb(247,104,161)', 796 | 'rgb(197,27,138)', 797 | 'rgb(122,1,119)'], 798 | 'Reds': ['rgb(254,229,217)', 799 | 'rgb(252,187,161)', 800 | 'rgb(252,146,114)', 801 | 'rgb(251,106,74)', 802 | 'rgb(222,45,38)', 803 | 'rgb(165,15,21)'], 804 | 'YlGn': ['rgb(255,255,204)', 805 | 'rgb(217,240,163)', 806 | 'rgb(173,221,142)', 807 | 'rgb(120,198,121)', 808 | 'rgb(49,163,84)', 809 | 'rgb(0,104,55)'], 810 | 'YlGnBu': ['rgb(255,255,204)', 811 | 'rgb(199,233,180)', 812 | 'rgb(127,205,187)', 813 | 'rgb(65,182,196)', 814 | 'rgb(44,127,184)', 815 | 'rgb(37,52,148)'], 816 | 'YlOrBr': ['rgb(255,255,212)', 817 | 'rgb(254,227,145)', 818 | 'rgb(254,196,79)', 819 | 'rgb(254,153,41)', 820 | 'rgb(217,95,14)', 821 | 'rgb(153,52,4)'], 822 | 'YlOrRd': ['rgb(255,255,178)', 823 | 'rgb(254,217,118)', 824 | 'rgb(254,178,76)', 825 | 'rgb(253,141,60)', 826 | 'rgb(240,59,32)', 827 | 'rgb(189,0,38)']}}, 828 | '7': {'div': {'BrBG': ['rgb(140,81,10)', 829 | 'rgb(216,179,101)', 830 | 'rgb(246,232,195)', 831 | 'rgb(245,245,245)', 832 | 'rgb(199,234,229)', 833 | 'rgb(90,180,172)', 834 | 'rgb(1,102,94)'], 835 | 'PRGn': ['rgb(118,42,131)', 836 | 'rgb(175,141,195)', 837 | 'rgb(231,212,232)', 838 | 'rgb(247,247,247)', 839 | 'rgb(217,240,211)', 840 | 'rgb(127,191,123)', 841 | 'rgb(27,120,55)'], 842 | 'PiYG': ['rgb(197,27,125)', 843 | 'rgb(233,163,201)', 844 | 'rgb(253,224,239)', 845 | 'rgb(247,247,247)', 846 | 'rgb(230,245,208)', 847 | 'rgb(161,215,106)', 848 | 'rgb(77,146,33)'], 849 | 'PuOr': ['rgb(179,88,6)', 850 | 'rgb(241,163,64)', 851 | 'rgb(254,224,182)', 852 | 'rgb(247,247,247)', 853 | 'rgb(216,218,235)', 854 | 'rgb(153,142,195)', 855 | 'rgb(84,39,136)'], 856 | 'RdBu': ['rgb(178,24,43)', 857 | 'rgb(239,138,98)', 858 | 'rgb(253,219,199)', 859 | 'rgb(247,247,247)', 860 | 'rgb(209,229,240)', 861 | 'rgb(103,169,207)', 862 | 'rgb(33,102,172)'], 863 | 'RdGy': ['rgb(178,24,43)', 864 | 'rgb(239,138,98)', 865 | 'rgb(253,219,199)', 866 | 'rgb(255,255,255)', 867 | 'rgb(224,224,224)', 868 | 'rgb(153,153,153)', 869 | 'rgb(77,77,77)'], 870 | 'RdYlBu': ['rgb(215,48,39)', 871 | 'rgb(252,141,89)', 872 | 'rgb(254,224,144)', 873 | 'rgb(255,255,191)', 874 | 'rgb(224,243,248)', 875 | 'rgb(145,191,219)', 876 | 'rgb(69,117,180)'], 877 | 'RdYlGn': ['rgb(215,48,39)', 878 | 'rgb(252,141,89)', 879 | 'rgb(254,224,139)', 880 | 'rgb(255,255,191)', 881 | 'rgb(217,239,139)', 882 | 'rgb(145,207,96)', 883 | 'rgb(26,152,80)'], 884 | 'Spectral': ['rgb(213,62,79)', 885 | 'rgb(252,141,89)', 886 | 'rgb(254,224,139)', 887 | 'rgb(255,255,191)', 888 | 'rgb(230,245,152)', 889 | 'rgb(153,213,148)', 890 | 'rgb(50,136,189)']}, 891 | 'qual': {'Accent': ['rgb(127,201,127)', 892 | 'rgb(190,174,212)', 893 | 'rgb(253,192,134)', 894 | 'rgb(255,255,153)', 895 | 'rgb(56,108,176)', 896 | 'rgb(240,2,127)', 897 | 'rgb(191,91,23)'], 898 | 'Dark2': ['rgb(27,158,119)', 899 | 'rgb(217,95,2)', 900 | 'rgb(117,112,179)', 901 | 'rgb(231,41,138)', 902 | 'rgb(102,166,30)', 903 | 'rgb(230,171,2)', 904 | 'rgb(166,118,29)'], 905 | 'Paired': ['rgb(166,206,227)', 906 | 'rgb(31,120,180)', 907 | 'rgb(178,223,138)', 908 | 'rgb(51,160,44)', 909 | 'rgb(251,154,153)', 910 | 'rgb(227,26,28)', 911 | 'rgb(253,191,111)'], 912 | 'Pastel1': ['rgb(251,180,174)', 913 | 'rgb(179,205,227)', 914 | 'rgb(204,235,197)', 915 | 'rgb(222,203,228)', 916 | 'rgb(254,217,166)', 917 | 'rgb(255,255,204)', 918 | 'rgb(229,216,189)'], 919 | 'Pastel2': ['rgb(179,226,205)', 920 | 'rgb(253,205,172)', 921 | 'rgb(203,213,232)', 922 | 'rgb(244,202,228)', 923 | 'rgb(230,245,201)', 924 | 'rgb(255,242,174)', 925 | 'rgb(241,226,204)'], 926 | 'Set1': ['rgb(228,26,28)', 927 | 'rgb(55,126,184)', 928 | 'rgb(77,175,74)', 929 | 'rgb(152,78,163)', 930 | 'rgb(255,127,0)', 931 | 'rgb(255,255,51)', 932 | 'rgb(166,86,40)'], 933 | 'Set2': ['rgb(102,194,165)', 934 | 'rgb(252,141,98)', 935 | 'rgb(141,160,203)', 936 | 'rgb(231,138,195)', 937 | 'rgb(166,216,84)', 938 | 'rgb(255,217,47)', 939 | 'rgb(229,196,148)'], 940 | 'Set3': ['rgb(141,211,199)', 941 | 'rgb(255,255,179)', 942 | 'rgb(190,186,218)', 943 | 'rgb(251,128,114)', 944 | 'rgb(128,177,211)', 945 | 'rgb(253,180,98)', 946 | 'rgb(179,222,105)']}, 947 | 'seq': {'Blues': ['rgb(239,243,255)', 948 | 'rgb(198,219,239)', 949 | 'rgb(158,202,225)', 950 | 'rgb(107,174,214)', 951 | 'rgb(66,146,198)', 952 | 'rgb(33,113,181)', 953 | 'rgb(8,69,148)'], 954 | 'BuGn': ['rgb(237,248,251)', 955 | 'rgb(204,236,230)', 956 | 'rgb(153,216,201)', 957 | 'rgb(102,194,164)', 958 | 'rgb(65,174,118)', 959 | 'rgb(35,139,69)', 960 | 'rgb(0,88,36)'], 961 | 'BuPu': ['rgb(237,248,251)', 962 | 'rgb(191,211,230)', 963 | 'rgb(158,188,218)', 964 | 'rgb(140,150,198)', 965 | 'rgb(140,107,177)', 966 | 'rgb(136,65,157)', 967 | 'rgb(110,1,107)'], 968 | 'GnBu': ['rgb(240,249,232)', 969 | 'rgb(204,235,197)', 970 | 'rgb(168,221,181)', 971 | 'rgb(123,204,196)', 972 | 'rgb(78,179,211)', 973 | 'rgb(43,140,190)', 974 | 'rgb(8,88,158)'], 975 | 'Greens': ['rgb(237,248,233)', 976 | 'rgb(199,233,192)', 977 | 'rgb(161,217,155)', 978 | 'rgb(116,196,118)', 979 | 'rgb(65,171,93)', 980 | 'rgb(35,139,69)', 981 | 'rgb(0,90,50)'], 982 | 'Greys': ['rgb(247,247,247)', 983 | 'rgb(217,217,217)', 984 | 'rgb(189,189,189)', 985 | 'rgb(150,150,150)', 986 | 'rgb(115,115,115)', 987 | 'rgb(82,82,82)', 988 | 'rgb(37,37,37)'], 989 | 'OrRd': ['rgb(254,240,217)', 990 | 'rgb(253,212,158)', 991 | 'rgb(253,187,132)', 992 | 'rgb(252,141,89)', 993 | 'rgb(239,101,72)', 994 | 'rgb(215,48,31)', 995 | 'rgb(153,0,0)'], 996 | 'Oranges': ['rgb(254,237,222)', 997 | 'rgb(253,208,162)', 998 | 'rgb(253,174,107)', 999 | 'rgb(253,141,60)', 1000 | 'rgb(241,105,19)', 1001 | 'rgb(217,72,1)', 1002 | 'rgb(140,45,4)'], 1003 | 'PuBu': ['rgb(241,238,246)', 1004 | 'rgb(208,209,230)', 1005 | 'rgb(166,189,219)', 1006 | 'rgb(116,169,207)', 1007 | 'rgb(54,144,192)', 1008 | 'rgb(5,112,176)', 1009 | 'rgb(3,78,123)'], 1010 | 'PuBuGn': ['rgb(246,239,247)', 1011 | 'rgb(208,209,230)', 1012 | 'rgb(166,189,219)', 1013 | 'rgb(103,169,207)', 1014 | 'rgb(54,144,192)', 1015 | 'rgb(2,129,138)', 1016 | 'rgb(1,100,80)'], 1017 | 'PuRd': ['rgb(241,238,246)', 1018 | 'rgb(212,185,218)', 1019 | 'rgb(201,148,199)', 1020 | 'rgb(223,101,176)', 1021 | 'rgb(231,41,138)', 1022 | 'rgb(206,18,86)', 1023 | 'rgb(145,0,63)'], 1024 | 'Purples': ['rgb(242,240,247)', 1025 | 'rgb(218,218,235)', 1026 | 'rgb(188,189,220)', 1027 | 'rgb(158,154,200)', 1028 | 'rgb(128,125,186)', 1029 | 'rgb(106,81,163)', 1030 | 'rgb(74,20,134)'], 1031 | 'RdPu': ['rgb(254,235,226)', 1032 | 'rgb(252,197,192)', 1033 | 'rgb(250,159,181)', 1034 | 'rgb(247,104,161)', 1035 | 'rgb(221,52,151)', 1036 | 'rgb(174,1,126)', 1037 | 'rgb(122,1,119)'], 1038 | 'Reds': ['rgb(254,229,217)', 1039 | 'rgb(252,187,161)', 1040 | 'rgb(252,146,114)', 1041 | 'rgb(251,106,74)', 1042 | 'rgb(239,59,44)', 1043 | 'rgb(203,24,29)', 1044 | 'rgb(153,0,13)'], 1045 | 'YlGn': ['rgb(255,255,204)', 1046 | 'rgb(217,240,163)', 1047 | 'rgb(173,221,142)', 1048 | 'rgb(120,198,121)', 1049 | 'rgb(65,171,93)', 1050 | 'rgb(35,132,67)', 1051 | 'rgb(0,90,50)'], 1052 | 'YlGnBu': ['rgb(255,255,204)', 1053 | 'rgb(199,233,180)', 1054 | 'rgb(127,205,187)', 1055 | 'rgb(65,182,196)', 1056 | 'rgb(29,145,192)', 1057 | 'rgb(34,94,168)', 1058 | 'rgb(12,44,132)'], 1059 | 'YlOrBr': ['rgb(255,255,212)', 1060 | 'rgb(254,227,145)', 1061 | 'rgb(254,196,79)', 1062 | 'rgb(254,153,41)', 1063 | 'rgb(236,112,20)', 1064 | 'rgb(204,76,2)', 1065 | 'rgb(140,45,4)'], 1066 | 'YlOrRd': ['rgb(255,255,178)', 1067 | 'rgb(254,217,118)', 1068 | 'rgb(254,178,76)', 1069 | 'rgb(253,141,60)', 1070 | 'rgb(252,78,42)', 1071 | 'rgb(227,26,28)', 1072 | 'rgb(177,0,38)']}}, 1073 | '8': {'div': {'BrBG': ['rgb(140,81,10)', 1074 | 'rgb(191,129,45)', 1075 | 'rgb(223,194,125)', 1076 | 'rgb(246,232,195)', 1077 | 'rgb(199,234,229)', 1078 | 'rgb(128,205,193)', 1079 | 'rgb(53,151,143)', 1080 | 'rgb(1,102,94)'], 1081 | 'PRGn': ['rgb(118,42,131)', 1082 | 'rgb(153,112,171)', 1083 | 'rgb(194,165,207)', 1084 | 'rgb(231,212,232)', 1085 | 'rgb(217,240,211)', 1086 | 'rgb(166,219,160)', 1087 | 'rgb(90,174,97)', 1088 | 'rgb(27,120,55)'], 1089 | 'PiYG': ['rgb(197,27,125)', 1090 | 'rgb(222,119,174)', 1091 | 'rgb(241,182,218)', 1092 | 'rgb(253,224,239)', 1093 | 'rgb(230,245,208)', 1094 | 'rgb(184,225,134)', 1095 | 'rgb(127,188,65)', 1096 | 'rgb(77,146,33)'], 1097 | 'PuOr': ['rgb(179,88,6)', 1098 | 'rgb(224,130,20)', 1099 | 'rgb(253,184,99)', 1100 | 'rgb(254,224,182)', 1101 | 'rgb(216,218,235)', 1102 | 'rgb(178,171,210)', 1103 | 'rgb(128,115,172)', 1104 | 'rgb(84,39,136)'], 1105 | 'RdBu': ['rgb(178,24,43)', 1106 | 'rgb(214,96,77)', 1107 | 'rgb(244,165,130)', 1108 | 'rgb(253,219,199)', 1109 | 'rgb(209,229,240)', 1110 | 'rgb(146,197,222)', 1111 | 'rgb(67,147,195)', 1112 | 'rgb(33,102,172)'], 1113 | 'RdGy': ['rgb(178,24,43)', 1114 | 'rgb(214,96,77)', 1115 | 'rgb(244,165,130)', 1116 | 'rgb(253,219,199)', 1117 | 'rgb(224,224,224)', 1118 | 'rgb(186,186,186)', 1119 | 'rgb(135,135,135)', 1120 | 'rgb(77,77,77)'], 1121 | 'RdYlBu': ['rgb(215,48,39)', 1122 | 'rgb(244,109,67)', 1123 | 'rgb(253,174,97)', 1124 | 'rgb(254,224,144)', 1125 | 'rgb(224,243,248)', 1126 | 'rgb(171,217,233)', 1127 | 'rgb(116,173,209)', 1128 | 'rgb(69,117,180)'], 1129 | 'RdYlGn': ['rgb(215,48,39)', 1130 | 'rgb(244,109,67)', 1131 | 'rgb(253,174,97)', 1132 | 'rgb(254,224,139)', 1133 | 'rgb(217,239,139)', 1134 | 'rgb(166,217,106)', 1135 | 'rgb(102,189,99)', 1136 | 'rgb(26,152,80)'], 1137 | 'Spectral': ['rgb(213,62,79)', 1138 | 'rgb(244,109,67)', 1139 | 'rgb(253,174,97)', 1140 | 'rgb(254,224,139)', 1141 | 'rgb(230,245,152)', 1142 | 'rgb(171,221,164)', 1143 | 'rgb(102,194,165)', 1144 | 'rgb(50,136,189)']}, 1145 | 'qual': {'Accent': ['rgb(127,201,127)', 1146 | 'rgb(190,174,212)', 1147 | 'rgb(253,192,134)', 1148 | 'rgb(255,255,153)', 1149 | 'rgb(56,108,176)', 1150 | 'rgb(240,2,127)', 1151 | 'rgb(191,91,23)', 1152 | 'rgb(102,102,102)'], 1153 | 'Dark2': ['rgb(27,158,119)', 1154 | 'rgb(217,95,2)', 1155 | 'rgb(117,112,179)', 1156 | 'rgb(231,41,138)', 1157 | 'rgb(102,166,30)', 1158 | 'rgb(230,171,2)', 1159 | 'rgb(166,118,29)', 1160 | 'rgb(102,102,102)'], 1161 | 'Paired': ['rgb(166,206,227)', 1162 | 'rgb(31,120,180)', 1163 | 'rgb(178,223,138)', 1164 | 'rgb(51,160,44)', 1165 | 'rgb(251,154,153)', 1166 | 'rgb(227,26,28)', 1167 | 'rgb(253,191,111)', 1168 | 'rgb(255,127,0)'], 1169 | 'Pastel1': ['rgb(251,180,174)', 1170 | 'rgb(179,205,227)', 1171 | 'rgb(204,235,197)', 1172 | 'rgb(222,203,228)', 1173 | 'rgb(254,217,166)', 1174 | 'rgb(255,255,204)', 1175 | 'rgb(229,216,189)', 1176 | 'rgb(253,218,236)'], 1177 | 'Pastel2': ['rgb(179,226,205)', 1178 | 'rgb(253,205,172)', 1179 | 'rgb(203,213,232)', 1180 | 'rgb(244,202,228)', 1181 | 'rgb(230,245,201)', 1182 | 'rgb(255,242,174)', 1183 | 'rgb(241,226,204)', 1184 | 'rgb(204,204,204)'], 1185 | 'Set1': ['rgb(228,26,28)', 1186 | 'rgb(55,126,184)', 1187 | 'rgb(77,175,74)', 1188 | 'rgb(152,78,163)', 1189 | 'rgb(255,127,0)', 1190 | 'rgb(255,255,51)', 1191 | 'rgb(166,86,40)', 1192 | 'rgb(247,129,191)'], 1193 | 'Set2': ['rgb(102,194,165)', 1194 | 'rgb(252,141,98)', 1195 | 'rgb(141,160,203)', 1196 | 'rgb(231,138,195)', 1197 | 'rgb(166,216,84)', 1198 | 'rgb(255,217,47)', 1199 | 'rgb(229,196,148)', 1200 | 'rgb(179,179,179)'], 1201 | 'Set3': ['rgb(141,211,199)', 1202 | 'rgb(255,255,179)', 1203 | 'rgb(190,186,218)', 1204 | 'rgb(251,128,114)', 1205 | 'rgb(128,177,211)', 1206 | 'rgb(253,180,98)', 1207 | 'rgb(179,222,105)', 1208 | 'rgb(252,205,229)']}, 1209 | 'seq': {'Blues': ['rgb(247,251,255)', 1210 | 'rgb(222,235,247)', 1211 | 'rgb(198,219,239)', 1212 | 'rgb(158,202,225)', 1213 | 'rgb(107,174,214)', 1214 | 'rgb(66,146,198)', 1215 | 'rgb(33,113,181)', 1216 | 'rgb(8,69,148)'], 1217 | 'BuGn': ['rgb(247,252,253)', 1218 | 'rgb(229,245,249)', 1219 | 'rgb(204,236,230)', 1220 | 'rgb(153,216,201)', 1221 | 'rgb(102,194,164)', 1222 | 'rgb(65,174,118)', 1223 | 'rgb(35,139,69)', 1224 | 'rgb(0,88,36)'], 1225 | 'BuPu': ['rgb(247,252,253)', 1226 | 'rgb(224,236,244)', 1227 | 'rgb(191,211,230)', 1228 | 'rgb(158,188,218)', 1229 | 'rgb(140,150,198)', 1230 | 'rgb(140,107,177)', 1231 | 'rgb(136,65,157)', 1232 | 'rgb(110,1,107)'], 1233 | 'GnBu': ['rgb(247,252,240)', 1234 | 'rgb(224,243,219)', 1235 | 'rgb(204,235,197)', 1236 | 'rgb(168,221,181)', 1237 | 'rgb(123,204,196)', 1238 | 'rgb(78,179,211)', 1239 | 'rgb(43,140,190)', 1240 | 'rgb(8,88,158)'], 1241 | 'Greens': ['rgb(247,252,245)', 1242 | 'rgb(229,245,224)', 1243 | 'rgb(199,233,192)', 1244 | 'rgb(161,217,155)', 1245 | 'rgb(116,196,118)', 1246 | 'rgb(65,171,93)', 1247 | 'rgb(35,139,69)', 1248 | 'rgb(0,90,50)'], 1249 | 'Greys': ['rgb(255,255,255)', 1250 | 'rgb(240,240,240)', 1251 | 'rgb(217,217,217)', 1252 | 'rgb(189,189,189)', 1253 | 'rgb(150,150,150)', 1254 | 'rgb(115,115,115)', 1255 | 'rgb(82,82,82)', 1256 | 'rgb(37,37,37)'], 1257 | 'OrRd': ['rgb(255,247,236)', 1258 | 'rgb(254,232,200)', 1259 | 'rgb(253,212,158)', 1260 | 'rgb(253,187,132)', 1261 | 'rgb(252,141,89)', 1262 | 'rgb(239,101,72)', 1263 | 'rgb(215,48,31)', 1264 | 'rgb(153,0,0)'], 1265 | 'Oranges': ['rgb(255,245,235)', 1266 | 'rgb(254,230,206)', 1267 | 'rgb(253,208,162)', 1268 | 'rgb(253,174,107)', 1269 | 'rgb(253,141,60)', 1270 | 'rgb(241,105,19)', 1271 | 'rgb(217,72,1)', 1272 | 'rgb(140,45,4)'], 1273 | 'PuBu': ['rgb(255,247,251)', 1274 | 'rgb(236,231,242)', 1275 | 'rgb(208,209,230)', 1276 | 'rgb(166,189,219)', 1277 | 'rgb(116,169,207)', 1278 | 'rgb(54,144,192)', 1279 | 'rgb(5,112,176)', 1280 | 'rgb(3,78,123)'], 1281 | 'PuBuGn': ['rgb(255,247,251)', 1282 | 'rgb(236,226,240)', 1283 | 'rgb(208,209,230)', 1284 | 'rgb(166,189,219)', 1285 | 'rgb(103,169,207)', 1286 | 'rgb(54,144,192)', 1287 | 'rgb(2,129,138)', 1288 | 'rgb(1,100,80)'], 1289 | 'PuRd': ['rgb(247,244,249)', 1290 | 'rgb(231,225,239)', 1291 | 'rgb(212,185,218)', 1292 | 'rgb(201,148,199)', 1293 | 'rgb(223,101,176)', 1294 | 'rgb(231,41,138)', 1295 | 'rgb(206,18,86)', 1296 | 'rgb(145,0,63)'], 1297 | 'Purples': ['rgb(252,251,253)', 1298 | 'rgb(239,237,245)', 1299 | 'rgb(218,218,235)', 1300 | 'rgb(188,189,220)', 1301 | 'rgb(158,154,200)', 1302 | 'rgb(128,125,186)', 1303 | 'rgb(106,81,163)', 1304 | 'rgb(74,20,134)'], 1305 | 'RdPu': ['rgb(255,247,243)', 1306 | 'rgb(253,224,221)', 1307 | 'rgb(252,197,192)', 1308 | 'rgb(250,159,181)', 1309 | 'rgb(247,104,161)', 1310 | 'rgb(221,52,151)', 1311 | 'rgb(174,1,126)', 1312 | 'rgb(122,1,119)'], 1313 | 'Reds': ['rgb(255,245,240)', 1314 | 'rgb(254,224,210)', 1315 | 'rgb(252,187,161)', 1316 | 'rgb(252,146,114)', 1317 | 'rgb(251,106,74)', 1318 | 'rgb(239,59,44)', 1319 | 'rgb(203,24,29)', 1320 | 'rgb(153,0,13)'], 1321 | 'YlGn': ['rgb(255,255,229)', 1322 | 'rgb(247,252,185)', 1323 | 'rgb(217,240,163)', 1324 | 'rgb(173,221,142)', 1325 | 'rgb(120,198,121)', 1326 | 'rgb(65,171,93)', 1327 | 'rgb(35,132,67)', 1328 | 'rgb(0,90,50)'], 1329 | 'YlGnBu': ['rgb(255,255,217)', 1330 | 'rgb(237,248,177)', 1331 | 'rgb(199,233,180)', 1332 | 'rgb(127,205,187)', 1333 | 'rgb(65,182,196)', 1334 | 'rgb(29,145,192)', 1335 | 'rgb(34,94,168)', 1336 | 'rgb(12,44,132)'], 1337 | 'YlOrBr': ['rgb(255,255,229)', 1338 | 'rgb(255,247,188)', 1339 | 'rgb(254,227,145)', 1340 | 'rgb(254,196,79)', 1341 | 'rgb(254,153,41)', 1342 | 'rgb(236,112,20)', 1343 | 'rgb(204,76,2)', 1344 | 'rgb(140,45,4)'], 1345 | 'YlOrRd': ['rgb(255,255,204)', 1346 | 'rgb(255,237,160)', 1347 | 'rgb(254,217,118)', 1348 | 'rgb(254,178,76)', 1349 | 'rgb(253,141,60)', 1350 | 'rgb(252,78,42)', 1351 | 'rgb(227,26,28)', 1352 | 'rgb(177,0,38)']}}, 1353 | '9': {'div': {'BrBG': ['rgb(140,81,10)', 1354 | 'rgb(191,129,45)', 1355 | 'rgb(223,194,125)', 1356 | 'rgb(246,232,195)', 1357 | 'rgb(245,245,245)', 1358 | 'rgb(199,234,229)', 1359 | 'rgb(128,205,193)', 1360 | 'rgb(53,151,143)', 1361 | 'rgb(1,102,94)'], 1362 | 'PRGn': ['rgb(118,42,131)', 1363 | 'rgb(153,112,171)', 1364 | 'rgb(194,165,207)', 1365 | 'rgb(231,212,232)', 1366 | 'rgb(247,247,247)', 1367 | 'rgb(217,240,211)', 1368 | 'rgb(166,219,160)', 1369 | 'rgb(90,174,97)', 1370 | 'rgb(27,120,55)'], 1371 | 'PiYG': ['rgb(197,27,125)', 1372 | 'rgb(222,119,174)', 1373 | 'rgb(241,182,218)', 1374 | 'rgb(253,224,239)', 1375 | 'rgb(247,247,247)', 1376 | 'rgb(230,245,208)', 1377 | 'rgb(184,225,134)', 1378 | 'rgb(127,188,65)', 1379 | 'rgb(77,146,33)'], 1380 | 'PuOr': ['rgb(179,88,6)', 1381 | 'rgb(224,130,20)', 1382 | 'rgb(253,184,99)', 1383 | 'rgb(254,224,182)', 1384 | 'rgb(247,247,247)', 1385 | 'rgb(216,218,235)', 1386 | 'rgb(178,171,210)', 1387 | 'rgb(128,115,172)', 1388 | 'rgb(84,39,136)'], 1389 | 'RdBu': ['rgb(178,24,43)', 1390 | 'rgb(214,96,77)', 1391 | 'rgb(244,165,130)', 1392 | 'rgb(253,219,199)', 1393 | 'rgb(247,247,247)', 1394 | 'rgb(209,229,240)', 1395 | 'rgb(146,197,222)', 1396 | 'rgb(67,147,195)', 1397 | 'rgb(33,102,172)'], 1398 | 'RdGy': ['rgb(178,24,43)', 1399 | 'rgb(214,96,77)', 1400 | 'rgb(244,165,130)', 1401 | 'rgb(253,219,199)', 1402 | 'rgb(255,255,255)', 1403 | 'rgb(224,224,224)', 1404 | 'rgb(186,186,186)', 1405 | 'rgb(135,135,135)', 1406 | 'rgb(77,77,77)'], 1407 | 'RdYlBu': ['rgb(215,48,39)', 1408 | 'rgb(244,109,67)', 1409 | 'rgb(253,174,97)', 1410 | 'rgb(254,224,144)', 1411 | 'rgb(255,255,191)', 1412 | 'rgb(224,243,248)', 1413 | 'rgb(171,217,233)', 1414 | 'rgb(116,173,209)', 1415 | 'rgb(69,117,180)'], 1416 | 'RdYlGn': ['rgb(215,48,39)', 1417 | 'rgb(244,109,67)', 1418 | 'rgb(253,174,97)', 1419 | 'rgb(254,224,139)', 1420 | 'rgb(255,255,191)', 1421 | 'rgb(217,239,139)', 1422 | 'rgb(166,217,106)', 1423 | 'rgb(102,189,99)', 1424 | 'rgb(26,152,80)'], 1425 | 'Spectral': ['rgb(213,62,79)', 1426 | 'rgb(244,109,67)', 1427 | 'rgb(253,174,97)', 1428 | 'rgb(254,224,139)', 1429 | 'rgb(255,255,191)', 1430 | 'rgb(230,245,152)', 1431 | 'rgb(171,221,164)', 1432 | 'rgb(102,194,165)', 1433 | 'rgb(50,136,189)']}, 1434 | 'qual': {'Paired': ['rgb(166,206,227)', 1435 | 'rgb(31,120,180)', 1436 | 'rgb(178,223,138)', 1437 | 'rgb(51,160,44)', 1438 | 'rgb(251,154,153)', 1439 | 'rgb(227,26,28)', 1440 | 'rgb(253,191,111)', 1441 | 'rgb(255,127,0)', 1442 | 'rgb(202,178,214)'], 1443 | 'Pastel1': ['rgb(251,180,174)', 1444 | 'rgb(179,205,227)', 1445 | 'rgb(204,235,197)', 1446 | 'rgb(222,203,228)', 1447 | 'rgb(254,217,166)', 1448 | 'rgb(255,255,204)', 1449 | 'rgb(229,216,189)', 1450 | 'rgb(253,218,236)', 1451 | 'rgb(242,242,242)'], 1452 | 'Set1': ['rgb(228,26,28)', 1453 | 'rgb(55,126,184)', 1454 | 'rgb(77,175,74)', 1455 | 'rgb(152,78,163)', 1456 | 'rgb(255,127,0)', 1457 | 'rgb(255,255,51)', 1458 | 'rgb(166,86,40)', 1459 | 'rgb(247,129,191)', 1460 | 'rgb(153,153,153)'], 1461 | 'Set3': ['rgb(141,211,199)', 1462 | 'rgb(255,255,179)', 1463 | 'rgb(190,186,218)', 1464 | 'rgb(251,128,114)', 1465 | 'rgb(128,177,211)', 1466 | 'rgb(253,180,98)', 1467 | 'rgb(179,222,105)', 1468 | 'rgb(252,205,229)', 1469 | 'rgb(217,217,217)']}, 1470 | 'seq': {'Blues': ['rgb(247,251,255)', 1471 | 'rgb(222,235,247)', 1472 | 'rgb(198,219,239)', 1473 | 'rgb(158,202,225)', 1474 | 'rgb(107,174,214)', 1475 | 'rgb(66,146,198)', 1476 | 'rgb(33,113,181)', 1477 | 'rgb(8,81,156)', 1478 | 'rgb(8,48,107)'], 1479 | 'BuGn': ['rgb(247,252,253)', 1480 | 'rgb(229,245,249)', 1481 | 'rgb(204,236,230)', 1482 | 'rgb(153,216,201)', 1483 | 'rgb(102,194,164)', 1484 | 'rgb(65,174,118)', 1485 | 'rgb(35,139,69)', 1486 | 'rgb(0,109,44)', 1487 | 'rgb(0,68,27)'], 1488 | 'BuPu': ['rgb(247,252,253)', 1489 | 'rgb(224,236,244)', 1490 | 'rgb(191,211,230)', 1491 | 'rgb(158,188,218)', 1492 | 'rgb(140,150,198)', 1493 | 'rgb(140,107,177)', 1494 | 'rgb(136,65,157)', 1495 | 'rgb(129,15,124)', 1496 | 'rgb(77,0,75)'], 1497 | 'GnBu': ['rgb(247,252,240)', 1498 | 'rgb(224,243,219)', 1499 | 'rgb(204,235,197)', 1500 | 'rgb(168,221,181)', 1501 | 'rgb(123,204,196)', 1502 | 'rgb(78,179,211)', 1503 | 'rgb(43,140,190)', 1504 | 'rgb(8,104,172)', 1505 | 'rgb(8,64,129)'], 1506 | 'Greens': ['rgb(247,252,245)', 1507 | 'rgb(229,245,224)', 1508 | 'rgb(199,233,192)', 1509 | 'rgb(161,217,155)', 1510 | 'rgb(116,196,118)', 1511 | 'rgb(65,171,93)', 1512 | 'rgb(35,139,69)', 1513 | 'rgb(0,109,44)', 1514 | 'rgb(0,68,27)'], 1515 | 'Greys': ['rgb(255,255,255)', 1516 | 'rgb(240,240,240)', 1517 | 'rgb(217,217,217)', 1518 | 'rgb(189,189,189)', 1519 | 'rgb(150,150,150)', 1520 | 'rgb(115,115,115)', 1521 | 'rgb(82,82,82)', 1522 | 'rgb(37,37,37)', 1523 | 'rgb(0,0,0)'], 1524 | 'OrRd': ['rgb(255,247,236)', 1525 | 'rgb(254,232,200)', 1526 | 'rgb(253,212,158)', 1527 | 'rgb(253,187,132)', 1528 | 'rgb(252,141,89)', 1529 | 'rgb(239,101,72)', 1530 | 'rgb(215,48,31)', 1531 | 'rgb(179,0,0)', 1532 | 'rgb(127,0,0)'], 1533 | 'Oranges': ['rgb(255,245,235)', 1534 | 'rgb(254,230,206)', 1535 | 'rgb(253,208,162)', 1536 | 'rgb(253,174,107)', 1537 | 'rgb(253,141,60)', 1538 | 'rgb(241,105,19)', 1539 | 'rgb(217,72,1)', 1540 | 'rgb(166,54,3)', 1541 | 'rgb(127,39,4)'], 1542 | 'PuBu': ['rgb(255,247,251)', 1543 | 'rgb(236,231,242)', 1544 | 'rgb(208,209,230)', 1545 | 'rgb(166,189,219)', 1546 | 'rgb(116,169,207)', 1547 | 'rgb(54,144,192)', 1548 | 'rgb(5,112,176)', 1549 | 'rgb(4,90,141)', 1550 | 'rgb(2,56,88)'], 1551 | 'PuBuGn': ['rgb(255,247,251)', 1552 | 'rgb(236,226,240)', 1553 | 'rgb(208,209,230)', 1554 | 'rgb(166,189,219)', 1555 | 'rgb(103,169,207)', 1556 | 'rgb(54,144,192)', 1557 | 'rgb(2,129,138)', 1558 | 'rgb(1,108,89)', 1559 | 'rgb(1,70,54)'], 1560 | 'PuRd': ['rgb(247,244,249)', 1561 | 'rgb(231,225,239)', 1562 | 'rgb(212,185,218)', 1563 | 'rgb(201,148,199)', 1564 | 'rgb(223,101,176)', 1565 | 'rgb(231,41,138)', 1566 | 'rgb(206,18,86)', 1567 | 'rgb(152,0,67)', 1568 | 'rgb(103,0,31)'], 1569 | 'Purples': ['rgb(252,251,253)', 1570 | 'rgb(239,237,245)', 1571 | 'rgb(218,218,235)', 1572 | 'rgb(188,189,220)', 1573 | 'rgb(158,154,200)', 1574 | 'rgb(128,125,186)', 1575 | 'rgb(106,81,163)', 1576 | 'rgb(84,39,143)', 1577 | 'rgb(63,0,125)'], 1578 | 'RdPu': ['rgb(255,247,243)', 1579 | 'rgb(253,224,221)', 1580 | 'rgb(252,197,192)', 1581 | 'rgb(250,159,181)', 1582 | 'rgb(247,104,161)', 1583 | 'rgb(221,52,151)', 1584 | 'rgb(174,1,126)', 1585 | 'rgb(122,1,119)', 1586 | 'rgb(73,0,106)'], 1587 | 'Reds': ['rgb(255,245,240)', 1588 | 'rgb(254,224,210)', 1589 | 'rgb(252,187,161)', 1590 | 'rgb(252,146,114)', 1591 | 'rgb(251,106,74)', 1592 | 'rgb(239,59,44)', 1593 | 'rgb(203,24,29)', 1594 | 'rgb(165,15,21)', 1595 | 'rgb(103,0,13)'], 1596 | 'YlGn': ['rgb(255,255,229)', 1597 | 'rgb(247,252,185)', 1598 | 'rgb(217,240,163)', 1599 | 'rgb(173,221,142)', 1600 | 'rgb(120,198,121)', 1601 | 'rgb(65,171,93)', 1602 | 'rgb(35,132,67)', 1603 | 'rgb(0,104,55)', 1604 | 'rgb(0,69,41)'], 1605 | 'YlGnBu': ['rgb(255,255,217)', 1606 | 'rgb(237,248,177)', 1607 | 'rgb(199,233,180)', 1608 | 'rgb(127,205,187)', 1609 | 'rgb(65,182,196)', 1610 | 'rgb(29,145,192)', 1611 | 'rgb(34,94,168)', 1612 | 'rgb(37,52,148)', 1613 | 'rgb(8,29,88)'], 1614 | 'YlOrBr': ['rgb(255,255,229)', 1615 | 'rgb(255,247,188)', 1616 | 'rgb(254,227,145)', 1617 | 'rgb(254,196,79)', 1618 | 'rgb(254,153,41)', 1619 | 'rgb(236,112,20)', 1620 | 'rgb(204,76,2)', 1621 | 'rgb(153,52,4)', 1622 | 'rgb(102,37,6)'], 1623 | 'YlOrRd': ['rgb(255,255,204)', 1624 | 'rgb(255,237,160)', 1625 | 'rgb(254,217,118)', 1626 | 'rgb(254,178,76)', 1627 | 'rgb(253,141,60)', 1628 | 'rgb(252,78,42)', 1629 | 'rgb(227,26,28)', 1630 | 'rgb(189,0,38)', 1631 | 'rgb(128,0,38)']}}} 1632 | 1633 | def scale_type( scale ): 1634 | ''' returns "rbg", "hsl", "numeric", or raises exception. ie, 1635 | [ "rgb(255, 255, 255)", "rgb(255, 255, 255)", "rgb(255, 255, 255)" ] --> "rgb" ''' 1636 | swatch = scale[0] 1637 | s_t = str(swatch)[0:3] 1638 | if s_t in ['rgb', 'hsl']: 1639 | return s_t 1640 | elif isinstance(swatch,tuple) and len(swatch) == 3: 1641 | return 'numeric' 1642 | raise Exception('Could not determine type of input colorscale.\n\ 1643 | Colorscales must be in one of these 3 forms:\n\ 1644 | [ (255, 255, 255), (255, 255, 255), (255, 255, 255) ]\n\ 1645 | [ "rgb(255, 255, 255)", "rgb(255, 255, 255)", "rgb(255, 255, 255)" ]\n\ 1646 | [ "hsl(360,100,100)", "hsl(360,100,100)", "hsl(360,100,100)" ]') 1647 | 1648 | def to_numeric( scale ): 1649 | ''' converts scale of rgb or hsl strings to list of tuples with rgb integer values. ie, 1650 | [ "rgb(255, 255, 255)", "rgb(255, 255, 255)", "rgb(255, 255, 255)" ] --> 1651 | [ (255, 255, 255), (255, 255, 255), (255, 255, 255) ] ''' 1652 | numeric_scale = [] 1653 | s_t = scale_type( scale ) 1654 | if s_t in ['rgb','hsl']: 1655 | for s in scale: 1656 | s = s[s.find("(")+1:s.find(")")].replace(' ','').split(',') 1657 | numeric_scale.append( ( float(s[0]), float(s[1]), float(s[2]) ) ) 1658 | elif s_t == 'numeric': 1659 | numeric_scale = scale 1660 | return numeric_scale 1661 | 1662 | def to_hsl( scale ): 1663 | ''' convert a string rgb or numeric rgb colorscale to hsl. ie, 1664 | [ "rgb(255, 255, 255)", "rgb(255, 255, 255)", "rgb(255, 255, 255)" ] --> 1665 | [ "hsl(360,100%,100%)", "hsl(360,100%,100%)", "hsl(360,100%,100%)" ] 1666 | add percentages to saturation and lightness if missing for css compatibility ''' 1667 | 1668 | hsl = [] 1669 | s_t = scale_type(scale) 1670 | 1671 | if s_t == 'hsl': 1672 | # add percentages to s and l if missing 1673 | 1674 | numeric_hsl_scale = [] 1675 | for s in scale: 1676 | s = s[s.find("(")+1:s.find(")")].replace(' ','').replace('%','').split(',') 1677 | numeric_hsl_scale.append( ( float(s[0]), float(s[1]), float(s[2]) ) ) 1678 | 1679 | for ea in numeric_hsl_scale: 1680 | h,s,l = [ str(x) for x in ea ] 1681 | if s[-1] != '%': 1682 | s = s + '%' 1683 | if l[-1] != '%': 1684 | l = l + '%' 1685 | hsl_str = 'hsl(' + ', '.join([h,s,l]) + ')' 1686 | hsl.append( hsl_str ) 1687 | 1688 | return hsl 1689 | 1690 | elif s_t == 'rgb': 1691 | scale = to_numeric( scale ) 1692 | 1693 | for ea in scale: 1694 | r,g,b = [ x/255.0 for x in ea ] 1695 | h,l,s = colorsys.rgb_to_hls( r,g,b ) 1696 | h,s,l = [ str(int(round(h*360.0))), str(int(round(s*100.0)))+'%', str(int(round(l*100.0)))+'%' ] 1697 | hsl_str = 'hsl(' + ', '.join([h,s,l]) + ')' 1698 | hsl.append( hsl_str ) 1699 | 1700 | return hsl 1701 | 1702 | def to_rgb( scale ): 1703 | ''' convert an hsl or numeric rgb color scale to string rgb color scale. ie, 1704 | [ "hsl(360,100,100)", "hsl(360,100,100)", "hsl(360,100,100)" ] --> 1705 | [ "rgb(255, 255, 255)", "rgb(255, 255, 255)", "rgb(255, 255, 255)" ] 1706 | ''' 1707 | 1708 | rgb = [] 1709 | s_t = scale_type(scale) 1710 | 1711 | if s_t == 'rgb': 1712 | return scale 1713 | elif s_t == 'numeric': 1714 | for ea in scale: 1715 | rgb.append( 'rgb'+str(ea) ) 1716 | return rgb 1717 | elif s_t == 'hsl': 1718 | numeric_hsl_scale = [] 1719 | for s in scale: 1720 | s = s[s.find("(")+1:s.find(")")].replace(' ','').replace('%','').split(',') 1721 | numeric_hsl_scale.append( ( float(s[0]), float(s[1]), float(s[2]) ) ) 1722 | scale = numeric_hsl_scale 1723 | 1724 | for ea in scale: 1725 | h,s,l = [ float(x) for x in ea ] 1726 | r,g,b = colorsys.hls_to_rgb(h/360.0, l/100.0, s/100.0) 1727 | r,g,b = [ str(int(round(x*255.0))) for x in (r,g,b) ] 1728 | rgb_str = 'rgb(' + ', '.join([r,g,b]) + ')' 1729 | rgb.append( rgb_str ) 1730 | 1731 | return rgb 1732 | 1733 | def to_html( scale ): 1734 | ''' traverse color scale dictionary and return available color scales in HTML string ''' 1735 | 1736 | global s 1737 | s = '' 1738 | 1739 | def single_scale( scale ): 1740 | ''' return square html
for a single color ''' 1741 | if scale_type( scale ) == 'numeric': 1742 | scale = to_rgb( scale ) 1743 | s_s = '' 1744 | for ea in scale: 1745 | s_s+='
'.format(ea) 1746 | return s_s 1747 | 1748 | def section_titles( k ): 1749 | d = { 'qual':'Qualitative','div':'Diverging','seq':'Sequential' } 1750 | if k in list(d.keys()): 1751 | return '

' + d[k] + '

' 1752 | return '

' + k + ' colors

' 1753 | 1754 | def prettyprint( d ): 1755 | global s 1756 | for k, v in list(d.items()): 1757 | if isinstance(v, dict): 1758 | if len(list(v.keys())) != 0: 1759 | s += section_titles(k) 1760 | prettyprint(v) 1761 | else: 1762 | s += '
{0}
{1}
'.format(k, single_scale( v ) ) 1763 | return s 1764 | 1765 | if isinstance( scale, list ): 1766 | return single_scale( scale ) 1767 | elif isinstance( scale, dict ): 1768 | prettyprint( scale ) 1769 | 1770 | return s 1771 | 1772 | def flipper( scl=None ): 1773 | ''' Invert color scale dictionary ''' 1774 | scl = scl if scl is not None else scales 1775 | flipped = defaultdict(dict) 1776 | for key, val in list(scl.items()): 1777 | for subkey, subval in list(val.items()): 1778 | flipped[subkey][key] = subval 1779 | return flipped 1780 | 1781 | 1782 | def rgb_to_hsl(rgb): 1783 | ''' Adapted from M Bostock's RGB to HSL converter in d3.js 1784 | https://github.com/mbostock/d3/blob/master/src/color/rgb.js ''' 1785 | r,g,b = float(rgb[0])/255.0,\ 1786 | float(rgb[1])/255.0,\ 1787 | float(rgb[2])/255.0 1788 | mx = max(r, g, b) 1789 | mn = min(r, g, b) 1790 | h = s = l = (mx + mn) / 2 1791 | if mx == mn: # achromatic 1792 | h = 0 1793 | s = 0 if l > 0 and l < 1 else h 1794 | else: 1795 | d = mx - mn; 1796 | s = d / (mx + mn) if l < 0.5 else d / (2 - mx - mn) 1797 | if mx == r: 1798 | h = (g - b) / d + ( 6 if g < b else 0 ) 1799 | elif mx == g: 1800 | h = (b - r) / d + 2 1801 | else: 1802 | h = (r - g) / d + 4 1803 | 1804 | return (int(round(h*60,4)), int(round(s*100,4)), int(round(l*100,4))) 1805 | 1806 | 1807 | def interp(scl, r): 1808 | ''' Interpolate a color scale "scl" to a new one with length "r" 1809 | Fun usage in IPython notebook: 1810 | HTML( to_html( to_hsl( interp( cl.scales['11']['qual']['Paired'], 5000 ) ) ) ) ''' 1811 | c = [] 1812 | 1813 | if isinstance(r, int): 1814 | if r == 0: 1815 | r_steps = [] 1816 | elif r == 1: 1817 | # Midway point 1818 | r_steps = [(len(scl) / 2) - 1] 1819 | else: 1820 | # Linearly space r from 0 to len(scl) - 1 1821 | r_steps = [x*1.0*(len(scl) - 1)/(r-1) for x in range(r)] 1822 | else: 1823 | r_steps = r 1824 | 1825 | scl = to_numeric(scl) 1826 | 1827 | def hsl_interp(fraction, hsl_start, hsl_end): 1828 | ''' Interpolate between values of 2, 3-member tuples ''' 1829 | 1830 | def interp_linear(f, s, e): 1831 | return s + (e - s) * f 1832 | 1833 | def interp_circular(f, s, e): 1834 | s_mod = s % 360 1835 | e_mod = e % 360 1836 | if max(s_mod, e_mod) - min(s_mod, e_mod) > 180: 1837 | s_mod, e_mod = (s_mod + 360, e_mod) if s_mod < e_mod else ( 1838 | s_mod, e_mod + 360) 1839 | return interp_linear(f, s_mod, e_mod) % 360 1840 | else: 1841 | return interp_linear(f, s_mod, e_mod) 1842 | return ( 1843 | interp_circular(fraction, hsl_start[0], hsl_end[0]), 1844 | interp_circular(fraction, hsl_start[1], hsl_end[1]), 1845 | interp_circular(fraction, hsl_start[2], hsl_end[2]), 1846 | ) 1847 | 1848 | for i in r_steps: 1849 | section_min = math.floor(i) 1850 | section_max = math.ceil(i) 1851 | 1852 | c_i_min = int(section_min) 1853 | c_i_max = int(section_max) 1854 | 1855 | if c_i_min == c_i_max: 1856 | # No interpolation needed 1857 | hsl = rgb_to_hsl(scl[c_i_min]) 1858 | else: 1859 | fraction = (i-section_min) 1860 | hsl_o = rgb_to_hsl( scl[c_i_min] ) # convert rgb to hls 1861 | hsl_f = rgb_to_hsl( scl[c_i_max] ) 1862 | hsl = hsl_interp( fraction, hsl_o, hsl_f ) 1863 | c.append( 'hsl'+str(hsl) ) 1864 | 1865 | return to_hsl( c ) 1866 | -------------------------------------------------------------------------------- /dist/colorlover-0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plotly/colorlover/1210f8fad7fdbceb9fa26710110a215c330d1f5e/dist/colorlover-0.1.tar.gz -------------------------------------------------------------------------------- /dist/colorlover-0.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/plotly/colorlover/1210f8fad7fdbceb9fa26710110a215c330d1f5e/dist/colorlover-0.2.tar.gz -------------------------------------------------------------------------------- /recipe/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Jack Parmer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | Contact GitHub API Training Shop Blog About 23 | -------------------------------------------------------------------------------- /recipe/meta.yaml: -------------------------------------------------------------------------------- 1 | {% set data = load_setup_py_data() %} 2 | {% set version = data.get('version') %} 3 | 4 | package: 5 | name: colorlover 6 | version: {{ version }} 7 | 8 | source: 9 | path: ../ 10 | 11 | build: 12 | number: 0 13 | script: "{{ PYTHON }} -m pip install . --no-deps --ignore-installed --no-cache-dir -q" 14 | noarch: python 15 | 16 | requirements: 17 | build: 18 | - python 19 | - pip 20 | 21 | run: 22 | - python 23 | 24 | test: 25 | imports: 26 | - colorlover 27 | 28 | about: 29 | home: https://github.com/jackparmer/colorlover 30 | license: MIT 31 | license_file: '{{ environ["RECIPE_DIR"] }}/LICENSE.txt' 32 | summary: 'Color scales for humans' 33 | description: | 34 | doc_url: https://plot.ly/ipython-notebooks/color-scales/ 35 | dev_url: https://github.com/jackparmer/colorlover 36 | 37 | extra: 38 | recipe-maintainers: 39 | - jonmmease 40 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name = 'colorlover', 5 | packages = ['colorlover'], # this must be the same as the name above 6 | version = '0.3.0', 7 | description = 'Color scales for IPython notebook', 8 | author = 'Jack Parmer', 9 | author_email = 'jack@plot.ly', 10 | url = 'https://github.com/jackparmer/colorlover', # use the URL to the github repo 11 | keywords = ['ipython notebook','color scales'], # arbitrary keywords 12 | classifiers = [ 13 | # https://pypi.org/pypi?%3Aaction=list_classifiers 14 | 'Programming Language :: Python', 15 | 'Programming Language :: Python :: 2', 16 | 'Programming Language :: Python :: 3', 17 | ], 18 | ) 19 | -------------------------------------------------------------------------------- /tests.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import colorlover as cl 4 | 5 | 6 | rgb_hsl_colors = { 7 | (0, 0, 0): (0, 0, 0), # Black 8 | (255, 255, 255): (0, 0, 100), # White 9 | (255, 0, 0): (0, 100, 50), # Red 10 | (0, 255, 0): (120, 100, 50), # Lime 11 | (0, 0, 255): (240, 100, 50), # Blue 12 | (255, 255, 0): (60, 100, 50), # Yellow 13 | (0, 255, 255): (180, 100, 50), # Cyan 14 | (255, 0, 255): (300, 100, 50), # Magenta 15 | (192, 192, 192): (0, 0, 75), # Silver 16 | (128, 128, 128): (0, 0, 50), # Gray 17 | (128, 0, 0): (0, 100, 25), # Maroon 18 | (128, 128, 0): (60, 100, 25), # Olive 19 | (0, 128, 0): (120, 100, 25), # Green 20 | (128, 0, 128): (300, 100, 25), # Purple 21 | (0, 128, 128): (180, 100, 25), # Teal 22 | (0, 0, 128): (240, 100, 25), # Navy 23 | (20, 30, 128): (234, 72, 29) # Near navy 24 | } 25 | 26 | 27 | class UsageTests(unittest.TestCase): 28 | def test_scales(self): 29 | scales = cl.scales['3']['div']['RdYlBu'] 30 | self.assertEqual( 31 | scales, 32 | ['rgb(252,141,89)', 'rgb(255,255,191)', 'rgb(145,191,219)']) 33 | 34 | def test_to_numeric(self): 35 | scales = cl.to_numeric(cl.scales['3']['div']['RdYlBu']) 36 | self.assertEqual( 37 | scales, 38 | [(252, 141, 89), 39 | (255, 255, 191), (145, 191, 219)] 40 | ) 41 | 42 | def test_to_hsl(self): 43 | scales = cl.to_hsl(cl.scales['3']['div']['RdYlBu']) 44 | self.assertEqual( 45 | scales, 46 | ['hsl(19, 96%, 67%)', 'hsl(60, 100%, 87%)', 47 | 'hsl(203, 51%, 71%)'] 48 | ) 49 | 50 | def test_to_rgb(self): 51 | scales = cl.to_rgb(cl.scales['3']['div']['RdYlBu']) 52 | self.assertEqual( 53 | scales, 54 | ['rgb(252,141,89)', 'rgb(255,255,191)', 'rgb(145,191,219)'] 55 | ) 56 | 57 | def test_to_html(self): 58 | html = cl.to_html(cl.scales['3']['div']['RdYlBu']) 59 | self.assertEqual( 60 | html, 61 | ('
' 63 | '
' 65 | '
') 67 | ) 68 | 69 | def test_flipper(self): 70 | flipped = cl.flipper()['div']['3']['RdYlBu'] 71 | self.assertEqual( 72 | flipped, 73 | ['rgb(252,141,89)', 'rgb(255,255,191)', 'rgb(145,191,219)'] 74 | ) 75 | 76 | def test_rgb_to_hsl(self): 77 | # Make sure interpolating a colorscale to the same length does nothing 78 | # but change colorspace from hsl to rgb 79 | for rgb, expected_hsl in rgb_hsl_colors.items(): 80 | hsl = cl.rgb_to_hsl(rgb) 81 | self.assertEqual(hsl, expected_hsl) 82 | 83 | 84 | if __name__ == '__main__': 85 | unittest.main() 86 | --------------------------------------------------------------------------------