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

Default color 'CurrentColor' #32

Closed
lenzi-erickson opened this issue May 9, 2018 · 7 comments
Closed

Default color 'CurrentColor' #32

lenzi-erickson opened this issue May 9, 2018 · 7 comments

Comments

@lenzi-erickson
Copy link
Contributor

Wouldn't it make more sense if the default color was 'CurrentColor' instead of black? That way it just defaults to the text color unless you pass a specific color.

@levrik
Copy link
Owner

levrik commented May 9, 2018

Sadly that's only possible with CSS and would make this library more complex.
There are simple examples how to achieve that in the README though.

@levrik levrik closed this as completed May 9, 2018
@lenzi-erickson
Copy link
Contributor Author

I guess I don't see the need to add css. Just change
{ color = '#000', size = 24, children, ...props }
to
{ color = 'currentColor, size = 24, children, ...props }

That's what I was hoping for. I haven't tested it, but I think that should do the trick.

@lenzi-erickson
Copy link
Contributor Author

And you can do it with css like this

:global {
  .mdi-icon {
    fill: currentColor;
  }
}

but then it overrides the color prop and you can no longer pass prop as a color. I was hoping to be able to have it default to the currentColor but still be able to pass a color prop to the icon.

@levrik
Copy link
Owner

levrik commented May 9, 2018

As I said, it's only possible with CSS.
The color prop just passes its value down to the fill prop of the SVG path. currentColor isn't supported there.
The note in the README is all I can do without adding CSS stuff to the library itself.

@lenzi-erickson
Copy link
Contributor Author

I just don't get why currentColor wouldn't be supported in fill. I tested it locally and it seems to work great. I'll open a pull request so you can look at it. Thanks! :)

@levrik
Copy link
Owner

levrik commented May 9, 2018

Reopening this, see #33

@levrik
Copy link
Owner

levrik commented Jun 23, 2018

Released in 4.0.0

@levrik levrik closed this as completed Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants