2023-08-25 19:09:50 +02:00
+++
2025-03-21 10:14:12 +01:00
categories = ['explanation', 'howto']
description = 'How to extend image effects'
options = ['imageEffects']
title = 'Image Effects'
2025-02-07 21:24:42 +01:00
weight = 4
2023-08-25 19:09:50 +02:00
+++
2024-10-11 22:40:10 +02:00
This page shows you, how to configure custom [image effects ](authoring/markdown#image-effects ) on top of existing ones.
2023-08-25 19:09:50 +02:00
2025-02-08 18:53:53 +01:00
This setting can also [be overridden by your front matter ](authoring/linking/imageeffects ).
2024-03-16 10:00:40 +01:00
2024-10-07 15:30:53 +02:00
If you don't configure anything in your `hugo.toml` , the image effects default to
2023-08-25 19:09:50 +02:00
2024-10-11 16:27:13 +02:00
## Default Values
2024-10-07 15:30:53 +02:00
{{< multiconfig > }}
2025-03-21 12:27:29 +01:00
imageEffects.border = false
imageEffects.dataurl = false
imageEffects.inlinecontent = false
imageEffects.lazy = true
imageEffects.lightbox = true
imageEffects.shadow = false
2024-03-02 11:04:52 +01:00
{{< / multiconfig > }}
2023-08-25 19:09:50 +02:00
2024-10-11 16:27:13 +02:00
## Configuration
{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} You can change these settings in your `hugo.toml` and add arbitrary custom effects as boolean values (like `bg-white` in the below snippet).
2023-08-25 19:09:50 +02:00
2025-03-21 12:27:29 +01:00
{{< multiconfig file = hugo section = params > }}
imageEffects.bg-white = true
imageEffects.border = true
imageEffects.lazy = false
2024-03-02 11:04:52 +01:00
{{< / multiconfig > }}
2023-08-25 19:09:50 +02:00
2024-10-07 15:30:53 +02:00
This would result in
2023-08-25 19:09:50 +02:00
2024-10-07 15:30:53 +02:00
{{< multiconfig > }}
2025-03-21 12:27:29 +01:00
imageEffects.bg-white = true
imageEffects.border = true
imageEffects.dataurl = false
imageEffects.inlinecontent = false
imageEffects.lazy = false
imageEffects.lightbox = true
imageEffects.shadow = false
2024-10-06 20:37:18 +02:00
{{< / multiconfig > }}
2023-08-25 19:09:50 +02:00
2024-10-07 15:30:53 +02:00
### Example
2024-10-11 16:27:13 +02:00
With this configuration in effect, the following URL
2024-10-07 22:18:49 +02:00
````markdown {title="Markdown"}
2024-10-07 15:30:53 +02:00

````
2024-10-11 16:27:13 +02:00
would result in
2024-10-07 15:30:53 +02:00
2024-10-07 22:18:49 +02:00
````html {title="HTML"}
2025-02-07 14:28:26 +01:00
< img src = "https://octodex.github.com/images/minion.png" loading = "lazy" alt = "Minion" class = "bg-white border lightbox" >
2024-10-07 15:30:53 +02:00
````
2024-10-11 16:27:13 +02:00
## Styling Effects
2025-02-07 14:28:26 +01:00
If the resulting effect value is `true` a class with the effect's name will be added.
2024-10-11 16:27:13 +02:00
Styles for default effects are contained in the theme. Add styles for your custom effects to `layouts/partials/content-header.html` .
2024-10-07 15:30:53 +02:00
2025-02-07 14:28:26 +01:00
For the above custom effect you could add the following style:
2024-10-07 15:30:53 +02:00
2024-10-07 22:18:49 +02:00
````html {title="layouts/partials/content-header.html"}
< style >
2024-10-07 15:30:53 +02:00
img.bg-white {
background-color: white;
}
2024-10-07 22:18:49 +02:00
< / style >
2024-10-07 15:30:53 +02:00
````