{"id":18600163,"url":"https://github.com/giraugh/hue-map","last_synced_at":"2025-08-18T18:04:27.227Z","repository":{"id":56872730,"uuid":"526636427","full_name":"giraugh/hue-map","owner":"giraugh","description":"🎨 A friend who helps you interpolate hues :)","archived":false,"fork":false,"pushed_at":"2023-03-17T00:41:00.000Z","size":125,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-09T08:20:40.672Z","etag":null,"topics":["color","hue-map","interpolate","viridis"],"latest_commit_sha":null,"homepage":"https://ewanb.me/hue-map/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/giraugh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-08-19T14:20:12.000Z","updated_at":"2022-08-21T05:58:52.000Z","dependencies_parsed_at":"2023-11-22T08:52:48.201Z","dependency_job_id":null,"html_url":"https://github.com/giraugh/hue-map","commit_stats":{"total_commits":43,"total_committers":3,"mean_commits":"14.333333333333334","dds":0.4883720930232558,"last_synced_commit":"5e93836a0e06403d5235164558176e4c50f8c4d2"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/giraugh/hue-map","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giraugh%2Fhue-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giraugh%2Fhue-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giraugh%2Fhue-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giraugh%2Fhue-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/giraugh","download_url":"https://codeload.github.com/giraugh/hue-map/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giraugh%2Fhue-map/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271035378,"owners_count":24688396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["color","hue-map","interpolate","viridis"],"created_at":"2024-11-07T02:03:16.575Z","updated_at":"2025-08-18T18:04:27.184Z","avatar_url":"https://github.com/giraugh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎨 Hue Map\n\n[![npm version](https://img.shields.io/npm/v/hue-map)](https://www.npmjs.com/package/hue-map)\n[![minzip size](https://img.shields.io/bundlephobia/minzip/hue-map)](https://bundlephobia.com/package/hue-map)\n\nInterpolate gradients based on common palettes. **[See a demo](https://giraugh.github.io/hue-map/)**.\n\nInspired by D3 colour scales, with maps from [colormap](https://github.com/bpostlethwaite/colormap).\n\n![Some example palettes](https://user-images.githubusercontent.com/8862273/185757207-643934bb-da49-42f6-9956-8185de6bcb19.png)\n\n## Installation\n\n```bash\nyarn add hue-map\n```\n\n## Usage\n\n```js\nimport { createPalette } from 'hue-map'\n\nconst myPalette = createPalette({\n  map: 'viridis',\n  steps: 3,\n})\n\nconsole.log(myPalette.format('cssHex'))\n// --\u003e ['#440154FF', '#21908DFF', '#FDE725FF']\n```\n\n## API\n\n`hue-map` exports a `createPalette` function which takes an options object and returns a palette object.\n\n### Palette Creation Options \n\n| Property | Type | Default | Description |\n| -------- | ---- | ------- | ----------- |\n| `map` | `string` | `'viridis'` | The colour map to use, see below for a list of built-in colour maps. You can also provide a custom colour map. |\n| `steps` | `number` | `10` | The number of colour shades to return. |\n\n\n### Palette Formatting\n\nCall `.format()` on a palette object to get an array of colours. Pass a `format` argument to control the format that the colors are returned as.\n\n| Format   | Returned Type | Example     | Description                                 |\n| -------- | ------------- | ----------- | ------------------------------------------- |\n| `cssHex` | `string`      | `'#F79E00FF'` | A valid css colour in the form of #RRGGBBAA |\n| `cssRGBA` | `string`      | `'rgba(247, 158, 0, 1)'` | A valid css colour in the form of rgba(R, G, B, A) |\n| `number` | `number`      | `0xF79E00FF` | A hex number representing the colour in the form of 0xRRGGBBAA |\n| `float` | `[number, number, number, number]` | `[0.3, 0.2, 0.5, 1.0]`  | A four-tuple of numbers between 0 and 1 representing R, G, B, and A respectively |\n| `rgba` | `[number, number, number, number]` | `[128, 40, 200, 255]` | A four-tuple of numbers between 0 and 255 representing R, G, B, and A respectively |\n\n\n### Built-in maps\n\nThere are several built-in colour maps available to use:\n\n`jet`, `hsv`, `hot`, `spring`, `summer`, `autumn`, `winter`, `bone`, `copper`, `greys`, `yignbu`, `greens`, `yiorrd`, `bluered`, `rdbu`, `picnic`, `rainbow`, `portland`, `blackbody`, `earth`, `electric`, `alpha`, `viridis`, `inferno`, `magma`, `plasma`, `warm`, `cool`, `rainbow-soft`, `bathymetry`, `cdom`, `chlorophyll`, `density`, `freesurface-blue`, `freesurface-red`, `oxygen`, `par`, `phase`, `salinity`, `temperature`, `turbidity`, `velocity-blue`, `velocity-green`, `cubehelix`\n\nVisit the [demo page](https://giraugh.github.io/hue-map/) to see a list with examples.\n\n### Custom colour maps\n\nYou can also provide a custom colour map to the `map` option, with a type of `[number, number | RGBA][]`. This is an array of tuples, where each tuple has an index of where that colour appears in the gradient (from 0 to 1), and the colour at that point, as a HEX number or an RGBA tuple. Note that all HEX numbers need to include alpha.\n\n```js\nimport { createPalette } from 'hue-map'\n\n// 3 colour points, using HEX values\nconst myHexPalette = createPalette({\n  map: [\n    [0, 0xFEAC5EFF],\n    [0.5, 0xC779D0FF],\n    [1, 0x4BC0C8FF],\n  ]\n})\n\n// 5 colour points, using RGBA values\nconst myHexPalette = createPalette({\n  map: [\n    [0, [38, 83, 43, 255]],\n    [0.25, [57, 158, 90, 255]],\n    [0.5, [90, 188, 185, 255]],\n    [0.75, [99, 226, 198, 255]],\n    [1, [110, 249, 245, 255]],\n  ]\n})\n```\n\n## Development\n\n1. Clone the repo onto your machine\n2. Run `yarn` to install dependencies\n3. Run `yarn dev` to test palettes with a demo page\n\nBuild the library to `dist` using `yarn build`.\n\n## Contributing\n\nIssue contributions and PRs are greatly welcomed and appreciated!\n\nThis library uses [changesets](https://github.com/changesets/changesets), if the changes you've made would constitute a version bump, run `yarn changeset` and follow the prompts to document the changes you've made. Changesets are consumed on releases, and used to generate a changelog and bump version number.\n\n## License\n\n`hue-map` is licensed under MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiraugh%2Fhue-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiraugh%2Fhue-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiraugh%2Fhue-map/lists"}