nextra icon indicating copy to clipboard operation
nextra copied to clipboard

How to set actual color for dark/white mode?

Open itsmaty opened this issue 1 year ago • 5 comments

So you can chnage between dark & white mode, great. But how to actually set the color for the background/text for certain mode.

So for drakmode the background is HEX #111111 Ho to chnage it to #00000 or any other color?

itsmaty avatar Mar 07 '24 23:03 itsmaty

Available in v3, use backgroundColor theme option

dimaMachina avatar Mar 07 '24 23:03 dimaMachina

took some time to figure this out but it works thanks

whats a bit confusing and not "expected behaviour" that you have to set the rgb code in a string and cant use the hex code but as i looked into how this was actually implemented here: https://github.com/shuding/nextra/pull/2732 and how the css variable is used in the css is probably a tailwind thing and so wont be able to support hex codes.

itsmaty avatar Mar 08 '24 08:03 itsmaty

that you have to set the rgb code in a string and cant use the hex code

yes, it was made since configurable backroundColor is used in some places with opacity and using hex requires more configuration and increasing client bundle size

this will be improved in Nextra v4 and using server components

dimaMachina avatar Mar 08 '24 16:03 dimaMachina

@dimaMachina exciting to hear! Are there instructions for migrating to v3 (or v4?) - I tried manually installing one of the alpha packages but got peer dependency warnings and some errors when running.

mmkal avatar Jul 11 '24 22:07 mmkal

@mmkal https://the-guild.dev/blog/nextra-3

dimaMachina avatar Jul 12 '24 08:07 dimaMachina