Skip to main content

A collection of color palettes for mapping and visualisation

Project description

chrys

A collection of color palettes for mapping and visualisation.

JavaScript

Installation

npm install chrys

Usage

Generate a new palette as a subset of a given palette:

>>> import {VEGA_PALETTES, toDiscretePalette} from 'chrys';
>>> toDiscretePalette(VEGA_PALETTES['viridis'], 6);
['#46327f', '#375c8d', '#27808e', '#1fa187', '#4ac26d', '#9fda3a']

Generate a new palette as a subset of a palette from a given provider:

>>> import {VEGA_VIRIDIS, discretePalette} from 'chrys';
>>> discretePalette(VEGA_VIRIDIS, 6);
['#46327f', '#375c8d', '#27808e', '#1fa187', '#4ac26d', '#9fda3a']

Get the vendor library and palette names from a given name:

>>> import {VEGA_VIRIDIS, parsePaletteName} from 'chrys';
>>> parsePaletteName(VEGA_VIRIDIS);
{vendor: 'vega', palette: 'viridis'}

Sass

Installation

npm install chrys

Usage

@import 'node_modules/chrys/src/variables';

// Get the first color of the `bokeh-colorblind` palette, size 3
$palette-name: 'bokeh-colorblind';
$palette-size: 3;
$palette:      map-get(map-get($chrys-palettes, $palette-name), $palette-size);
$color:        nth($palette, 1);

div {
  background: $color;
}

Python

Installation

pip install chrys

Usage

Generate a new palette as a subset of a given palette:

>>> from chrys.palettes import VEGA_PALETTES, to_continuous_palette, to_discrete_palette
>>> to_discrete_palette(VEGA_PALETTES['viridis'], 6)
['#46327f', '#375c8d', '#27808e', '#1fa187', '#4ac26d', '#9fda3a']
>>> to_continuous_palette(VEGA_PALETTES['viridis'][256], 6)
['#440356', '#414587', '#2a788e', '#22a884', '#79d152', '#fbe724']

Generate a new palette as a subset of a palette from a given provider:

>>> from chrys.palettes import VEGA_VIRIDIS, continuous_palette, discrete_palette
>>> discrete_palette(VEGA_VIRIDIS, 6)
['#46327f', '#375c8d', '#27808e', '#1fa187', '#4ac26d', '#9fda3a']
>>> continuous_palette(VEGA_VIRIDIS, 6)
['#440356', '#414587', '#2a788e', '#22a884', '#79d152', '#fbe724']

Get the vendor library and palette names from a given name:

>>> from chrys.palettes import VEGA_VIRIDIS, parse_palette_name
>>> parse_palette_name(VEGA_VIRIDIS)
('vega', 'viridis')

Development

Install Node and Python dependencies:

./scripts/install.sh

Build palette data:

npm run build-data

Build JavaScript and Python distribution packages, Sass, CSS, Illustrator scripts:

npm run build-dist

Publish JavaScript and Python distribution packages:

npm publish

Credit

Palettes from:

License

Copyright (c) 2017 Hein Bekker. Licensed under the BSD 3-Clause License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chrys-3.0.5.tar.gz (41.5 kB view details)

Uploaded Source

Built Distribution

chrys-3.0.5-py2-none-any.whl (41.6 kB view details)

Uploaded Python 2

File details

Details for the file chrys-3.0.5.tar.gz.

File metadata

  • Download URL: chrys-3.0.5.tar.gz
  • Upload date:
  • Size: 41.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/2.7.15+

File hashes

Hashes for chrys-3.0.5.tar.gz
Algorithm Hash digest
SHA256 585a1ce7dab8e8c723e12a018809e57b3909943551b98990331409186e5ff380
MD5 1b936be30841deda60f0c68be0759392
BLAKE2b-256 de9de07f524072759597dfd7a88043929ed1d638feb68c2e1b6a321f7f2f351d

See more details on using hashes here.

File details

Details for the file chrys-3.0.5-py2-none-any.whl.

File metadata

  • Download URL: chrys-3.0.5-py2-none-any.whl
  • Upload date:
  • Size: 41.6 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/2.7.15+

File hashes

Hashes for chrys-3.0.5-py2-none-any.whl
Algorithm Hash digest
SHA256 350dcd9819fc7ba8e1b181ae143c86faef1216dc550e75a904d78cb9778c8de3
MD5 161d0d1a55c3b4f23bb7b07ba9789240
BLAKE2b-256 9afba9b81b8f1ae9523850d88965a2ed4fd0d27f7ec3d3804124c4590b65a1d9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page