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

# ApplyTheme

[**API Reference**](/api-reference/index) / [**utils/theme**](/api-reference/utils/theme/index)

***

> **applyTheme**(`theme`, `username?`): `void`

Defined in: [utils/theme.ts:107](https://github.com/cannoneer85-svg/stratanote/blob/master/_app/client/src/utils/theme.ts#L107)

Applies theme to DOM root. Optionally persists to localStorage for the given user.

## Parameters

### theme

[`ThemeId`](/api-reference/utils/theme/type-aliases/ThemeId)

Theme identifier to apply.

### username?

`string`

If provided, persists the choice for this user.

## Returns

`void`
