Skip to content

Commit

Permalink
Export type names (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicfv authored Mar 6, 2024
1 parent 80cd4c9 commit e85079a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions viridis/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.0.1

- Export palette name type

## 1.0.0

- Add color palettes on readme
Expand Down
2 changes: 1 addition & 1 deletion viridis/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "viridis",
"version": "1.0.0",
"version": "1.0.1",
"description": "Generate data visualization color gradients",
"main": "dist/index.js",
"types": "types/index.d.ts",
Expand Down
7 changes: 6 additions & 1 deletion viridis/src/Palette.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Color } from './Color';
import { Gradient } from './Gradient';

/**
* Defines the list of valid builtin palette names.
*/
export type PaletteName = 'Viridis' | 'Inferno' | 'Magma' | 'Plasma' | 'Grayscale' | 'Parula' | 'Emerald' | 'Mint' | 'Sunset' | 'Dusk' | 'Chroma' | 'Spectral' | 'Cool' | 'Warm' | 'Turquoise' | 'Purplish' | 'Dirt' | 'Lime' | 'Teal' | 'Bee';

/**
* Contains builtin color palettes.
*
Expand All @@ -9,7 +14,7 @@ import { Gradient } from './Gradient';
* - Loading Colors: https://loading.io/color/feature/
* - Carto Colors: https://carto.com/carto-colors/
*/
export const Palette = {
export const Palette: { [name in PaletteName]: Gradient } = {
// https://waldyrious.net/viridis-palette-generator/
Viridis: new Gradient([
Color.from('#fde725'),
Expand Down

0 comments on commit e85079a

Please sign in to comment.