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

@lostisworld/tailwind-mask

v1.0.1

Published

A Tailwind CSS plugin that provides utilities for working with mask properties, allowing you to easily apply masking effects to your elements.

Downloads

86

Readme

Tailwind CSS Mask Plugin

A Tailwind CSS plugin that provides utilities for working with mask properties, allowing you to easily apply masking effects to your elements.

Try it on the TailwindCSS Playground

Installation

Install the plugin via npm:

npm install @lostisworld/tailwind-mask

Install the plugin via pnpm:

pnpm add @lostisworld/tailwind-mask

Usage

Include the plugin in your Tailwind CSS configuration file (tailwind.config.js):

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      // ... other configurations
    }
  plugins: [
    // ... other plugins
    require('@lostisworld/tailwind-mask'),
  ],
};

Available Classes and Properties

mask-image-*

Possible values: gradient-to-t, gradient-to-tr, gradient-to-tl, gradient-to-r, gradient-to-b, gradient-to-br, gradient-to-bl, gradient-to-l, radial-at-c, radial-at-t, radial-at-tr, radial-at-r, radial-at-br, radial-at-b, radial-at-bl, radial-at-l, radial-at-tl

You can also use Tailwind CSS gradient classes for masking image properties. The following example demonstrates how to use the default Tailwind gradient classes:

<div class="mask-image-gradient-to-b from-transparent to-black to-90%">
  <!-- Your content here -->
</div>

Here, from-transparent, to-black and to-90% are standard Tailwind gradient color classes.

Browser Compatibility: MDN Documentation for mask-image

mask-size-*

Possible values: cover, contain, px, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 96, 1/2, 1/3, 2/3, 1/4, 1/5, full, space, auto

<div class="mask-size-auto">
  <!-- Your content here -->
</div>

Browser Compatibility: MDN Documentation for mask-size

mask-repeat-*

Possible values: no-repeat, repeat, repeat-x, repeat-y, space, round

<div class="mask-repeat-round">
  <!-- Your content here -->
</div>

Browser Compatibility: MDN Documentation for mask-repeat

mask-position-*

Possible values: top, left, right, center, bottom, center-top, center-bottom, center-left, center-right

<div class="mask-position-center">
  <!-- Your content here -->
</div>

Browser Compatibility: MDN Documentation for mask-position

mask-origin-*

Possible values: border-box, content-box, padding-box, fill-box, stroke-cox, view-box

<div class="mask-origin-border-box">
  <!-- Your content here -->
</div>

Browser Compatibility: MDN Documentation for mask-origin

mask-clip-*

Possible values: border-box, content-box, padding-box, fill-box, stroke-cox, view-box

<div class="mask-clip-fill-box">
  <!-- Your content here -->
</div>

Browser Compatibility: MDN Documentation for mask-clip

mask-type-*

Possible values: luminance, alpha

<div class="mask-type-alpha">
  <!-- Your content here -->
</div>

Browser Compatibility: MDN Documentation for mask-type

mask-composite-*

Possible values: add, substract, intersect, exclude

<div class="mask-composite-exclude">
  <!-- Your content here -->
</div>

Browser Compatibility: MDN Documentation for mask-composite

mask-mode-*

Possible values: luminance, alpha, match-source

<div class="mask-mode-luminance">
  <!-- Your content here -->
</div>

Browser Compatibility: MDN Documentation for mask-mode

mask-*-[customValue]

For enhanced customization, users can incorporate dynamic values directly within HTML classes for any mask-* property. By adopting the syntax mask-*-[customValue], users can seamlessly integrate personalized values into various mask properties like image, size, repeat, position, clip, type, origin, mode, and composite. This approach empowers users to effortlessly fine-tune the appearance of their elements by providing custom values specific to each mask property directly in their HTML markup.

<div class="mask-image-[url('/path/to/mask.svg')]">
  <!-- Your content here -->
</div>

Customization

Customize the default values or add your own variations for each property in the theme section of your Tailwind CSS configuration file: For custom values, it's essential to encapsulate them within a mask: {} object. Within this object, you can define specific properties such as size, repeat, position, clip, type, origin, mode, and composite. This structure ensures clarity and allows you to tailor each property according to your preferences.

// tailwind.config.js
module.exports = {
  // ... other configurations
  theme: {
    mask: {
      image: {
        // Customize image options
      },
      size: {
        // Customize size options
      },
      // ... other customization options
    },
  },
};

Certainly! Here are the examples using your Tailwind CSS mask plugin classes:

<figure class="bg-blue-500 rounded-lg overflow-hidden">
    <img src="/yourImagePath" alt="" class="h-96 from-black to-transparent to-90% mask-image-gradient-to-b" />
</figure>

<img src="https://images.unsplash.com/photo-1550355291-bbee04a92027?q=80&w=2536&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" alt="" class="h-96 w-96 object-cover mask-image-[url(shapePath.svg)]" />

Using CSS Mask with animation

Use Autoprefixer and remember to check the most up-to-date information on browser compatibility.

License

This Tailwind CSS plugin is open-source and available under the MIT License.


Feel free to customize the sections as needed, and provide more details if necessary. Ensure to keep the information clear and concise, and include any additional instructions or examples that might be helpful for users.