-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Contrast colors added to theme-colors #30044
Contrast colors added to theme-colors #30044
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only change is the background of the yellow text: https://deploy-preview-30044--twbs-bootstrap.netlify.com/docs/4.3/utilities/colors/#color (but this is an improvement)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I'd change
contrast_color
tocontrast-color
- I wouldn't add redundant classes; we only need this in 2 cases otherwise it doesn't have any effect
@memic84 you can use something like (untested) |
I renamed the class to The cards also require the white color to be set, which means that we have to set all contrast-colors. Also this will add more logic, and the logic will be in two places templates and theme-colors, where with the redundant classes it's only in theme-colors.yml. |
Yeah, but the end users don't need the extra classes. Anyway, I'll have a look later myself and see how this can be simplified. |
I agree, that the end users don't need the extra classes. My only problem is that, for example the contrast-color of primary, is sometimes needed and sometimes not. I will check the Hugo docs, for a solution... |
Maybe we should go with your original patch and just mention that the extra classes are not needed? But then if we are going to do that, we might as well just go the BTW |
d5aa7ac
to
5a1f0ff
Compare
This is what I suggested in case you want to play with it But we need to think how to proceed before any further changes. |
Also, found a bug with Hugo; when I change the data file, the changes are not reflected unless I restart Hugo. I will try to report it. |
With this it means, that the contrast color will be used if there's one defined in the theme-colors.yml? It seems like a solid solution, and that we create the exception in templates where needed, ex. cards with |
Yeah, I mean, if we are going to edit the content files to say that the extra classes are only needed for our examples, we might as well go with this solution since we will need to edit the files anyway. Another solution would be to try to abstract the inline shortcode's logic into a common shortcode where we will pass HTML etc. I haven't tried this so I don't know if it's worth it, but it might be simpler to have the logic in one place, assuming it works. |
This works: I'll push soon... |
There might be some inconsistencies in hugo templates with coding style. I'll fix this soon, when the proposed fix is ok. |
@XhmikosR Have you checked the changes? Let me know is this is OK now? |
FYI this'll have conflicts with #30468 : if we ever merge this one, simply drop my own changes in |
LGTM. @XhmikosR, anything else to update? |
Don't merge this yet, I haven't cleaned it up |
What's the cleanup left here @XhmikosR? |
d1ffa50
to
6e96f0a
Compare
a2ac5da
to
cfc457b
Compare
@mdo @ffoodd please have another look. I rebased the branch and adapted it to the recent changes. One way would be to have light/dark in all colors, or the other would be what we currently have by specifying only the exceptions. Regardless, needs another pair of eyes since I didn't test it thoroughly and it's been a long time since the PR was made :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, very elegant (and efficient!)
And specifying the exceptions seems better to me, since this is what we need this for. MAkes it much easier to spot colours with specific requirements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #29361
text-{{ .contrast_color }}
Preview: