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

Production color issue #366

Open
websnooze opened this issue Jul 18, 2024 · 2 comments
Open

Production color issue #366

websnooze opened this issue Jul 18, 2024 · 2 comments

Comments

@websnooze
Copy link

Under dev environment, colors using tailwind config are working properly but not on production..

Same if I use css classes instead of tailwind classes

@alexjidras
Copy link

having the same issue

@CodeMasterZeroOne
Copy link

Hi I dont know if thats any help for you but in my nextjs project I created custom component and I'm changing the background and text color depending on the them, currently using dark theme and light theme here's how I use it:
Screenshot 2024-09-24 at 9 13 21 AM

'use client'

import { useTheme } from 'next-themes';
import { Toaster, toast } from 'react-hot-toast';

const MyHotToaster = () => {
const { theme } = useTheme();

const getBackgroundColor = (type) => {
    const lightThemeColors = {
        // textColor: '#d4eefc',
        textColor: '#333',
        success: '#c0f0c8',
        error: '#f0c0c0',
    };

    const darkThemeColors = {
        textColor: '#fff',
        success: '#4b6e54',
        error: '#6e4b4b',
    };

    return theme === 'dark' ? darkThemeColors[type] : lightThemeColors[type];
};

return (
    <Toaster position='top-center'
        toastOptions={{
            duration: 6000,
            // This will dismiss all toasts before showing a new one
            onShow: () => toast.dismiss(),
            success: {
                style: {
                    background: getBackgroundColor('success'),
                    color: getBackgroundColor('textColor'),
                },
            },
            error: {
                style: {
                    background: getBackgroundColor('error'),
                    color: getBackgroundColor('textColor'),
                },
            },
        }}
    />
);

};
export default MyHotToaster;

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

3 participants