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

@downwindcss/text-decoration

v1.1.1

Published

**NOTE**: Deprecated for Tailwind CSS version 3.x. because TW now provides these functionalities out of the box. - Text Decoration Color - https://tailwindcss.com/docs/text-decoration-color - Text Decoration Style - https://tailwindcss.com/docs/text-dec

Downloads

5,382

Readme

@downwindcss/text-decoration

NOTE: Deprecated for Tailwind CSS version 3.x.
because TW now provides these functionalities out of the box.

  • Text Decoration Color - https://tailwindcss.com/docs/text-decoration-color
  • Text Decoration Style - https://tailwindcss.com/docs/text-decoration-style
  • Text Decoration Thickness - https://tailwindcss.com/docs/text-decoration-thickness
  • Text Underline Offset - https://tailwindcss.com/docs/text-underline-offset

A Tailwind CSS Plugin for text-decoration utility.

This plugin is composable (Composing the Uncompsable with CSS Variables) thus can add multiple decoration-line utitlies (to add under/overline and line-through together. Refer to the "Usage" sectrion below)

Installation

npm install @downwindcss/text-decoration
# for Yarn users
yarn add @downwindcss/text-decoration

Configuration

Add the plugin in tailwind.config.js in Plugins section.

// tailwind.config.js
module.exports = {
  plugins: [require('@downwindcss/text-decoration')],
};

TL;DR

Example: https://play.tailwindcss.com/fm4Vucj6IG

Here are all the available utilities

| Utility Name | CSS Definition | |------------------------------|---------------------------------------------------| | text-decoration | N/A: Needed to apply text decoration | | text-decoration-underline | text-decoration-line: underline | | text-decoration-overline | text-decoration-line: overline | | text-decoration-line-through | text-decoration-line: line-through | | text-decoration-solid | text-decoration-style: solid | | text-decoration-double | text-decoration-style: double | | text-decoration-dotted | text-decoration-style: dotted | | text-decoration-dashed | text-decoration-style: dashed | | text-decoration-wavy | text-decoration-style: wavy | | text-decoration-1 | text-decoration-thickness: 1px; | | text-decoration-2 | text-decoration-thickness: 2px; | | text-decoration-4 | text-decoration-thickness: 4px; | | text-decoration-8 | text-decoration-thickness: 8px; | | text-decoration-$color | $color: All Tailwind CSS and your custom colors |

Utilities

Usage

To enable text-decoration utilities, you need to add .text-decoration class.

By itself it doesn't apply any style similar to how built-in Transform utility doesn't apply any transformations.

<h2 class="text-decoration">Header</h2>

text-decoration-line

Utilities for applying lines.
MDN: decoration-line

Use Tailwind CSS's no-underline to remove text decoration.

ATTRIBUTION: Screenshots on decoration-line by Mozilla Contributrors is licensed under CC-BY-SA 2.5

underline.

<p>
  I'd far rather be
  <span class="text-decoration text-decoration-underline">
    happy than right
  </span>
  any day.
</p>

rendered

overline.

<p>
  I'd far rather be
  <span class="text-decoration text-decoration-overline">
    happy than right
  </span>
  any day.
</p>

rendered

line-through.

<p>
  I'd far rather be
  <span class="text-decoration text-decoration-through">
    happy than right
  </span>
  any day.
</p>

rendered

NOTE: It's not decoration-line-line-through even though CSS applied is decoration-line: line-through;

underline + overline + line-through

<p>
  I'd far rather be
  <span
    class="
        text-decoration 
        text-decoration-overline 
        text-decoration-underline 
        text-decoration-line-through"
  >
    happy than right
  </span>
  any day.
</p>

rendered

text-decoration-color

All Tailwind CSS colors AND your extended colors are available.

You can extend decoration colors and by extending textDecorationPlugin.colors.

Extend colors in tailwind.config.js

const colors = require('tailwindcss/colors')

module.exports = {
  theme: {
    extend: {
      textDecorationPlugin: {
        colors: {
          primary: 'tomato',
          secondary: 'gold',
        },
      },    },
  },
  variants: {},
  plugins: [textDecorationPlugin],
}

And use them in your HTML markup.

<h1 class="
    text-decoration 
    text-decoration-underline 
    text-decoration-overline 
    text-decoration-line-through 
    text-decoration-wavy
    text-decoration-primary
    text-decoration-2">
    Header
</h1>

If you extend colors, extended colors will be available for the plugin.

const colors = require('tailwindcss/colors')

module.exports = {
  theme: {
    extend: {
      colors: {
        'light-blue': colors.lightBlue,
      },
      textDecorationPlugin: {
        colors: {
          primary: 'tomato',
        },
      },
    },
  },
  variants: {},
  plugins: [textDecorationPlugin],
}

And use them in your HTML markup.

<h1 class="
    text-decoration 
    text-decoration-underline 
    text-decoration-overline 
    text-decoration-line-through 
    text-decoration-wavy
    text-decoration-light-blue-300
    text-decoration-2">
    Header
</h1>

text-decoration-style

You can use following text-decoration-styles.

| CSS | Applied Style | |------------------------|-------------------------------| | text-decoration-solid | text-decoration-style: solid | | text-decoration-double | text-decoration-style: double | | text-decoration-dotted | text-decoration-style: dotted | | text-decoration-dashed | text-decoration-style: dashed | | text-decoration-wavy | text-decoration-style: wavy |

text-decoration-thickness

When you type decoration-{thickness: number}, text-decoration-thickness will be applied.

As an example, decoration-2 will apply 2px thickness

<h1 class="
    text-decoration 
    text-decoration-underline 
    text-decoration-overline 
    text-decoration-line-through 
    text-decoration-wavy
    text-decoration-primary
    text-decoration-2">
    Header
</h1>

Available values are,

| CSS | Applied Style | |-------------------|---------------------------------| | text-decoration-1 | text-decoration-thickness: 1px; | | text-decoration-2 | text-decoration-thickness: 2px; | | text-decoration-4 | text-decoration-thickness: 4px; | | text-decoration-8 | text-decoration-thickness: 8px; |

You can extend the thickness by updating configuration, textDecorationPlugin.thicknesses property.

module.exports = {
  theme: {
    extend: {
      textDecorationPlugin: {
        thicknesses: {
          '0.2rem': '0.2rem',
        },
      },
    },
  },
  variants: {},
  plugins: [textDecorationPlugin],
}

And use it as decoration-0.2rem.

Clearing Deocration

Use decoration-none.

Duplicate Utilities

Following text-decoration can be done with native Tailwind CSS utilities but also added in this plugin to enable composability.

  1. underline: text-decoration: underline;
  2. line-through: text-decoration: line-through;
  3. no-underline: text-decoration: none;

Resource

Context

Based on idea post in Tailwind CSS dicussion, https://github.com/tailwindlabs/tailwindcss/discussions/3749

This plugin provides missing Tailwind CSS text-decoration* properties as a plugin.

Build

This project uses PNPM