aboutsummaryrefslogtreecommitdiff
path: root/data.go
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-11-10 00:18:50 +0100
committerAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-11-10 00:18:50 +0100
commit8129d4f13d4c25874e48394fce8b3dccb123a92b (patch)
tree94753f4dde659852829d1d20ee29e3c7df617d1f /data.go
parentbbacda44f8cd1629d311ce0242fd01124fe4c876 (diff)
feat(image): custom background image
Diffstat (limited to 'data.go')
-rw-r--r--data.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/data.go b/data.go
index 7ac825b..6bf89af 100644
--- a/data.go
+++ b/data.go
@@ -1,6 +1,7 @@
package main
import (
+ "github.com/anhgelus/golatt"
"html/template"
"strconv"
)
@@ -11,6 +12,7 @@ type Data struct {
Person *Person `json:"person"`
Color *Color `json:"colors"`
Links []*Link `json:"links"`
+ Legal *Legal `json:"legal"`
}
type Person struct {
@@ -40,6 +42,11 @@ type Link struct {
TextColor string `json:"text_color"`
}
+type Legal struct {
+ LegalInformationLink string `json:"legal_information_link"`
+ ImagesSource []string `json:"images_source"`
+}
+
func (d *Data) GetBackground() template.CSS {
bg := d.Color.Background
css := "background: " + bg.Type + "-gradient("
@@ -52,6 +59,10 @@ func (d *Data) GetBackground() template.CSS {
return template.CSS(css[:len(css)-1] + ");")
}
+func (d *Data) GetBackgroundImage() template.CSS {
+ return template.CSS("background-image: url(" + golatt.GetStaticPath(d.Image) + ");")
+}
+
func (d *Data) GetTextColor() template.CSS {
return template.CSS("color: " + d.Color.Text + ";")
}