Skip to content

Commit ad7eb1e

Browse files
committed
更换首页头像照片和首页主题配色
1 parent 4b01119 commit ad7eb1e

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/assets/home.png

2.25 MB
Loading

src/components/home/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,9 @@ export function calculateSiteAge(startDate: string): string {
3434
* Get default highlight color using theme primary color
3535
*/
3636
export function getHighlightColor(): string {
37-
return 'hsl(var(--primary) / var(--un-text-opacity, 1))'
37+
return '#f6eac5'
38+
// 之前的代码使用 hsl(var(--primary) / var(--un-text-opacity, 1))
39+
// 这是使用 CSS 变量获取主题主色,并通过除法运算控制透明度
40+
// var(--un-text-opacity, 1) 是 UnoCSS 的透明度变量,默认值为 1(完全不透明)
41+
// 除法运算用于将 HSL 颜色值与透明度值结合,实现颜色透明度的动态控制
3842
}

src/pages/index.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import PageLayout from '@/layouts/BaseLayout.astro'
66
import { getBlogCollection } from 'astro-pure/server'
77
import { getCurrentReading, getLatestPosts, getTotalWords } from '@/components/shelf/utils'
88
import { calculateSiteAge, getHighlightColor } from '@/components/home/utils'
9-
import avatarImage from '@/assets/avatar_2.png'
9+
import avatarImage from '@/assets/home.png'
1010
import config from '@/site-config'
1111
1212
const MAX_POSTS = 6
@@ -33,9 +33,9 @@ const highlightColor = getHighlightColor()
3333
{/* 左侧:头像 - 大尺寸 */}
3434
<div class='flex justify-center md:justify-start'>
3535
<div
36-
class='w-32 h-32 md:w-48 md:h-48 lg:w-56 lg:h-56 border border-border overflow-hidden bg-card rounded-lg shadow-lg'
36+
class='w-32 h-32 md:w-48 md:h-48 lg:w-56 lg:h-56 overflow-hidden rounded-lg'
3737
>
38-
<Image src={avatarImage} alt='Avatar' class='w-full h-full object-cover block' />
38+
<Image src={avatarImage} alt='Avatar' class='w-full h-full object-contain block' />
3939
</div>
4040
</div>
4141

0 commit comments

Comments
 (0)