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

Make sure captions can inherit text colours #1775

Merged
merged 1 commit into from
Apr 21, 2022

Conversation

laurelfulford
Copy link
Contributor

All Submissions:

Changes proposed in this Pull Request:

You can currently use the inline colour options to change the caption text colour, but because you can't see/select the credit in the editor, you can't change its colour using this approach.

This fix isn't perfect, it just provides a work around -- it adds styles so if you wrap the image in a group block with a text colour set, the caption, credit and link will pick it up. It's a small thing, but helps make sure the text can be made legible against dark backgrounds.

When I originally wrote the issue I had it in my head that we could somehow use the mark tag that's added with inline colours to also change the credit -- while this could work for any of the theme defined colours (we could use mark.has-primary-color + .image-credit) , it won't work for custom colours. They have a class we can target (mark.has-text-color + .image-credit), but no way to "tell" what the colour should be -- I figured it "kind of" working like that would be confusing, but I'm open to feedback about that!

Closes #1220.

How to test the changes in this Pull Request:

  1. Add an image block with caption and a credit, and a gallery block with per-image captions and credit, and a block level caption (this is to make sure we don't mess with the white-text-on-dark-background that's used over the images).
  2. Wrap in a group block and assign it a text colour.
  3. View in the editor and front-end; note that the captions remain grey (or white, in the gallery block's case!):

image

image

  1. Apply the PR and run npm run build.
  2. Confirm that the captions against the white background pick up the group block colour in the editor and on the front end, but that the ones overlaid on images in the gallery are still white:

image

image

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@laurelfulford laurelfulford added the [Status] Needs Review The issue or pull request needs to be reviewed label Apr 20, 2022
@laurelfulford laurelfulford requested a review from a team as a code owner April 20, 2022 18:13
@laurelfulford laurelfulford added the Smaller PR This PR is smaller and quick to test. label Apr 20, 2022
@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Apr 21, 2022
@laurelfulford
Copy link
Contributor Author

Thanks Adam!

@laurelfulford laurelfulford merged commit 302b2e3 into master Apr 21, 2022
@laurelfulford laurelfulford deleted the fix/1220-caption-colour-inherit branch April 21, 2022 14:08
matticbot pushed a commit that referenced this pull request May 2, 2022
# [1.58.0-alpha.1](v1.57.2...v1.58.0-alpha.1) (2022-05-02)

### Bug Fixes

* correct margin issue in editor with floated images ([#1781](#1781)) ([cf4e008](cf4e008))
* make sure captions and credits inherit colours ([#1775](#1775)) ([302b2e3](302b2e3))
* make sure links remain white in the carousel block ([#1778](#1778)) ([88f20e9](88f20e9))
* remove unneeded featured image content option ([#1776](#1776)) ([1afddcf](1afddcf))

### Features

* add custom style to subscribe patterns ([#1760](#1760)) ([83a836e](83a836e))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.58.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request May 3, 2022
# [1.58.0](v1.57.2...v1.58.0) (2022-05-03)

### Bug Fixes

* correct margin issue in editor with floated images ([#1781](#1781)) ([cf4e008](cf4e008))
* make sure captions and credits inherit colours ([#1775](#1775)) ([302b2e3](302b2e3))
* make sure links remain white in the carousel block ([#1778](#1778)) ([88f20e9](88f20e9))
* remove unneeded featured image content option ([#1776](#1776)) ([1afddcf](1afddcf))

### Features

* add custom style to subscribe patterns ([#1760](#1760)) ([83a836e](83a836e))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.58.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @alpha released Smaller PR This PR is smaller and quick to test. [Status] Approved The pull request has been reviewed and is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Photo Credit: can't change colour
3 participants