-
Notifications
You must be signed in to change notification settings - Fork 25.6k
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
Add overlay_filter param to hero headers #298
Conversation
The `overlay_filter` param lets you darken or otherwise filter the hero header picture to make the text content pop out more. You can use it by specifying the opacity (between 0 and 1) of a black overlay like so: ```yaml excerpt: "This post should display a **header with an overlay image**, if the theme supports it." header: overlay_image: unsplash-image-1.jpg overlay_filter: 0.5 # same as adding an opacity of 0.5 to a black background caption: "Photo credit: [**Unsplash**](https://unsplash.com)" cta_label: "More Info" cta_url: "https://unsplash.com" ``` Or if you want to do more fancy things, go full rgba: ```yaml excerpt: "This post should display a **header with an overlay image**, if the theme supports it." header: overlay_image: unsplash-image-1.jpg overlay_filter: rgba(255, 0, 0, 0.5) caption: "Photo credit: [**Unsplash**](https://unsplash.com)" cta_label: "More Info" cta_url: "https://unsplash.com" ```
<div class="page__hero{% if page.header.overlay_color or page.header.overlay_image %}--overlay{% endif %}" | ||
style="{% if page.header.overlay_color %}background-color: {{ page.header.overlay_color | default: 'transparent' }};{% endif %} {% if overlay_img_path %}background-image: url('{{ overlay_img_path }}');{% endif %}" | ||
style="{% if page.header.overlay_color %}background-color: {{ page.header.overlay_color | default: 'transparent' }};{% endif %} {% if overlay_img_path %}background-image: {% if overlay_filter %}linear-gradient({{overlay_filter}}, {{overlay_filter}}), {% endif %}url('{{ overlay_img_path }}');{% endif %}" |
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.
Could you add spaces around the variable names eg. {{overlay_filter}}
~> {{ overlay_filter }}
to stay consistent with how I reference them through out the rest of the theme?
Anything else? How do you handle documentation given it's in a different branch? |
Thanks and merged! On my todo list was to add an transparent black overlay by default, but your PR is much better as it offers more flexibility. Thanks again. |
No, thank you for an awesome project. |
Add Slender
The
overlay_filter
param lets you darken or otherwise filter the hero header picture to make the text content pop out more.You can use it by specifying the opacity (between 0 and 1) of a black overlay like so:
Or if you want to do more fancy things, go full rgba: