0.2.0 • Published 12 months ago

@amandaguthrie/panda-preset-framework-simplecss v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

@amandaguthrie/panda-preset-framework-simplecss

A Panda CSS preset that recreates simple.css. Simple.css is a CSS template that focuses on styling HTML semantic elements without classes to quickly prototype and build simple pages.

This preset makes it easy to generate the styles like simple.css from within Panda CSS while making it your own with configurable color and font tokens.

StackBlitz Sandbox / Demo

Contents

Install

npm

npm install -D @amandaguthrie/panda-preset-framework-simplecss

pnpm

pnpm install -D @amandaguthrie/panda-preset-framework-simplecss

yarn

yarn add -D @amandaguthrie/panda-preset-framework-simplecss

bun

bun add -D @amandaguthrie/panda-preset-framework-simplecss

> Back to Contents


Configure

In your panda.config.{ts,js} file, import the preset and include it in your presets list. This preset does rely on the default settings of @pandacss/preset-base as a dependency.

!CAUTION It is important to set preflight to false. Simple.css has its own reset and there will be undesirable effects to margins, heading spacing, etc. if preflight is enabled.

!TIP If you don't currently have any presets in your config file, add @pandacss/preset-base to the array.

import { defineConfig } from '@pandacss/dev';
import presetBase from "@pandacss/preset-base";
import simpleCssPreset, { type BreakpointsPresetOptions } from '@amandaguthrie/panda-preset-framework-simplecss';

const simpleCssConfig: SimpleCssPresetOptions = {
  prefix: "simplecss"
};

export default defineConfig({
  preflight: false,
  // ...
  presets: [
    presetBase,
    // ... Other presets
    simpleCssPreset(simpleCssConfig),
  ],
  // ...
});

Function pandaPresetFrameworkSimpleCss

The function pandaPresetFrameworkSimpleCss is the default export which optionally accepts configuration parameters and returns a Panda CSS preset.

Parameters

The parameters for the default export options are exported as type SimpleCssPresetOptions.

  • prefix (string, Optional)
    • A prefix to use in conditions, tokens, etc. This prevents conflicts with your other styles.
    • Default: "simplecss"
  • colors (Partial<SimpleCssColorConfig>, Optional)
    • A color map to replace default colors with your own.
    • Default: See defaultOptions in src/preset.ts.
  • fonts (Partial<SimpleCssFontConfig>, Optional)
    • A font map to replace default fonts with your own.
    • Default:
const fontConfigDefault = {
  mono: { value: ['Consolas', 'Menlo', 'Monaco', 'Andale Mono', 'Ubuntu Mono', 'monospace'] },
  sans: { value: ['-apple-system', 'BlinkMacSystemFont', 'Avenir Next', 'Avenir', 'Nimbus Sans L', 'Roboto', 'Noto Sans', 'Segoe UI', 'Arial', 'Helvetica', 'Helvetica Nueue', 'sans-serif',], },
}

Return

Panda CSS Preset


> Back to Contents


Token Reference


Colors

