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

theme #109

Open
xiaotiandada opened this issue May 26, 2022 · 0 comments
Open

theme #109

xiaotiandada opened this issue May 26, 2022 · 0 comments
Labels
Next Next

Comments

@xiaotiandada
Copy link
Owner

xiaotiandada commented May 26, 2022

Next.js

如果需要 可以考虑用 cookie 传递服务端的主题,因为 next-themes 使用的是 localstore 存储
大部分情况 不需要
可供参考:https://github.com/xeoneux/next-dark-mode/blob/main/src/index.tsx
使用 cookies 不是一个好主意 pacocoursey/next-themes#17

使用 localstore 结合 MUI UI 库可能会有闪烁的情况,需要更能多的实践

MUI

import { createTheme, ThemeOptions } from '@mui/material/styles'

// https://mui.com/material-ui/customization/default-theme/
// https://material.io/resources/color

const defaultTheme: ThemeOptions = {
  typography: {
    button: {
      textTransform: 'none',
    },
  },
}

export const lightTheme = createTheme({
  palette: {
    mode: 'light',
    primary: {
      main: '#ff2449',
      light: '#ff6675',
      dark: '#c40022',
    },
  },
  ...defaultTheme,
})
export const darkTheme = createTheme({
  palette: {
    mode: 'dark',
    primary: {
      main: '#f93c5b',
      light: '#ff7588',
      dark: '#bf0032',
    },
  },
  ...defaultTheme,
})

Disqus

-https://stackoverflow.com/questions/65260505/disqus-iframe-transparency-wont-work-on-chrome-87
-w3c/csswg-drafts#4772

Algolia

@xiaotiandada xiaotiandada added the Next Next label May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Next Next
Projects
None yet
Development

No branches or pull requests

1 participant