Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where to customize theme colors in the latest version? #20

Open
yang-zhang-work opened this issue Nov 11, 2024 · 1 comment
Open

where to customize theme colors in the latest version? #20

yang-zhang-work opened this issue Nov 11, 2024 · 1 comment

Comments

@yang-zhang-work
Copy link

yang-zhang-work commented Nov 11, 2024

I followed the doc (https://nextjstemplates.com/docs/customization#customizing-colors) and tried to customize theme color, but after updating tailwind.config.ts and rerunning npm run dev, nothing changes. I wonder if the doc was bit of outdated and there is a new way of customizing colors, or maybe I just did it wrong.

import type { Config } from "tailwindcss";

const config: Config = {
  darkMode: "class",
  content: [
    "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
    "./src/components/**/*.{js,ts,jsx,tsx,mdx}",
    "./src/app/**/*.{js,ts,jsx,tsx,mdx}",
  ],
  theme: {
      colors: {
        current: "currentColor",
        transparent: "transparent",
        white: "#ffffff",
        black: "#090e34",
        dark: "#1d2144",
        primary: "#0ACF83",
        yellow: "#FFD600",
        "body-color": "#959cb1",
    },
  },
  plugins: [require("tailgrids/plugin")],
};
export default config;
@VochanecA
Copy link

I followed the doc (https://nextjstemplates.com/docs/customization#customizing-colors) and tried to customize theme color, but after updating tailwind.config.ts and rerunning npm run dev, nothing changes. I wonder if the doc was bit of outdated and there is a new way of customizing colors, or maybe I just did it wrong.

import type { Config } from "tailwindcss";

const config: Config = {
  darkMode: "class",
  content: [
    "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
    "./src/components/**/*.{js,ts,jsx,tsx,mdx}",
    "./src/app/**/*.{js,ts,jsx,tsx,mdx}",
  ],
  theme: {
      colors: {
        current: "currentColor",
        transparent: "transparent",
        white: "#ffffff",
        black: "#090e34",
        dark: "#1d2144",
        primary: "#0ACF83",
        yellow: "#FFD600",
        "body-color": "#959cb1",
    },
  },
  plugins: [require("tailgrids/plugin")],
};
export default config;

If you want to add custom colors while keeping the default colors intact, you can use the extend property within the theme section of your configuration. Here's how to do it:

import type { Config } from "tailwindcss";
const colors = require('tailwindcss/colors');

const config: Config = {
darkMode: "class",
content: [
"./src/pages//*.{js,ts,jsx,tsx,mdx}",
"./src/components/
/.{js,ts,jsx,tsx,mdx}",
"./src/app/**/
.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
colors: {
...colors,
primary: "#1A202C", // Add your custom primary color
'custom-blue': '#1E90FF', // Example of adding a new color
'custom-green': '#32CD32', // Another custom color
},
},
},
plugins: [require("tailgrids/plugin")],
};

export default config;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants