tailwindcss-ripple icon indicating copy to clipboard operation
tailwindcss-ripple copied to clipboard

Custom Colors Not Working?

Open jjjrmy opened this issue 4 years ago • 6 comments

My custom colors are not being included with the Ripple. Am I missing something? Also will it work with var colors?

module.exports = {
    theme: {
        extend: {
            colors: {
                'brand1': 'var(--brand1)',
                'brand2': 'var(--brand2)',
                'dodgerblue': 'dodgerblue',
            },
        },
        container: {
            center: true,
            padding: '1rem',
        },
        ripple: theme => ({
            colors: theme('colors')
        }),
    },
    variants: {
        borderWidth: ['responsive', 'hover', 'focus'],
        textColor: ['hover', 'active', 'group-hover', 'group-active'],
        boxShadow: ['hover', 'focus', 'active', 'group-hover', 'group-active'],
    },
    plugins: [
        require('@tailwindcss/ui'),
        require('tailwindcss-ripple')(),
    ]
}

jjjrmy avatar Jul 01 '20 04:07 jjjrmy

Hey! I'll try and take a look at this over the next few days :)

jamessessford avatar Aug 01 '20 11:08 jamessessford

Hey @jjjrmy - I can't believe how quickly the time I haven't been looking at open source stuff has gone!

I had a look at this today and the latest version will allow you to use named colors (dodgerblue) but it won't work with CSS variables unfortunately. I'll close this off but keep it in mind when I'm looking at it again to see if there's a way I can achieve this.

Cheers!

jamessessford avatar Feb 06 '21 10:02 jamessessford

@jamessessford Just ran into the same issue with CSS variables. Is there any particular limitation that is preventing this from working?

Enteleform avatar Aug 21 '21 01:08 Enteleform

Hey @Enteleform - the problem I had was in evaluating the variable in the plugin. I've got a bit of free time this weekend so I'll have another look at it and see if I can get it cracked!

Cheers!

jamessessford avatar Aug 24 '21 10:08 jamessessford

I have the same issue, but not using variables. I have extended the colors & I get this error:

Tailwind CSS: Unable to parse color from object:

Example:

extend: {
    colors: {
      primary: {
              background: {
                DEFAULT: "#17191f",
                50: "#343846",
                100: "#2e323e",
                ...

Appreciate any and all help!

chrber04 avatar May 27 '22 17:05 chrber04

Hey @chrber04 - can you paste the contents of your full tailwind config file and your package.json file for me and I'll see if I can spot what's going on

jamessessford avatar Jun 01 '22 09:06 jamessessford

Going to close this off as it's not solvable by the package at this time.

Under the hood the package uses lighten and darken functions to set the colours but as these are not functions that can be applied in a stylesheet, css variables can't be used.

I'll revisit again if this changes

jamessessford avatar Jan 18 '23 11:01 jamessessford