Astronomy recolor | Toph & Visnu Stream | Observable
ojs
ojs
html
Author
Visnu Pitiyanuvath
@visnup
Comments (3)
Fabian Iwand
Sep 2, 2022
You can also do the recoloring via SVG filters:
https://observablehq.com/@mootari/svg-filter-scales
Fabian Iwand
Sep 2, 2022
For canvas the way I do it is to create a uint32 lookup table for all 256 grey values. Since you can have a Uint32Array view of a Uint8ClampedArray, you can simply assign entire colors (instead of RGB values).
Sep 2, 2022
(Here's a small helper to create a palette array from CSS colors:
https://observablehq.com/@mootari/sibson-interpolation#createPalette
)
Reply
Add comment
Subscribe to notifications
© 2026 Observable, Inc.
Terms of service
Privacy policy
Product
About
Pricing
Documentation
Release notes
Contact us
Open source
Notebook Kit
Plot
D3
Community
Explore
Forum
Bluesky
YouTube
X
1
Follow
Follow
Astronomy recolor | Toph & Visnu Stream | Observable