Skip to content

Commit 7e0a739

Browse files
fix: styles and imports adjustment
- Fixed import order (verified by linters) - Linter checks completed, all errors fixed - Updated syntax highlighting for better readability
1 parent 7dbaa3e commit 7e0a739

File tree

6 files changed

+156
-157
lines changed

6 files changed

+156
-157
lines changed

modules/avatar/avatar.go

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import (
1111
"image/color"
1212
"image/png"
1313

14-
"golang.org/x/image/draw"
14+
_ "image/gif" // for image format registration
15+
_ "image/jpeg" // for image format registration
1516

1617
"code.gitea.io/gitea/modules/avatar/identicon"
1718
"code.gitea.io/gitea/modules/setting"
1819

19-
_ "image/gif" // for processing gif images
20-
_ "image/jpeg" // for processing jpeg images
20+
"golang.org/x/image/draw"
2121

22-
_ "golang.org/x/image/webp" // for processing webp images
22+
_ "golang.org/x/image/webp" // for image format registration
2323
)
2424

2525
// DefaultAvatarSize is the target CSS pixel size for avatar generation. It is
@@ -65,11 +65,14 @@ func processAvatarImage(data []byte, maxOriginSize int64) ([]byte, error) {
6565
return nil, fmt.Errorf("image height is too large: %d > %d", imgCfg.Height, setting.Avatar.MaxHeight)
6666
}
6767

