refactor: update theme configuration and background styles

This commit is contained in:
radishzzz 2025-01-19 23:18:12 +00:00
parent 8eb0876c01
commit d148649454
9 changed files with 129 additions and 4214 deletions

View file

@ -4,7 +4,6 @@ import mdx from '@astrojs/mdx'
import partytown from '@astrojs/partytown' import partytown from '@astrojs/partytown'
import sitemap from '@astrojs/sitemap' import sitemap from '@astrojs/sitemap'
import { transformerCopyButton } from '@rehype-pretty/transformers' import { transformerCopyButton } from '@rehype-pretty/transformers'
import swup from '@swup/astro'
import compress from 'astro-compress' import compress from 'astro-compress'
import robotsTxt from 'astro-robots-txt' import robotsTxt from 'astro-robots-txt'
import { defineConfig } from 'astro/config' import { defineConfig } from 'astro/config'
@ -61,16 +60,6 @@ export default defineConfig({
sitemap: true, sitemap: true,
}), }),
compress(), compress(),
swup({
theme: false,
animationClass: 'transition-swup-',
cache: true,
preload: true,
accessibility: true,
smoothScrolling: true,
updateHead: true,
updateBodyClass: true,
}),
], ],
markdown: { markdown: {
remarkPlugins: [ remarkPlugins: [

View file

@ -1,5 +1,5 @@
{ {
"name": "astro-theme-retyprset", "name": "astro-theme-retypeset",
"type": "module", "type": "module",
"version": "0.0.1", "version": "0.0.1",
"scripts": { "scripts": {
@ -20,7 +20,6 @@
"@astrojs/rss": "^4.0.11", "@astrojs/rss": "^4.0.11",
"@astrojs/sitemap": "^3.2.1", "@astrojs/sitemap": "^3.2.1",
"@rehype-pretty/transformers": "^0.13.2", "@rehype-pretty/transformers": "^0.13.2",
"@swup/astro": "^1.5.0",
"@unocss/reset": "^65.4.2", "@unocss/reset": "^65.4.2",
"astro": "^5.1.7", "astro": "^5.1.7",
"astro-compress": "^2.3.6", "astro-compress": "^2.3.6",

4278
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -9,7 +9,7 @@ interface Props {
const { postTitle, postDescription, postImage } = Astro.props const { postTitle, postDescription, postImage } = Astro.props
const { title, subtitle, description, author, url, favicon } = themeConfig.site const { title, subtitle, description, author, url, favicon } = themeConfig.site
const { light: { backgroundStart: lightMode }, dark: { backgroundStart: darkMode } } = themeConfig.color const { light: { backgroundTop: lightMode }, dark: { backgroundTop: darkMode } } = themeConfig.color
const { locale, moreLocale } = themeConfig.global const { locale, moreLocale } = themeConfig.global
const { verification = {}, twitterID = '', facebookID = '', facebookLink = '', googleAnalyticsID = '', umamiAnalyticsID = '', siteScreenshot = '' } = themeConfig.seo ?? {} const { verification = {}, twitterID = '', facebookID = '', facebookLink = '', googleAnalyticsID = '', umamiAnalyticsID = '', siteScreenshot = '' } = themeConfig.seo ?? {}
const { google = '', bing = '', yandex = '', baidu = '' } = verification const { google = '', bing = '', yandex = '', baidu = '' } = verification

View file

@ -16,13 +16,13 @@ export const themeConfig: ThemeConfig = {
color: { color: {
mode: 'light', mode: 'light',
light: { light: {
primary: '#232323', text: '#232323',
backgroundStart: '#ffffff', backgroundTop: '#f8f8f8',
backgroundEnd: '#ffeeee', backgroundEnd: '#FDE9EB',
}, },
dark: { dark: {
primary: '#000000', text: '#000000',
backgroundStart: '#ffffff', backgroundTop: '#ffffff',
backgroundEnd: '#000000', backgroundEnd: '#000000',
}, },
}, },
@ -31,9 +31,8 @@ export const themeConfig: ThemeConfig = {
// GLOBAL SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START // GLOBAL SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
global: { global: {
locale: 'zh', // zh, zh-tw, ja, en, es, ru, default locale setting locale: 'zh', // zh, zh-tw, ja, en, es, ru, default locale setting
moreLocale: ['zh-tw', 'ja', 'en', 'es', 'ru'], // ['zh-tw', 'ja', 'en', 'es', 'ru'] not fill in the default locale code again moreLocale: ['zh-tw', 'ja', 'en', 'es', 'ru'], // ['zh', 'zh-tw', 'ja', 'en', 'es', 'ru'] NOT fill in the default locale code again
font: 'sans', // sans, serif, choose the font style for posts font: 'sans', // sans, serif, italic, choose the font style for posts
toc: true, // true, false, whether to enable table of contents in posts
}, },
// GLOBAL SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END // GLOBAL SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END

View file

@ -1,9 +1,12 @@
--- ---
import Head from '@/components/Head.astro' import Head from '@/components/Head.astro'
import themeConfig from '@/config'
import '@/styles/global.css' import '@/styles/global.css'
const fontStyle = `font-${themeConfig.global.font}`
--- ---
<html lang={Astro.currentLocale || 'en-US'}> <html lang={Astro.currentLocale || 'en-US'} class={fontStyle}>
<head> <head>
<Head /> <Head />
</head> </head>

View file

@ -1,13 +1,13 @@
:root { :root {
--uno-colors-primary: theme('colors.primary'); --uno-colors-text: theme('colors.text');
--uno-colors-backgroundStart: theme('colors.backgroundStart'); --uno-colors-backgroundTop: theme('colors.backgroundTop');
--uno-colors-backgroundEnd: theme('colors.backgroundEnd'); --uno-colors-backgroundEnd: theme('colors.backgroundEnd');
} }
html { html {
--at-apply: 'min-h-full font-sans text-[62.5%] bg-gradient-to-b from-backgroundStart to-backgroundEnd c-primary antialiased scroll-smooth'; --at-apply: 'antialiased scroll-smooth text-62.5%';
} }
body { body {
--at-apply: 'min-h-screen text-[1.6rem] m-0'; --at-apply: 'min-h-screen min-h-dvh bg-gradient-to-b from-backgroundTop to-backgroundEnd bg-fixed overscroll-none text-1.6rem c-text';
} }
h1, h2, h3 { h1, h2, h3 {
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
@ -30,6 +30,6 @@ h5 {
h6 { h6 {
--at-apply: 'text-[1.6rem]'; --at-apply: 'text-[1.6rem]';
} }
:where(p) { /* :where(p) {
--at-apply: 'text-primary/85'; --at-apply: 'text-text/85';
} } */

View file

@ -14,13 +14,13 @@ export interface ThemeConfig {
color: { color: {
mode: 'light' | 'dark' mode: 'light' | 'dark'
light: { light: {
primary: string text: string
backgroundStart: string backgroundTop: string
backgroundEnd: string backgroundEnd: string
} }
dark: { dark: {
primary: string text: string
backgroundStart: string backgroundTop: string
backgroundEnd: string backgroundEnd: string
} }
} }
@ -29,7 +29,6 @@ export interface ThemeConfig {
locale: typeof langPath[number] locale: typeof langPath[number]
moreLocale: typeof langPath[number][] moreLocale: typeof langPath[number][]
font: string font: string
toc: boolean
} }
comment?: { comment?: {

View file

@ -37,7 +37,7 @@ export default defineConfig({
colors: light, colors: light,
fontFamily: { fontFamily: {
title: ['Snell-Black', 'EarlySummer', 'ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'], title: ['Snell-Black', 'EarlySummer', 'ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'],
time: ['Snell-Bold', 'EarlySummer', 'ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'], date: ['Snell-Bold', 'EarlySummer', 'ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'],
serif: ['STIX', 'EarlySummer', 'Georgia', 'ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'], serif: ['STIX', 'EarlySummer', 'Georgia', 'ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'],
italic: ['STIX-italic', 'EarlySummer', 'ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'], italic: ['STIX-italic', 'EarlySummer', 'ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'],
custom: ['EarlySummer-custom', 'ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'], custom: ['EarlySummer-custom', 'ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'],