Include media attribute for themeColor on the new Metadata API #46479
Closed
nicholas5538
started this conversation in
Ideas
Replies: 3 comments 2 replies
-
It's same as #45854, we're planned to add it soon |
Beta Was this translation helpful? Give feedback.
0 replies
-
the actual code for now as nextjs 14 docs says:
transform into:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Use this import type { Viewport } from 'next'
export const viewport: Viewport = {
themeColor: [
{ media: '(prefers-color-scheme: light)', color: '#f8f8f8' },
{ media: '(prefers-color-scheme: dark)', color: '#212529' },
],
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the feature you'd like to request
Currently, the themeColor for Metadata API only accepts string. Is it possible to include media attribute into it as well?
Describe the solution you'd like
I'm was trying to migrate from Nextjs 13 depreciated head.js to its new Metadata API but there was one meta tag that I couldn't transferred.
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f8f8f8" /> <meta name="theme-color" media="(prefers-color-scheme: dark)" content="#212529" />
The current Metadata API only accepts string for themeColor as shown below. Is there a way to add that media attribute so I can change its content accordingly to the users' theme preference?
export const metadata: Metadata = { themeColor: '#212529' }
Describe alternatives you've considered
NIL
Beta Was this translation helpful? Give feedback.
All reactions