> ## Documentation Index
> Fetch the complete documentation index at: https://docs.graphy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Graphy

Graphy is the v2 drawing of the Graphy light theme: a white plot, black type, a hairline grid on the values, slightly rounded bars, and the bright series colors. A rise is teal and a fall is red.

> [!WARNING]
>
> Graphy ships as its own package, `@graphysdk/theme-graphy`, 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](https://discord.gg/yGmYCjkSr).

## Install

```shell npm theme={null}
npm install @graphysdk/theme-graphy
```

```shell pnpm theme={null}
pnpm add @graphysdk/theme-graphy
```

```shell yarn theme={null}
yarn add @graphysdk/theme-graphy
```

```shell bun theme={null}
bun add @graphysdk/theme-graphy
```

Its peer dependencies are `@graphysdk/react` and React 19. Pass the theme to `createGraphyKit` and import its fonts once:

```tsx theme={null}
import { createGraphyKit, GraphRenderer } from '@graphysdk/react';
import { graphy } from '@graphysdk/theme-graphy';
import '@graphysdk/theme-graphy/fonts.css';

const kit = createGraphyKit({ theme: graphy });
```

Every graph drawn through `kit.GraphProvider` takes the theme. The spec is written as usual and names no theme:

```tsx theme={null}
const spec = kit.pipe(
  kit.createSpec({ x: 'quarter', y: 'revenue', color: 'region' }),
  kit.geom.bar({ position: 'dodge' }),
  kit.scale.x(),
  kit.scale.y()
);

<kit.GraphProvider spec={spec} data={data}>
  <GraphRenderer />
</kit.GraphProvider>;
```

Without a kit, pass the theme to the provider instead: `<GraphProvider theme={graphy}>`.

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

| Part | What Graphy sets |
| - | - |
| Stylesheet | A white plot, black type, a solid hairline on the value axis, slightly rounded bars, smooth lines, and a dark tooltip with white text |
| Colors | The bright series colors for groups, a colormap from a pale blue to that blue, and the fall red against the rise green either side of a light gray |
| Config | Values on the left, the legend at the start of the row above the plot |
| Geoms | None repainted. Waterfall and candlestick bars use the rise and fall colors |
| Color scheme | Light only |

## Changing the look of one graph

A spec's own `styles()`, scales and `config()` sit above the theme. This graph keeps the look and draws its groups in the first three series colors:

```tsx theme={null}
kit.pipe(
  spec,
  kit.scale.color.discrete({ range: ['#B399FD', '#FC8497', '#FBBC30'] })
);
```

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

Graphy repaints no geom. A geom from a package, such as the [dumbbell](https://docs.graphy.dev/sdk-next/graph-types/dumbbell.md), is drawn in the theme's colors and type like a built-in one.

```tsx theme={null}
import { dumbbell } from '@graphysdk/geom-dumbbell';

const kit = createGraphyKit({ theme: graphy, plugins: [dumbbell] });
```

## Fonts

Import `@graphysdk/theme-graphy/fonts.css` once. It loads Inter from Google Fonts, in weights 400, 500 and 600. To host the font yourself, leave the import out and load a family named `Inter` before the first graph is drawn.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.