It's time to fix the Tailwind CSS deprecated colors warning when using tailwindcss/colors
#15127
Replies: 5 comments
-
Any further developments on this topic? |
Beta Was this translation helpful? Give feedback.
-
Please update! |
Beta Was this translation helpful? Give feedback.
-
I recently updated my packages and get these messages filling up my console which is super annoying.
This is due to these lines which I guess were added recently because I've never had these pop up in my console before: colors.d.ts
I am not even using tailwind/colors. I am in a monorepo with a UI package that has a tailwind preset that is used in presets, but neither contain tailwindcss/colors as a package. |
Beta Was this translation helpful? Give feedback.
-
Found the answer here const colors = require('tailwindcss/colors')
// removing old colors
delete colors.lightBlue;
delete colors.warmGray;
delete colors.trueGray;
delete colors.coolGray;
delete colors.blueGray;
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./App.{js,jsx,ts,tsx}",
"./screens/**/*.{js,jsx,ts,tsx}",
"./components/**/*.{js,jsx,ts,tsx}",
"./src/**/*.{html,js}",
"./app/**/*.{js,tsx,ts,jsx}",
"./node_modules/.cache/**/*.{js,tsx,ts,jsx}"],
theme: {
extend: {},
colors: {
...colors,
'cust-blue': '#2782fb',
'cust-dk-blue': '#0155c1',
'cust-lt-blue': '#80cffe',
'cust-lt2-blue': '#8fd4fc',
},
},
plugins: [],
} |
Beta Was this translation helpful? Give feedback.
-
The above solution didn't work for us, maybe because the error was being triggered from inside the We were able to fix it by deleting lines 315-354 of |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Simply using
tailwindcss/colors
seems to cause this error even when not directly using any deprecated color in the tailwind config (i.e.lightBlue
,warmGray
,trueGray
,coolGray
,blueGray
).When stating
warn - Update your configuration file to silence this warning.
is there a way to fix this, if so it isn't blatantly documented in the official docs?At the least, there should be an option in the config to silence these warnings completely without needing to actually apply any changes, basically an option to forcefully say "We understand and don't want these logs even if it is an actual issue so we can just get rid of them."
suppressDeprecationWarnings
Additionally I'm confused why something deprecated is included just to log these warnings to users, why not include an auto migration warning to those upgrading versions "this seems to be the typical standard in upgrading these days, right?"? Also why not give additional options within
tailwindcss/colors
to import the deprecated colors directly for those that need the backwards compatibilitybandaid
instead of "punishing" users on the latest versions.These suggested fixes reward the new & latest version users the ability to use the default colors from
tailwindcss/colors
freely without being warning punched, since these users are less likely to even know those deprecated colors exist.Beta Was this translation helpful? Give feedback.
All reactions