68-
// If the origin is small enough, just use it, then APNG could be supported,
69-
// otherwise, if the image is processed later, APNG loses animation.
70-
// And one more thing, webp is not fully supported, for animated webp, image.DecodeConfig works but Decode fails.
71-
// So for animated webp, if the uploaded file is smaller than maxOriginSize, it will be used, if it's larger, there will be an error.
72-
if len(data) < int(maxOriginSize) {
68+
// Check max origin size if specified (for animated images)
69+
if maxOriginSize > 0 && len(data) < int(maxOriginSize) {
70+
return data, nil
71+
}
72+
73+
// If the origin is small enough (both dimensions <= target size), just use it
74+
targetSize := DefaultAvatarSize * setting.Avatar.RenderedSizeFactor
75+
if imgCfg.Width <= targetSize && imgCfg.Height <= targetSize {
7376
return data, nil
7477
}
7578

@@ -81,7 +84,9 @@ func processAvatarImage(data []byte, maxOriginSize int64) ([]byte, error) {
8184
// try to crop and resize the origin image if necessary
8285
img = cropSquare(img)
8386

84-
targetSize := DefaultAvatarSize * setting.Avatar.RenderedSizeFactor
87+
if setting.Avatar.RenderedSizeFactor > 0 {
88+
targetSize = DefaultAvatarSize * setting.Avatar.RenderedSizeFactor
89+
}
8590
img = scale(img, targetSize, targetSize, draw.BiLinear)
8691

8792
// Create a new RGBA image to preserve transparency

web_src/css/chroma/dark.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
.chroma .nn, /* Пространства имён */
77
.chroma .no, /* Константы типов */
88
.chroma .n, /* Общие имена (пользовательские типы) */
9-
.chroma .n:not(.na):not(.nb):not(.ne):not(.nf):not(.ni):not(.nl):not(.nv):not(.nx), Пользовательские типы без других модификаторов
10-
.chroma .n:not([class*="-"]), Имена без дополнительных классов
11-
.chroma .n[class*="type"], Классы, связанные с типами
129
.chroma .n[class*="Type"] {
1310
/* Классы с Type в названии */
1411
color: #009999; /* Светло-голубой для всех типов */

web_src/css/features/gitgraph.css

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -89,225 +89,225 @@
8989
}
9090

9191
#git-graph-container:not(.monochrome)
92-
#rel-container
93-
.flow-group.flow-color-16-1 {
92+
#rel-container
93+
.flow-group.flow-color-16-1 {
9494
stroke: #4db392;
9595
fill: #4db392;
9696
}
9797

9898
#git-graph-container:not(.monochrome)
99-
#rel-container
100-
.flow-group.flow-color-16-2 {
99+
#rel-container
100+
.flow-group.flow-color-16-2 {
101101
stroke: #ce4751;
102102
fill: #ce4751;
103103
}
104104

105105
#git-graph-container:not(.monochrome)
106-
#rel-container
107-
.flow-group.flow-color-16-3 {
106+
#rel-container
107+
.flow-group.flow-color-16-3 {
108108
stroke: #8f9121;
109109
fill: #8f9121;
110110
}
111111

112112
#git-graph-container:not(.monochrome)
113-
#rel-container
114-
.flow-group.flow-color-16-4 {
113+
#rel-container
114+
.flow-group.flow-color-16-4 {
115115
stroke: #ac32a6;
116116
fill: #ac32a6;
117117
}
118118

119119
#git-graph-container:not(.monochrome)
120-
#rel-container
121-
.flow-group.flow-color-16-5 {
120+
#rel-container
121+
.flow-group.flow-color-16-5 {
122122
stroke: #7445e9;
123123
fill: #7445e9;
124124
}
125125

126126
#git-graph-container:not(.monochrome)
127-
#rel-container
128-
.flow-group.flow-color-16-6 {
127+
#rel-container
128+
.flow-group.flow-color-16-6 {
129129
stroke: #c67d28;
130130
fill: #c67d28;
131131
}
132132

133133
#git-graph-container:not(.monochrome)
134-
#rel-container
135-
.flow-group.flow-color-16-7 {
134+
#rel-container
135+
.flow-group.flow-color-16-7 {
136136
stroke: #499a37;
137137
fill: #499a37;
138138
}
139139

140140
#git-graph-container:not(.monochrome)
141-
#rel-container
142-
.flow-group.flow-color-16-8 {
141+
#rel-container
142+
.flow-group.flow-color-16-8 {
143143
stroke: #aa4d30;
144144
fill: #aa4d30;
145145
}
146146

147147
#git-graph-container:not(.monochrome)
148-
#rel-container
149-
.flow-group.flow-color-16-9 {
148+
#rel-container
149+
.flow-group.flow-color-16-9 {
150150
stroke: #2a6f84;
151151
fill: #2a6f84;
152152
}
153153

154154
#git-graph-container:not(.monochrome)
155-
#rel-container
156-
.flow-group.flow-color-16-10 {
155+
#rel-container
156+
.flow-group.flow-color-16-10 {
157157
stroke: #c45327;
158158
fill: #c45327;
159159
}
160160

161161
#git-graph-container:not(.monochrome)
162-
#rel-container
163-
.flow-group.flow-color-16-11 {
162+
#rel-container
163+
.flow-group.flow-color-16-11 {
164164
stroke: #3d965c;
165165
fill: #3d965c;
166166
}
167167

168168
#git-graph-container:not(.monochrome)
169-
#rel-container
170-
.flow-group.flow-color-16-12 {
169+
#rel-container
170+
.flow-group.flow-color-16-12 {
171171
stroke: #792a93;
172172
fill: #792a93;
173173
}
174174

175175
#git-graph-container:not(.monochrome)
176-
#rel-container
177-
.flow-group.flow-color-16-13 {
176+
#rel-container
177+
.flow-group.flow-color-16-13 {
178178
stroke: #439d73;
179179
fill: #439d73;
180180
}
181181

182182
#git-graph-container:not(.monochrome)
183-
#rel-container
184-
.flow-group.flow-color-16-14 {
183+
#rel-container
184+
.flow-group.flow-color-16-14 {
185185
stroke: #103aad;
186186
fill: #103aad;
187187
}
188188

189189
#git-graph-container:not(.monochrome)
190-
#rel-container
191-
.flow-group.flow-color-16-15 {
190+
#rel-container
191+
.flow-group.flow-color-16-15 {
192192
stroke: #982e85;
193193
fill: #982e85;
194194
}
195195

196196
#git-graph-container:not(.monochrome)
197-
#rel-container
198-
.flow-group.flow-color-16-0 {
197+
#rel-container
198+
.flow-group.flow-color-16-0 {
199199
stroke: #7db233;
200200
fill: #7db233;
201201
}
202202

203203
#git-graph-container:not(.monochrome)
204-
#rel-container
205-
.flow-group.highlight.flow-color-16-1 {
204+
#rel-container
205+
.flow-group.highlight.flow-color-16-1 {
206206
stroke: #5ac144;
207207
fill: #5ac144;
208208
}
209209

210210
#git-graph-container:not(.monochrome)
211-
#rel-container
212-
.flow-group.highlight.flow-color-16-2 {
211+
#rel-container
212+
.flow-group.highlight.flow-color-16-2 {
213213
stroke: #ed5a8b;
214214
fill: #ed5a8b;
215215
}
216216

217217
#git-graph-container:not(.monochrome)
218-
#rel-container
219-
.flow-group.highlight.flow-color-16-3 {
218+
#rel-container
219+
.flow-group.highlight.flow-color-16-3 {
220220
stroke: #ced049;
221221
fill: #ced048;
222222
}
223223

224224
#git-graph-container:not(.monochrome)
225-
#rel-container
226-
.flow-group.highlight.flow-color-16-4 {
225+
#rel-container
226+
.flow-group.highlight.flow-color-16-4 {
227227
stroke: #db61d7;
228228
fill: #db62d6;
229229
}
230230

231231
#git-graph-container:not(.monochrome)
232-
#rel-container
233-
.flow-group.highlight.flow-color-16-5 {
232+
#rel-container
233+
.flow-group.highlight.flow-color-16-5 {
234234
stroke: #8455f9;
235235
fill: #8455f9;
236236
}
237237

238238
#git-graph-container:not(.monochrome)
239-
#rel-container
240-
.flow-group.highlight.flow-color-16-6 {
239+
#rel-container
240+
.flow-group.highlight.flow-color-16-6 {
241241
stroke: #e6a151;
242242
fill: #e6a151;
243243
}
244244

245245
#git-graph-container:not(.monochrome)
246-
#rel-container
247-
.flow-group.highlight.flow-color-16-7 {
246+
#rel-container
247+
.flow-group.highlight.flow-color-16-7 {
248248
stroke: #44daaa;
249249
fill: #44daaa;
250250
}
251251

252252
#git-graph-container:not(.monochrome)
253-
#rel-container
254-
.flow-group.highlight.flow-color-16-8 {
253+
#rel-container
254+
.flow-group.highlight.flow-color-16-8 {
255255
stroke: #dd7a5c;
256256
fill: #dd7a5c;
257257
}
258258

259259
#git-graph-container:not(.monochrome)
260-
#rel-container
261-
.flow-group.highlight.flow-color-16-9 {
260+
#rel-container
261+
.flow-group.highlight.flow-color-16-9 {
262262
stroke: #38859c;
263263
fill: #38859c;
264264
}
265265

266266
#git-graph-container:not(.monochrome)
267-
#rel-container
268-
.flow-group.highlight.flow-color-16-10 {
267+
#rel-container
268+
.flow-group.highlight.flow-color-16-10 {
269269
stroke: #d95520;
270270
fill: #d95520;
271271
}
272272

273273
#git-graph-container:not(.monochrome)
274-
#rel-container
275-
.flow-group.highlight.flow-color-16-11 {
274+
#rel-container
275+
.flow-group.highlight.flow-color-16-11 {
276276
stroke: #42ae68;
277277
fill: #42ae68;
278278
}
279279

280280
#git-graph-container:not(.monochrome)
281-
#rel-container
282-
.flow-group.highlight.flow-color-16-12 {
281+
#rel-container
282+
.flow-group.highlight.flow-color-16-12 {
283283
stroke: #9126b5;
284284
fill: #9126b5;
285285
}
286286

287287
#git-graph-container:not(.monochrome)
288-
#rel-container
289-
.flow-group.highlight.flow-color-16-13 {
288+
#rel-container
289+
.flow-group.highlight.flow-color-16-13 {
290290
stroke: #4ab080;
291291
fill: #4ab080;
292292
}
293293

294294
#git-graph-container:not(.monochrome)
295-
#rel-container
296-
.flow-group.highlight.flow-color-16-14 {
295+
#rel-container
296+
.flow-group.highlight.flow-color-16-14 {
297297
stroke: #284fb8;
298298
fill: #284fb8;
299299
}
300300

301301
#git-graph-container:not(.monochrome)
302-
#rel-container
303-
.flow-group.highlight.flow-color-16-15 {
302+
#rel-container
303+
.flow-group.highlight.flow-color-16-15 {
304304
stroke: #971c80;
305305
fill: #971c80;
306306
}
307307

308308
#git-graph-container:not(.monochrome)
309-
#rel-container
310-
.flow-group.highlight.flow-color-16-0 {
309+
#rel-container
310+
.flow-group.highlight.flow-color-16-0 {
311311
stroke: #87ca28;
312312
fill: #87ca28;
313313
}

web_src/css/modules/button.css

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
border: 1px solid var(--color-light-border);
1818
color: var(--color-text);
1919
white-space: nowrap;
20+
padding: 0.57em 1.43em;
21+
min-height: 38px;
2022
}
2123

2224
.ui.button:focus-visible {
@@ -99,11 +101,6 @@
99101
}
100102

101103
/* reference sizes (not exactly at the moment): normal: padding-x=21, height=38 ; compact: padding-x=15, height=32 */
102-
.ui.button {
103-
/* stylelint-disable-line no-duplicate-selectors */
104-
min-height: 38px;
105-
padding: 0.57em /* around 8px */ 1.43em /* around 20px */;
106-
}
107104
.ui.compact.buttons .button,
108105
.ui.compact.button {
109106
padding: 0.42em /* around 8px */ 1.07em /* around 15px */;

0 commit comments

Comments
 (0)