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

feat: style blog #33

Merged
merged 10 commits into from
Feb 2, 2024
Merged

feat: style blog #33

merged 10 commits into from
Feb 2, 2024

Conversation

deer
Copy link
Owner

@deer deer commented Feb 2, 2024

closes #12

I've finally learned enough in order to actually sort this out.

@deer
Copy link
Owner Author

deer commented Feb 2, 2024

I'll create another PR to pull the non-style changes out of this.

@deer
Copy link
Owner Author

deer commented Feb 2, 2024

For anyone who encounters this, the way to style the primary part of the blog is in your tailwind.config.ts:

import { type Config } from "tailwindcss";
import { safelist } from "fresh_blog/mod.ts";
import colors from "tailwindcss/colors.js";

export default {
  darkMode: "class",
  content: [
    "{routes,islands,components}/**/*.{ts,tsx}",
  ],
  theme: {
    extend: {
      colors: {
        light: {
          background: colors.white,
          foreground: colors.black,
          mutedBackground: colors.gray[200],
          mutedForeground: colors.gray[700],
        },
        dark: {
          background: colors.black,
          foreground: colors.white,
          mutedBackground: colors.pink[700],
          mutedForeground: colors.gray[400],
        },
      },
    },
  },
  safelist: safelist,
} satisfies Config;

If you want to style the generated markdown, then you'll need to add something like this to your styles.css:

@layer base {
  #markdown-body[data-color-mode="dark"] {
    --color-canvas-default: #000000;
    --color-fg-default: #ffffff;
  }
}

This particular example is forcing the markdown in dark mode to match the background/foreground in my theme.

@deer deer merged commit ab46b3d into main Feb 2, 2024
1 of 2 checks passed
@deer deer deleted the style_refresh branch February 2, 2024 17:25
@deer deer mentioned this pull request Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Style Posts / Post List
1 participant