# Spectroscope

A prism splits a lamp's light into its colours, and every colour is traced through the glass, so turning the table slides the spectrum along the scale. The telescope reads the wavelength where it points and names the line when it lands on one.

Object · With a Pass · https://tactileui.dev/objects/spectroscope

> The code and styling for this object come with the Pass. Sign in if you have one. Sign in: https://tactileui.dev/auth/sign-in The price: https://tactileui.dev/pricing

## Anatomy

Per wavelength ray trace, Cauchy dispersion, Total internal reflection, Minimum deviation, Planck continuum, Emission line lamps, Inverse wavelength reading, Additive light, Room fixed sheen, Sleeping loop, Fit to host

## Usage notes

The honest way to put colour on a site with no brand colour: as a lamp's light, split. Use it in UI for: a hero on an optics or imaging site, a light-source picker (five lamps as a radio group), and a wavelength or colour-temperature slider.

## Options

| Option | Type | Description |
| - | - | - |
| lamp | enum | W is a tungsten continuum; Na, H, Hg and Ne are their emission lines. Sodium strikes pink and warms to yellow. |
| prism | number |  |
| hairline | number | Where the telescope looks on the scale; the display reads the wavelength there. |
| finish | enum | The frame, keys and display. Auto makes them from the page’s finish (its tokens): pale with an LCD on a light finish, dark with bright cut edges and a VFD on a dark one; without the tokens, aluminium on a light page and graphite on a dark one. The breadboard stays black anodised, so the rays read. |
| light | number | 0 is from above, clockwise. The prism’s edges and the turned table follow it. |
| eyepiece | boolean |  |
| size | number | Width (px, 0 = fit) |
| readonly | boolean | A display: values from code only. |
| label | text | Accessible name |

## Methods

- wavelength
- reading
- update
- setLamp
- setPrism
- setHairline
- destroy

## States

1. **At rest**: 
2. **Turning the table**: Drag the turntable or use its keys.
3. **Pointing the telescope**: Drag its knob along the scale.
4. **Choosing a lamp**: Five keys, a radio group: tungsten is a smooth continuum; sodium, hydrogen, mercury and neon show their own lines at their own wavelengths. Sodium strikes pink on its neon and warms to yellow.
5. **Keyboard**: 
6. **Read-only**: A display: set from code only; aria-readonly says so.
7. **Aluminium**: A bead-blasted aluminium frame, light keys, a reflective LCD reading; the breadboard stays black anodised.
8. **Graphite**: A soft-touch graphite frame, dark keys, a glowing VFD reading.
9. **Phone**: The bench scales as one object; the grips keep their touch targets and turning a grip never scrolls the page.
10. **Off screen or hidden**: It draws nothing; a lamp warming up finishes when it is back.
11. **Reduced motion**: Lamps light at once; every reading is the same.

## How it works

Original. The optics are pure functions in optics.mjs, tested in Node against the textbook minimum-deviation formula. The dispersion is a dense flint's, a little stronger than SF11's, so the visible band spans about fifteen degrees of the scale.
