diff --git a/CHANGELOG.md b/CHANGELOG.md index 631f980144b1..2e183aa6a64c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - Update Indonesian localized UI text strings. [#2731](https://github.com/mmistakes/minimal-mistakes/pull/2731) - Update remote theme documentation. [#2734](https://github.com/mmistakes/minimal-mistakes/pull/2734) - Update allejo/jekyll-toc to v1.1.0, skip headings without an ID. [#2752](https://github.com/mmistakes/minimal-mistakes/pull/2752) +- Allow custom gradient for page header overlay. [#2806](https://github.com/mmistakes/minimal-mistakes/pull/2806) ## [4.21.0](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.21.0) diff --git a/_includes/page__hero.html b/_includes/page__hero.html index 3f55aaa60ac5..dd1c26fbf1fc 100644 --- a/_includes/page__hero.html +++ b/_includes/page__hero.html @@ -1,9 +1,13 @@ {% capture overlay_img_path %}{{ page.header.overlay_image | relative_url }}{% endcapture %} -{% if page.header.overlay_filter contains "rgba" %} +{% if page.header.overlay_filter contains "gradient" %} {% capture overlay_filter %}{{ page.header.overlay_filter }}{% endcapture %} +{% elsif page.header.overlay_filter contains "rgba" %} + {% capture overlay_filter %}{{ page.header.overlay_filter }}{% endcapture %} + {% capture overlay_filter %}linear-gradient({{ overlay_filter }}, {{ overlay_filter }}){% endcapture %} {% elsif page.header.overlay_filter %} {% capture overlay_filter %}rgba(0, 0, 0, {{ page.header.overlay_filter }}){% endcapture %} + {% capture overlay_filter %}linear-gradient({{ overlay_filter }}, {{ overlay_filter }}){% endcapture %} {% endif %} {% if page.header.image_description %} @@ -15,7 +19,7 @@ {% assign image_description = image_description | markdownify | strip_html | strip_newlines | escape_once %}
{% if page.header.overlay_color or page.header.overlay_image %}
diff --git a/docs/_docs/10-layouts.md b/docs/_docs/10-layouts.md index 22f72fd3bc94..50b13df13bc6 100644 --- a/docs/_docs/10-layouts.md +++ b/docs/_docs/10-layouts.md @@ -428,7 +428,7 @@ To overlay text on top of a header image you have a few more options: | Name | Description | Default | | ---- | ----------- | ------- | | **overlay_image** | Header image you'd like to overlay. Same rules as `header.image` from above. | | -| **overlay_filter** | Color/opacity to overlay on top of the header image eg: `0.5` or `rgba(255, 0, 0, 0.5)`. | +| **overlay_filter** | Color/opacity to overlay on top of the header image. Example: `0.5`, `rgba(255, 0, 0, 0.5)` or [`linear-gradient`][mdn-linear-gradient]. | | **show_overlay_excerpt** | Display excerpt in the overlay text | true | | **excerpt** | Auto-generated page excerpt is added to the overlay text or can be overridden. | | | **tagline** | Overrides page excerpt. Useful when header text needs to be different from excerpt in archive views. | | @@ -436,6 +436,8 @@ To overlay text on top of a header image you have a few more options: | **cta_label** | Deprecated, use `actions` instead. Call to action button text label. | `more_label` in UI Text data file | | **cta_url** | Deprecated, use `actions` instead. Call to action button URL. | | + [mdn-linear-gradient]: https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient() + With this YAML Front Matter: ```yaml @@ -477,7 +479,7 @@ header: url: "https://github.com" ``` -Or if you want to do more fancy things, go full rgba: +Or if you feel colorful, use full rgba: ![transparent red overlay]({{ "/assets/images/mm-header-overlay-red-filter.jpg" | relative_url }}) @@ -492,6 +494,21 @@ header: url: "https://github.com" ``` +Or if you want to do more fancy things, go all the way to [linear-gradient][mdn-linear-gradient]: + +![transparent custom overlay]({{ "/assets/images/mm-header-overlay-custom-filter.jpg" | relative_url }}) + +```yaml +excerpt: "This post should [...]" +header: + overlay_image: /assets/images/unsplash-image-1.jpg + overlay_filter: linear-gradient(rgba(255, 0, 0, 0.5), rgba(0, 255, 255, 0.5)) + caption: "Photo credit: [**Unsplash**](https://unsplash.com)" + actions: + - label: "Download" + url: "https://github.com" +``` + Multiple call to action button links can be assigned like this: ```yaml diff --git a/docs/_docs/18-history.md b/docs/_docs/18-history.md index f3b025bcc75c..d2da54436e6c 100644 --- a/docs/_docs/18-history.md +++ b/docs/_docs/18-history.md @@ -25,6 +25,7 @@ toc: false - Update Indonesian localized UI text strings. [#2731](https://github.com/mmistakes/minimal-mistakes/pull/2731)] - Update remote theme documentation. [#2734](https://github.com/mmistakes/minimal-mistakes/pull/2734) - Update allejo/jekyll-toc to v1.1.0, skip headings without an ID. [#2752](https://github.com/mmistakes/minimal-mistakes/pull/2752) +- Allow custom gradient for page header overlay. [#2806](https://github.com/mmistakes/minimal-mistakes/pull/2806) ## [4.21.0](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.21.0) diff --git a/docs/assets/images/mm-header-overlay-custom-filter.jpg b/docs/assets/images/mm-header-overlay-custom-filter.jpg new file mode 100644 index 000000000000..7f0cff974496 Binary files /dev/null and b/docs/assets/images/mm-header-overlay-custom-filter.jpg differ