Skip to main content
Phosphor draws graphs on a cathode-ray tube: a dark screen, shapes and type that glow green, and a terminal face throughout.
Phosphor ships as its own package, @graphysdk/theme-phosphor, still on 0.x. A minor release may change its look, so pin a caret range (^0.1.0) to take only patches. Tell us what works and what doesn’t on Discord.

Install

Its peer dependencies are @graphysdk/react and React 19. Pass the theme to createGraphyKit and import its fonts once:
Every graph drawn through kit.GraphProvider takes the theme. The spec is written as usual and names no theme:
Without a kit, pass the theme to the provider instead: <GraphProvider theme={phosphor}>. The provider reads the theme once, when it mounts. To switch themes, remount the provider, for example with a React key.

What the theme decides

The screen

The scanlines and the dark corners are an overlay, paint drawn over what lies under it. The graph has one over everything it draws, and each geom has one over its own shapes, so lit shapes show the lines more than the dark around them. Both are in the stylesheet, and a spec can turn either off:

Changing the look of one graph

A spec’s own styles(), scales and config() sit above the theme. This graph keeps the screen and takes amber for its bars, with no glow:
The theme is drawn for a graph about 600 pixels wide. style.graph({ textScale }) scales its type for a larger or smaller one.

With a geom package

Phosphor repaints no geom. A geom from a package, such as the dumbbell, is lit the same way as a built-in one.

Fonts

fonts.css loads VT323 from Google Fonts. To host the font yourself, leave the import out and load a family named VT323 before the first graph is drawn. The face has one weight, and the theme sets every label in it.