Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add errorOverlayTheme option to Astro config #5875

Closed
wants to merge 11 commits into from
14 changes: 14 additions & 0 deletions .changeset/smart-lies-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'astro': minor
---

Add an `errorOverlayTheme` option in the astro config that will allow to specify the theme of the error overlay.

```ts
import { defineConfig } from 'astro/config';

export default defineConfig({
// defaults to systeme
MoustaphaDev marked this conversation as resolved.
Show resolved Hide resolved
errorOverlayTheme: 'dark', // or 'light' or 'system'
});
```
10 changes: 10 additions & 0 deletions packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,16 @@ export interface AstroUserConfig {
*/
vite?: ViteUserConfig;

/**
* @docs
* @kind heading
* @name Error Overlay Theme
* @description
* The error overlay is the UI that appears when Astro encounters an error during development. You can customize the theme of the error overlay by setting this option to `dark`, `light`, or `system`.
* @default `system`
*/
errorOverlayTheme?: 'dark' | 'light' | 'system';

/**
* @docs
* @kind heading
Expand Down
5 changes: 5 additions & 0 deletions packages/astro/src/core/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const ASTRO_CONFIG_DEFAULTS: AstroUserConfig & any = {
},
vite: {},
legacy: {},
errorOverlayTheme: 'system',
};

export const AstroConfigSchema = z.object({
Expand Down Expand Up @@ -166,6 +167,10 @@ export const AstroConfigSchema = z.object({
.default(ASTRO_CONFIG_DEFAULTS.vite),
experimental: z.object({}).optional().default({}),
legacy: z.object({}).optional().default({}),
errorOverlayTheme: z
.union([z.literal('dark'), z.literal('light'), z.literal('system')])
.optional()
.default(ASTRO_CONFIG_DEFAULTS.errorOverlayTheme),
});

export function createRelativeSchema(cmd: string, fileProtocolRoot: URL) {
Expand Down
Loading