Jacky Zhao
2023-07-23 7db2eda76cf51fd631d385c12a7b411339406067
quartz/theme.ts
@@ -1,26 +1,29 @@
export interface ColorScheme {
  light: string,
  lightgray: string,
  gray: string,
  darkgray: string,
  dark: string,
  secondary: string,
  tertiary: string,
  light: string
  lightgray: string
  gray: string
  darkgray: string
  dark: string
  secondary: string
  tertiary: string
  highlight: string
}
export interface Theme {
  typography: {
    header: string,
    body: string,
    header: string
    body: string
    code: string
  },
  }
  colors: {
    lightMode: ColorScheme,
    lightMode: ColorScheme
    darkMode: ColorScheme
  }
}
const DEFAULT_SANS_SERIF =
  '-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'
const DEFAULT_MONO = "ui-monospace, SFMono-Regular, SF Mono, Menlo, monospace"
export function googleFontHref(theme: Theme) {
  const { code, header, body } = theme.typography
  return `https://fonts.googleapis.com/css2?family=${code}&family=${header}:wght@400;700&family=${body}:ital,wght@0,400;0,600;1,400;1,600&display=swap`
@@ -37,9 +40,9 @@
  --tertiary: ${theme.colors.lightMode.tertiary};
  --highlight: ${theme.colors.lightMode.highlight};
  --headerFont: ${theme.typography.header};
  --bodyFont: ${theme.typography.body};
  --codeFont: ${theme.typography.code};
  --headerFont: ${theme.typography.header}, ${DEFAULT_SANS_SERIF};
  --bodyFont: ${theme.typography.body}, ${DEFAULT_SANS_SERIF};
  --codeFont: ${theme.typography.code}, ${DEFAULT_MONO};
}
:root[saved-theme="dark"] {