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

unocss-preset-button-painter

v1.0.15

Published

A UnoCSS preset that dynamically generates button color utilities based on your theme's color configuration

Downloads

166

Readme

🎨🎨🎨 unocss-preset-button-painter

A UnoCSS preset that dynamically generates button color utilities based on your theme's color configuration. It creates solid and ghost button styles with smart text contrast and hover/focus states, complete with autocomplete support.

Probably don't use this unless you are pop open the rules in the preset and understand what it is doing. It is not very useful unless used with additional base CSS

Installation

https://www.npmjs.com/package/unocss-preset-button-painter

npm install unocss-preset-button-painter

Usage

Add the preset to your UnoCSS configuration:

import { defineConfig, presetUno } from 'unocss'
import { presetButtonPainter } from 'unocss-preset-button-painter'

export default defineConfig({
  presets: [
    presetUno(),
    presetButtonPainter()
  ]
})

Features

  • Dynamic Button Styles: Generates .button-{color}-{shade} for solid buttons and .button-ghost-{color}-{shade} for outline/ghost buttons based on your theme's colors.
  • Smart Text Contrast: Automatically selects dark or light text based on the background shade for optimal readability.
  • Hover/Focus States: Ghost buttons include hover and focus states with appropriate background and text color transitions.
  • Autocomplete Support: Provides autocompletion for button classes in supported editors (e.g., button-primary-500, button-ghost-blue-600).
  • Size Variants: Includes shorthand for button sizes (button, button-small, button-medium, button-large).

Example

Assuming your theme defines a primary color with shades (e.g., primary.500, primary.900), you can use:

<button class="button-primary-500">Solid Button</button>
<button class="button-ghost-primary-500">Ghost Button</button>

This will generate:

  • A solid button with a primary-500 background, appropriate text color, and matching border.
  • A ghost button with a transparent background, primary-500 border and text, and a hover state with a primary-500 background and contrasting text.

Notes

  • Ensure your UnoCSS theme includes a colors object with named colors and shades (e.g., { primary: { 500: '#3B82F6', 900: '#1E3A8A' } }).
  • This preset is best suited for projects with custom theming needs. Familiarize yourself with its functionality before using it in production.

License

MIT