Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I import "white" color from Material UI colors?

I need to convert a Material UI icon to white because background is another color.

I am importing white from their core colors library:

import { white } from '@material-ui/core/colors';

So I can do:

style={{ color: white }}

However, I am getting an error message:

./src/components/footer.js
Attempted import error: 'white' is not exported from '@material-ui/core/colors'.

I cannot see what I am doing wrong based on their docs. I have throughly researched why I am getting this error but couldn't find solution.

like image 765
Pere Avatar asked Dec 17 '22 13:12

Pere


1 Answers

Check available color palette from MaterialUI here

White is not available.

But you can use 'white' as string, as CSS has 'white' as value

style={{ color: 'white' }}

A complete list of colors supported by CSS can be found here

like image 189
Sabbin Avatar answered Jan 21 '23 23:01

Sabbin