Mercurial Hosting > linkmystyle
comparison src/theme.css.luan @ 0:8f4df159f06b
start public repo
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 11 Jul 2025 20:57:49 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8f4df159f06b |
---|---|
1 local Luan = require "luan:Luan.luan" | |
2 local error = Luan.error | |
3 local parse = Luan.parse or error() | |
4 local Io = require "luan:Io.luan" | |
5 local Http = require "luan:http/Http.luan" | |
6 local format_date = Http.format_date or error() | |
7 local User = require "site:/lib/User.luan" | |
8 local get_background_img_url = User.get_background_img_url or error() | |
9 | |
10 | |
11 return function() | |
12 local user = Http.request.parameters.user or error() | |
13 user = User.get_by_id(user) or error() | |
14 local data = user.theme_data or error() | |
15 data = parse(data) | |
16 local date = user.theme_date or error() | |
17 Http.response.headers["Last-Modified"] = format_date(date) | |
18 Io.stdout = Http.response.text_writer() | |
19 local font_url = data.font_url | |
20 if font_url ~= nil then | |
21 %> | |
22 @import "<%=font_url%>"; | |
23 | |
24 <% | |
25 end | |
26 local background_color = data.background_color | |
27 if background_color ~= nil then | |
28 %> | |
29 body[colored] { | |
30 background-color: <%=background_color%>; | |
31 } | |
32 <% | |
33 end | |
34 local background_img_url = get_background_img_url(data) | |
35 if background_img_url ~= nil then | |
36 %> | |
37 div[pub_background_img] { | |
38 z-index: -1; | |
39 position: fixed; | |
40 top: 0; | |
41 right: 0; | |
42 bottom: 0; | |
43 left: 0; | |
44 background-size: cover; | |
45 background-repeat: no-repeat; | |
46 background-position: center; | |
47 background-image: url(<%=background_img_url%>); | |
48 } | |
49 <% | |
50 end | |
51 local link_background_color = data.link_background_color | |
52 if link_background_color ~= nil then | |
53 %> | |
54 a[link], | |
55 span[select] select { | |
56 background-color: <%=link_background_color%>; | |
57 } | |
58 <% | |
59 end | |
60 local link_hover_background_color = data.link_hover_background_color | |
61 if link_hover_background_color ~= nil then | |
62 %> | |
63 a[link]:hover, | |
64 span[select] select:hover { | |
65 background-color: <%=link_hover_background_color%>; | |
66 } | |
67 <% | |
68 end | |
69 local link_text_color = data.link_text_color | |
70 if link_text_color ~= nil then | |
71 %> | |
72 a[link], | |
73 span[select] { | |
74 color: <%=link_text_color%>; | |
75 } | |
76 <% | |
77 end | |
78 local title_color = data.title_color | |
79 if title_color ~= nil then | |
80 %> | |
81 html[main] h1 { | |
82 color: <%=title_color%>; | |
83 } | |
84 html[main] div[home] a { | |
85 color: <%=title_color%>; | |
86 } | |
87 <% | |
88 end | |
89 local bio_color = data.bio_color | |
90 if bio_color ~= nil then | |
91 %> | |
92 html[main] div[bio] { | |
93 color: <%=bio_color%>; | |
94 } | |
95 <% | |
96 end | |
97 if data.icon_color == "white" then | |
98 %> | |
99 html[pic] div[hashtags] a, | |
100 html[pic] div[back] img, | |
101 html[main] div[icons] img { | |
102 filter: invert(100%); | |
103 } | |
104 <% | |
105 end | |
106 local link_border_radius = data.link_border_radius | |
107 if link_border_radius ~= nil then | |
108 %> | |
109 a[link] { | |
110 border-radius: <%=link_border_radius%>; | |
111 } | |
112 <% | |
113 end | |
114 local link_border_color = data.link_border_color | |
115 if link_border_color ~= nil then | |
116 %> | |
117 a[link] { | |
118 border: 2px solid <%=link_border_color%>; | |
119 } | |
120 <% | |
121 end | |
122 local link_shadow = data.link_shadow | |
123 if link_shadow ~= nil then | |
124 %> | |
125 a[link] { | |
126 box-shadow: <%=link_shadow%> <%= data.link_shadow_color or "" %>; | |
127 } | |
128 <% | |
129 end | |
130 local font = data.font | |
131 if font ~= nil then | |
132 %> | |
133 [pub_content] { | |
134 font-family: <%=font%>; | |
135 } | |
136 <% | |
137 end | |
138 end |