diff --git a/packages/next/pages/_error.tsx b/packages/next/pages/_error.tsx index 6afa6e299ef28..323aa0a8fe1f8 100644 --- a/packages/next/pages/_error.tsx +++ b/packages/next/pages/_error.tsx @@ -12,6 +12,7 @@ const statusCodes: { [code: number]: string } = { export type ErrorProps = { statusCode: number title?: string + withDarkMode?: boolean } function _getInitialProps({ @@ -33,7 +34,7 @@ export default class Error
extends React.Component
{ static origGetInitialProps = _getInitialProps render() { - const { statusCode } = this.props + const { statusCode, withDarkMode = true } = this.props const title = this.props.title || statusCodes[statusCode] || @@ -56,14 +57,20 @@ export default class Error
extends React.Component
{ .next-error-h1 { border-right: 1px solid rgba(0, 0, 0, .3); } - @media (prefers-color-scheme: dark) { + + ${ + withDarkMode + ? `@media (prefers-color-scheme: dark) { body { color: #fff; background: #000; } .next-error-h1 { border-right: 1px solid rgba(255, 255, 255, .3); } + }` + : '' }`, }} /> + {statusCode ? (