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

Allow not defaulting MjmlText color #1955

Closed
osdiab opened this issue Jun 23, 2020 · 4 comments
Closed

Allow not defaulting MjmlText color #1955

osdiab opened this issue Jun 23, 2020 · 4 comments

Comments

@osdiab
Copy link

osdiab commented Jun 23, 2020

Is your feature request related to a problem? Please describe.
I have two "themes" in my emails, which I want to toggle on and off based on the presence of a CSS class - a dark and a light theme.

In the dark theme, all text should be light. In the light theme, all the text should be dark.

But MjmlText defaults the color CSS rule to #000000. Unfortunately since it uses the color type from mjml-core which uses regexes to detect hex codes and such, it also disables the potential for passing inherit as the value. so, I cant disable this functionality.

Describe the solution you'd like
Either a) allow passing inherit as the value to MjmlText assuming that's well supported or b) allow disabling the setting of color altogether, neither of which would be backwards-incompatible

@iRyusa
Copy link
Member

iRyusa commented Jun 23, 2020 via email

@osdiab
Copy link
Author

osdiab commented Jun 24, 2020

I'm preferring to use strict mode as part of my testing, I don't want to have to give up validation of my entire project just so that I can deal with one missing part of this library. I'd be happy to add a PR, but which of my suggestions if either would you like?

@iRyusa
Copy link
Member

iRyusa commented Jun 24, 2020

Then you can open a PR here : https://github.com/mjmlio/mjml/blob/master/packages/mjml-core/src/types/helpers/colors.js adding inherit.

mj-all doesn't validate the attribute type, so if you pass color on it it won't be listed as an error for now.

For compatibility issue you should still use inline styles over class to maximize support.

@iRyusa
Copy link
Member

iRyusa commented Jul 22, 2021

inherit is now supported for every color attribute since 4.10.2 !

@iRyusa iRyusa closed this as completed Jul 22, 2021
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