npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pandacss-preset-typography

v0.1.6

Published

A 🐼 PandaCSS typography preset inspired by the TailwindCSS typography plugin

Downloads

2,155

Readme

Downloads Contributors Forks Stargazers Issues MIT License LinkedIn

🐼 PandaCSS preset for typography

A 🐼 PandaCSS typography preset inspired by the TailwindCSS typography plugin

Installation

npm install --save-dev pandacss-preset-typography

Usage

Add the preset to your PandaCSS configuration (panda.config.ts)

import { defineConfig } from "@pandacss/dev";

// Import the preset. The name can be anything you want
import typographyPreset from "pandacss-preset-typography";

export default defineConfig({
  presets: [
    typographyPreset(),
    // Re-add the panda presets if you want to keep
    // the default keyframes, breakpoints, tokens
    // and textStyles provided by PandaCSS
    "@pandacss/dev/presets",
  ],
});

Prose

The preset generates a prose recipe for you that you can use to add beautiful typographic defaults to any vanilla HTML you don’t control, like HTML rendered from Markdown, or pulled from a CMS.

Usage

You can provide 5 different sizes: sm, base, lg, xl and 2xl. If you provide no options, the default size is set as base or as whatever you've set it as in the options.

// Import it from wherever you export panda to, also make sure
// you change the name 'prose' if you've set a custom name.
import { prose } from "@pandacss/out/recipes";

export function Page() {
  return <div className={prose({ size: "lg" })}></div>;
}

Lead

Just like in TailwindCSS, there's also an extra .lead class you can apply to any element within the scope of prose to get a nice lead paragraph.

Options

You can change the default options as shown below.

...
presets: [
  typographyPreset({
    recipe: {
      // Name of the recipe export
      name: "prose",
      className: "prose",
      // Sizes you want to include
      sizes: ["sm", "base", "lg", "xl", "2xl"],
      defaultSize: "base",
      // Enable/disable not-prose functionality
      // just like in TailwindCSS
      notProse: false,
      // notProse: true,
      // notProse: {
      //   className: "not-prose",
      // },
      semanticTokens: {
        // defaults: true,
        defaults: {
          // Set a color palette to use for the defaults.
          // It only works with colors that have a numeric scale (11x)
          // from 50 to 950. (50, 100, 200, ..., 800, 900, 950).
          colorPalette: "slate",
        },
        // The prefix to use for semantic tokens.
        // ex: --colors-<prefix>-body
        prefix: "prose",
      },
    },
  }),
],

Colors

Colors are currently being handled by CSS variables. The default colors are as followed:

{
  semanticTokens: {
    colors: {
      // Or whatever name you've set as the semantic tokens
      // prefix or recipe name
      prose: {
        body: {
          value: "{colors.slate.700}",
        },
        heading: {
          value: "{colors.slate.900}",
        },
        lead: {
          value: "{colors.slate.600}",
        },
        link: {
          value: "{colors.slate.900}",
        },
        bold: {
          value: "{colors.slate.900}",
        },
        counter: {
          value: "{colors.slate.500}",
        },
        bullet: {
          value: "{colors.slate.300}",
        },
        hrBorder: {
          value: "{colors.slate.200}",
        },
        quote: {
          value: "{colors.slate.900}",
        },
        quoteBorder: {
          value: "{colors.slate.200}",
        },
        caption: {
          value: "{colors.slate.500}",
        },
        kbd: {
          value: "{colors.slate.900}",
        },
        kbdShadow: {
          // Expects an RGB value
          value: "0 0 0",
        },
        code: {
          value: "{colors.slate.900}",
        },
        preCode: {
          value: "{colors.slate.200}",
        },
        preBg: {
          value: "{colors.slate.800}",
        },
        thBorder: {
          value: "{colors.slate.300}",
        },
        tdBorder: {
          value: "{colors.slate.200}",
        },
      },
    },
  },
}

If you have the Radix Colors preset installed for example, you'll get dark mode support out of the box by providing the colors as shown below. These colors combinations aren't fully tested, so change according to preference.

{
  semanticTokens: {
    colors: {
      // Or whatever name you've set as the semantic tokens
      // prefix or recipe name
      prose: {
        body: {
          value: "{colors.slate.12}",
        },
        heading: {
          value: "{colors.slate.12}",
        },
        lead: {
          value: "{colors.slate.12}",
        },
        link: {
          value: "{colors.blue.11}",
        },
        bold: {
          value: "{colors.slate.12}",
        },
        counter: {
          value: "{colors.slate.11}",
        },
        bullet: {
          value: "{colors.slate.11}",
        },
        hrBorder: {
          value: "{colors.slate.6}",
        },
        quote: {
          value: "{colors.slate.11}",
        },
        quoteBorder: {
          value: "{colors.slate.6}",
        },
        caption: {
          value: "{colors.slate.11}",
        },
        kbd: {
          value: "{colors.slate.11}",
        },
        kbdShadow: {
          // Expects an RGB value
          value: "0 0 0",
        },
        code: {
          value: "{colors.amber.11}",
        },
        preCode: {
          value: "{colors.slate.12}",
        },
        preBg: {
          value: "{colors.slate.2}",
        },
        thBorder: {
          value: "{colors.slate.6}",
        },
        tdBorder: {
          value: "{colors.slate.6}",
        },
      },
    },
  },
}

Attributions