Giter Club home page Giter Club logo

tailwindcss-textshadow's Introduction

tailwindcss-textshadow

A Utility Plugins for controlling Text Shadow of an text element.

Class Properties
.text-shadow text-shadow: 0px 0px 1px rgb(0 0 0 / 20%), 0px 0px 1px rgb(1 0 5 / 10%);
.text-shadow-sm text-shadow: 1px 1px 3px rgb(36 37 47 / 25%);
.text-shadow-md text-shadow: 0px 1px 2px rgb(30 29 39 / 19%), 1px 2px 4px rgb(54 64 147 / 18%)
.text-shadow-lg text-shadow: 3px 3px 6px rgb(0 0 0 / 26%), 0 0 5px rgb(15 3 86 / 22%)
.text-shadow-xl text-shadow: 1px 1px 3px rgb(0 0 0 / 29%), 2px 4px 7px rgb(73 64 125 / 35%)
.text-shadow-none text-shadow: none

๐Ÿ’ก Features

Minimal Set-up.

Ready to use out of the box.

Has default preset shadows with variants.

Users will be able to override and extend defaults the same way they can with Tailwind's built-in styles.

Installation & changes in tailwind.config.js

Yarn

yarn add tailwindcss-textshadow --dev

npm

npm i --save-dev tailwindcss-textshadow

โœ”๏ธ import the plugin

Add the plugin to the plugins array in your Tailwind configuration file (tailwind.config.js).

plugins: [
  require('tailwindcss-textshadow')
]

๐Ÿบ Congratulations! You are ready to use text-shadow in your project.

How to use

No text shadow

Use .text-shadow-none to remove an existing text shadow from an element. This is most commonly used to remove a shadow that was applied at a smaller breakpoint.

<span class="text-shadow-none"></span>

Responsive

To control the textshadow of an text element at a specific breakpoint, add a {screen}: prefix to any existing text shadow utility. For example, use xl:text-shadow-lg to apply the text-shadow-lg utility at only large screen sizes and above.

For more information about Tailwind's responsive design features, check out the Responsive Design documentation.

<div class="text-shadow sm:text-shadow-sm md:text-shadow-md lg:text-shadow-lg xl:text-shadow-xl ...">
  <!-- ... -->
</div>

Customizing

Text Shadow

By default this plugin provides drop text shadow utilities with five modifires, and a utility for removing existing text shadows. You can change, add, or remove these by editing the theme.textShadow section of your Tailwind config.

If a default text shadow is provided, it will be used for the non-suffixed .text-shadow utility. Any other keys will be used as suffixes, for example the key '2xl' will create a corresponding .text-shadow-2xl utility.

To override the default

// tailwind.config.js
module.exports = {
  theme: {
     textShadow: {
        'default': '0 2px 0 #000',
        'md': '0 2px 2px #000',
        'h2': '0 0 3px #FF0000, 0 0 5px #0000FF',
        'h1': '0 0 3px rgba(0, 0, 0, .8), 0 0 5px rgba(0, 0, 0, .9)',
     }
   }
 }

To extend the default

// tailwind.config.js
module.exports = {
  theme: {
    // ...
    extend: {
      // ...
      textShadow: {
        '2xl': '1px 1px 5px rgb(33 34 43 / 20%)',
        '3xl': '0 0 3px rgba(0, 0, 0, .8), 0 0 5px rgba(0, 0, 0, .9)',
      },
    },
  },
}
  

Responsive and pseudo-class variants

By default, only responsive, hover and focus variants are generated for text shadow utilities.

You can control which variants are generated for the text shadow utilities by modifying the textShadow property in the variants section of your tailwind.config.js file.

For example, this config will also generate active and group-hover variants:

Use the name textShadow under variants object.

// tailwind.config.js
module.exports = {
  variants: {
    // ... 
    -   textShadow: ['responsive', 'hover', 'focus'],
    +   textShadow: ['responsive', 'hover', 'focus', 'active', 'group-hover'],
  }
}

Credits

๐Ÿ’š If you ๐Ÿ‘ this, then please give a โญ. Thank you.

License

The MIT License (MIT). Please see License File for more information.

tailwindcss-textshadow's People

Contributors

mward-sudo avatar roydebangshu avatar vladacizek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tailwindcss-textshadow's Issues

Unable to get it working

I added the proper dependencies, etc and the class is showing in the DOM but i'm not getting any text shadow....

idea: extending with colour too?

Hiya. I've Just stumbled upon this ty.

would there be any interest in extendign this plugin to include colours too?

maybe something like text-shadow-md text-shadow-red-500 to override the default colours with those of the red-500 pallete?

Wondering if the dependencies will be upgraded for this plugin?

Hi there,

Though this is not a critical concern, I am just wondering whether there will be updates to the dependencies libraries for this plugin since Tailwindcss has successfully moved to v3 with updates to dependencies such as autoprefixer, postcss, purgecss, etc.


# npm audit report

postcss  <=8.2.12
Severity: moderate
Regular Expression Denial of Service in postcss - https://github.com/advisories/GHSA-hwj9-h5mp-3pm3
Regular Expression Denial of Service in postcss - https://github.com/advisories/GHSA-566m-qj78-rww5
No fix available
node_modules/postcss-functions/node_modules/postcss
node_modules/tailwindcss-textshadow/node_modules/@fullhuman/postcss-purgecss/node_modules/postcss
node_modules/tailwindcss-textshadow/node_modules/postcss
node_modules/tailwindcss-textshadow/node_modules/purgecss/node_modules/postcss
  @fullhuman/postcss-purgecss  2.0.3 - 3.0.0
  Depends on vulnerable versions of postcss
  Depends on vulnerable versions of purgecss
  node_modules/tailwindcss-textshadow/node_modules/@fullhuman/postcss-purgecss
    tailwindcss  0.1.0 - 2.2.0-canary.16
    Depends on vulnerable versions of @fullhuman/postcss-purgecss
    Depends on vulnerable versions of autoprefixer
    Depends on vulnerable versions of postcss
    Depends on vulnerable versions of postcss-functions
    Depends on vulnerable versions of postcss-nested
    node_modules/tailwindcss-textshadow/node_modules/tailwindcss
      tailwindcss-textshadow  *
      Depends on vulnerable versions of tailwindcss
      node_modules/tailwindcss-textshadow
  autoprefixer  1.0.20131222 - 9.8.8
  Depends on vulnerable versions of postcss
  node_modules/tailwindcss-textshadow/node_modules/autoprefixer
  postcss-functions  <=3.0.0
  Depends on vulnerable versions of postcss
  node_modules/postcss-functions
  postcss-js  <=2.0.3
  Depends on vulnerable versions of postcss
  node_modules/tailwindcss-textshadow/node_modules/postcss-js
  postcss-nested  <=4.2.3
  Depends on vulnerable versions of postcss
  node_modules/tailwindcss-textshadow/node_modules/postcss-nested
  purgecss  2.0.1-beta.0 - 3.0.0
  Depends on vulnerable versions of postcss
  node_modules/tailwindcss-textshadow/node_modules/purgecss

9 moderate severity vulnerabilities

Looking forward to the potential update if it is in the pipeline.

Cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.