TokenTypeCSS VariableValue
colors.simplecss.accentsemanticvar(--colors-simplecss-accent)colors.simplecss.accent
colors.simplecss.accent.hoversemanticvar(--colors-simplecss-accent-hover)colors.simplecss.accent.hover
colors.simplecss.accent.textsemanticvar(--colors-simplecss-accent-text)colors.simplecss.accent.text
colors.simplecss.bgsemanticvar(--colors-simplecss-bg)colors.simplecss.bg
colors.simplecss.bg.accentsemanticvar(--colors-simplecss-bg-accent)colors.simplecss.bg.accent
colors.simplecss.blackcorevar(--colors-simplecss-black)#111111
colors.simplecss.blue.2corevar(--colors-simplecss-blue-2)#1266e2
colors.simplecss.blue.3corevar(--colors-simplecss-blue-3)#0D47A1
colors.simplecss.bordersemanticvar(--colors-simplecss-border)colors.simplecss.border
colors.simplecss.codesemanticvar(--colors-simplecss-code)colors.simplecss.code
colors.simplecss.disabledsemanticvar(--colors-simplecss-disabled)colors.simplecss.disabled
colors.simplecss.markedsemanticvar(--colors-simplecss-marked)colors.simplecss.marked
colors.simplecss.neutral.1corevar(--colors-simplecss-neutral-1)#F5F7FF
colors.simplecss.neutral.10corevar(--colors-simplecss-neutral-10)#212121
colors.simplecss.neutral.2corevar(--colors-simplecss-neutral-2)#EFEFEF
colors.simplecss.neutral.3corevar(--colors-simplecss-neutral-3)#DCDCDC
colors.simplecss.neutral.4corevar(--colors-simplecss-neutral-4)#CCCCCC
colors.simplecss.neutral.5corevar(--colors-simplecss-neutral-5)#ABABAB
colors.simplecss.neutral.6corevar(--colors-simplecss-neutral-6)#898EA4
colors.simplecss.neutral.7corevar(--colors-simplecss-neutral-7)#585858
colors.simplecss.neutral.8corevar(--colors-simplecss-neutral-8)#444444
colors.simplecss.neutral.9corevar(--colors-simplecss-neutral-9)#2B2B2B
colors.simplecss.preformattedsemanticvar(--colors-simplecss-preformatted)colors.simplecss.preformatted
colors.simplecss.red.2corevar(--colors-simplecss-red-2)#f06292
colors.simplecss.red.3corevar(--colors-simplecss-red-3)#D81B60
colors.simplecss.textsemanticvar(--colors-simplecss-text)colors.simplecss.text
colors.simplecss.text.lightsemanticvar(--colors-simplecss-text-light)colors.simplecss.text.light
colors.simplecss.whitecorevar(--colors-simplecss-white)#FFFFFF
colors.simplecss.yellow.1corevar(--colors-simplecss-yellow-1)#FFE099
colors.simplecss.yellow.2corevar(--colors-simplecss-yellow-2)#FFDD33
colors.simplecss.yellow.3corevar(--colors-simplecss-yellow-3)#FFB300

Fonts

TokenTypeCSS VariableValue
fonts.simplecss.monocorevar(--fonts-simplecss-mono)Consolas, Menlo, Monaco, Andale Mono, Ubuntu Mono, monospace
fonts.simplecss.sanscorevar(--fonts-simplecss-sans)-apple-system, BlinkMacSystemFont, Avenir Next, Avenir, Nimbus Sans L, Roboto, Noto Sans, Segoe UI, Arial, Helvetica, Helvetica Nueue, sans-serif

Radii

TokenTypeCSS VariableValue
radii.simplecss.standardcorevar(--radii-simplecss-standard)5px

> Back to Contents


Examples

Replace colors using preset config

import { defineConfig } from '@pandacss/dev';
import presetBase from "@pandacss/preset-base";
import simpleCssPreset from '@amandaguthrie/panda-preset-frameworks-simplecss';

export default defineConfig({
  preflight: false,
  // ...
  presets: [
    presetBase,
    // ... Other presets
    simpleCssPreset({ colors: { red: { 2: { value: "#EC8E7B" }, 3: { value: "#E54D2E" } } } }),
  ],
  // ...
});
const defaultPresetReturn = {
  theme: {
    extend: {
      tokens: {
        colors: {
          simplecss: {
            // Other colors are default preset colors
            red: { 2: { value: "#EC8E7B" }, 3: { value: "#E54D2E" } }
          }
        }
      }
    }
  }
}

> Back to examples

Replace colors using Panda config

import { defineConfig } from '@pandacss/dev';
import presetBase from "@pandacss/preset-base";
import simpleCssPreset from '@amandaguthrie/panda-preset-frameworks-simplecss';

export default defineConfig({
  preflight: false,
  // ...
  theme: {
    extend: {
      tokens: {
        colors: {
          simplecss: { // If you changed the prefix in the config, use your prefix instead of simplecss.
            red: { 2: { value: "#EC8E7B" }, 3: { value: "#E54D2E" } }
          }
        }
      }
    }
  },
  presets: [
    presetBase,
    // ... Other presets
    simpleCssPreset(),
  ],
  // ...
});

> Back to examples

Acknowledgement

  • Panda CSS for building a robust and extensible styling solution
  • Simple.css for designing a minimalist yet aesthetically pleasing template

> Back to Contents


License

MIT © 2024 Amanda Guthrie


> Back to Contents