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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pie-lib/styling-svelte

v0.1.2

Published

PIE styling utilities for Svelte components. This package mirrors the functionality of `@pie-lib/render-ui` for React components, providing consistent theming across PIE elements.

Readme

@pie-lib/styling-svelte

PIE styling utilities for Svelte components. This package mirrors the functionality of @pie-lib/render-ui for React components, providing consistent theming across PIE elements.

Installation

bun add @pie-lib/styling-svelte

Usage

In Svelte Components

Use PIE color variables directly in your component styles:

<script lang="ts">
  import { color } from '@pie-lib/styling-svelte';

  let isDarkMode = $state(false);
</script>

<div class="container">
  <p>This uses PIE theming!</p>
</div>

<style>
  .container {
    color: var(--pie-text, rgba(0, 0, 0, 0.87));
    background-color: var(--pie-background, white);
    border: 1px solid var(--pie-border-light, #ccc);
    padding: 1rem;
  }

  .container:hover {
    border-color: var(--pie-primary, #3f51b5);
  }
</style>

Programmatic Access

You can also use the color functions programmatically:

<script lang="ts">
  import { color } from '@pie-lib/styling-svelte';

  let buttonStyle = $state('');

  function updateStyle() {
    buttonStyle = `
      background-color: ${color.primary()};
      color: ${color.white()};
      border: 1px solid ${color.primaryDark()};
    `;
  }
</script>

<button style={buttonStyle} onclick={updateStyle}>
  Click me
</button>

Available Colors

All color functions return CSS variable references with fallback values:

Basic Colors

  • text() - Main text color
  • background() - Background color
  • disabled() - Disabled state color
  • border(), borderLight(), borderDark() - Border colors
  • black(), white(), transparent()

Status Colors

  • correct(), correctSecondary(), correctWithIcon() - Correct answer states
  • incorrect(), incorrectSecondary(), incorrectWithIcon() - Incorrect answer states
  • missing(), missingWithIcon() - Missing/unanswered states

Theme Colors

  • primary(), primaryLight(), primaryDark() - Primary theme color
  • secondary(), secondaryLight(), secondaryDark() - Secondary theme color
  • tertiary(), tertiaryLight() - Tertiary theme color

Special Colors

  • backgroundDark(), secondaryBackground(), dropdownBackground()
  • focusChecked(), focusUnchecked() - Focus states
  • blueGrey100(), blueGrey300(), blueGrey600(), blueGrey900() - Blue-grey scale

How It Works

Each color function generates a CSS variable reference with a fallback:

color.primary() // Returns: var(--pie-primary, #3f51b5)
color.text()    // Returns: var(--pie-text, rgba(0, 0, 0, 0.87))

This allows:

  1. Theme consistency - All PIE elements use the same color system
  2. Runtime theming - Colors can be overridden via CSS custom properties
  3. Graceful fallbacks - Default colors work even without theme provider
  4. Framework agnostic - Works with any CSS-based styling approach

Comparison with React

This package mirrors @pie-lib/render-ui/color:

React:

import { color } from '@pie-lib/render-ui';

const StyledDiv = styled('div')({
  color: color.text(),
  backgroundColor: color.background(),
});

Svelte:

<script>
  import { color } from '@pie-lib/styling-svelte';
</script>

<style>
  div {
    color: var(--pie-text, rgba(0, 0, 0, 0.87));
    background-color: var(--pie-background, white);
  }
</style>

Best Practices

  1. Always use CSS variables in styles - Reference --pie-* variables directly in <style> blocks
  2. Use color functions for dynamic styles - Use the imported functions when building style strings programmatically
  3. Provide fallbacks - The library includes sensible defaults, but you can override them
  4. Match React conventions - When porting React components, use equivalent color variables

Example: EditableHtml Component

See packages/lib-svelte/editable-html-tiptap-svelte/src/EditableHtml.svelte for a complete example of using PIE variables throughout a component.

Architecture

  • No runtime overhead - Pure TypeScript functions that return strings
  • Type-safe - Full TypeScript support with auto-completion
  • Tree-shakeable - Import only what you need
  • Zero dependencies - No external dependencies beyond TypeScript

License

Private package for PIE Elements monorepo.