{"id":17122022,"url":"https://github.com/beenotung/heatmap-values","last_synced_at":"2026-05-04T07:36:26.257Z","repository":{"id":257813015,"uuid":"862134408","full_name":"beenotung/heatmap-values","owner":"beenotung","description":"Generate heatmap with RGBA from pre-built or custom color scheme.","archived":false,"fork":false,"pushed_at":"2024-10-07T01:09:36.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T22:16:51.094Z","etag":null,"topics":["ai","browser","class-activation-map","color-gradient","color-scheme","heatmap","isomorphic","machine-learning","nodejs","rgba","typescript","visualization"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/heatmap-values","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beenotung.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-24T05:15:20.000Z","updated_at":"2024-10-28T15:16:52.000Z","dependencies_parsed_at":"2024-10-07T01:15:18.946Z","dependency_job_id":null,"html_url":"https://github.com/beenotung/heatmap-values","commit_stats":null,"previous_names":["beenotung/heatmap-values"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Fheatmap-values","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Fheatmap-values/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Fheatmap-values/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Fheatmap-values/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beenotung","download_url":"https://codeload.github.com/beenotung/heatmap-values/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665755,"owners_count":21142123,"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","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":["ai","browser","class-activation-map","color-gradient","color-scheme","heatmap","isomorphic","machine-learning","nodejs","rgba","typescript","visualization"],"created_at":"2024-10-14T18:06:13.715Z","updated_at":"2026-05-04T07:36:26.219Z","avatar_url":"https://github.com/beenotung.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# heatmap-values\n\nGenerate heatmap with RGBA from pre-built or custom color scheme.\n\n[![npm Package Version](https://img.shields.io/npm/v/heatmap-values)](https://www.npmjs.com/package/heatmap-values)\n[![Minified Package Size](https://img.shields.io/bundlephobia/min/heatmap-values)](https://bundlephobia.com/package/heatmap-values)\n[![Minified and Gzipped Package Size](https://img.shields.io/bundlephobia/minzip/heatmap-values)](https://bundlephobia.com/package/heatmap-values)\n\nDesigned for class activation map of image classifier AI model visualization.\n\n## Features\n\n- Multiple built-in color schemes:\n  - red-green-blue\n    ![heatmap of red-green-blue color scheme](./example/red-green-blue.webp)\n  - red-transparent-blue\n    ![heatmap of red-transparent-blue color scheme](./example/red-transparent-blue.webp)\n  - hot-only\n    ![heatmap of hot-only color scheme](./example/hot-only.webp)\n  - cold-only\n    ![heatmap of cold-only color scheme](./example/cold-only.webp)\n- Support custom color scheme\n- Typescript support\n- Isomorphic package: works in Node.js and browsers\n\n## Installation\n\n```bash\nnpm install heatmap-values\n```\n\nYou can also install `heatmap-values` with [pnpm](https://pnpm.io/), [yarn](https://yarnpkg.com/), or [slnpm](https://github.com/beenotung/slnpm)\n\n## Usage Example\n\n```typescript\nimport { generate_heatmap_values, heatmap_schemes } from 'heatmap-values'\n\nlet values = generate_heatmap_values(heatmap_schemes.red_transparent_blue)\n\nfor (let i = 0; i \u003c 256; i++) {\n  let [r, g, b, a] = values[i]\n  let color = `rgba(${r},${g},${b},${a})`\n  console.log(i / 255, color)\n}\n```\n\nDetail usage example see [demo.ts](./example/demo.ts) and [demo.html](./example/demo.html).\n\n## Typescript Signature\n\n```typescript\nexport function generate_heatmap_values(\n  /** @description default is red_transparent_blue */\n  scheme?: HeatmapScheme,\n): RGBA[]\n\nexport type HeatmapScheme = {\n  low: RGBA\n  middle: RGBA\n  high: RGBA\n}\n\nexport type RGBA = [\n  /** @description 0..255 */\n  r: number,\n  /** @description 0..255 */\n  g: number,\n  /** @description 0..255 */\n  b: number,\n  /** @description 0..1 */\n  a: number,\n]\n\nexport const heatmap_schemes: {\n  red_green_blue: HeatmapScheme\n  red_transparent_blue: HeatmapScheme\n  hot_only: HeatmapScheme\n  cold_only: HeatmapScheme\n}\n```\n\n## License\n\nThis project is licensed with [BSD-2-Clause](./LICENSE)\n\nThis is free, libre, and open-source software. It comes down to four essential freedoms [[ref]](https://seirdy.one/2021/01/27/whatsapp-and-the-domestication-of-users.html#fnref:2):\n\n- The freedom to run the program as you wish, for any purpose\n- The freedom to study how the program works, and change it so it does your computing as you wish\n- The freedom to redistribute copies so you can help others\n- The freedom to distribute copies of your modified versions to others\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeenotung%2Fheatmap-values","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeenotung%2Fheatmap-values","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeenotung%2Fheatmap-values/lists"}