优化 主题代码同步
This commit is contained in:
1 parent
92c7b62c5d
commit
80349d54b5
8 files changed
+122
-351
No files matched your search
+7
-12
@@ -4,6 +4,7 @@ import { useUIStore } from './stores/useUIStore';
|
||||
import { useLibraryStore } from './stores/useLibraryStore';
|
||||
import { useImageStore } from './stores/useImageStore';
|
||||
import { useScanStore } from './stores/useScanStore';
|
||||
import { useTheme } from './hooks/useTheme';
|
||||
import { libraryAPI, imageAPI, scanAPI } from './api';
|
||||
import domCleanup from './utils/domCleanup';
|
||||
import Sidebar from './components/Sidebar';
|
||||
@@ -13,7 +14,10 @@ import Header from './components/Header';
|
||||
import LibraryMissingModal from './components/LibraryMissingModal';
|
||||
|
||||
function App() {
|
||||
const { theme, mobileView, setMobileView } = useUIStore();
|
||||
// 使用统一的主题管理 Hook
|
||||
useTheme();
|
||||
|
||||
const { mobileView, setMobileView } = useUIStore();
|
||||
const {
|
||||
setLibraries,
|
||||
setCurrentLibrary,
|
||||
@@ -33,15 +37,6 @@ function App() {
|
||||
const [missingLibrary, setMissingLibrary] = useState(null); // 丢失的素材库信息
|
||||
const containerRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
// Apply theme
|
||||
if (theme === 'dark') {
|
||||
document.documentElement.classList.add('dark');
|
||||
} else {
|
||||
document.documentElement.classList.remove('dark');
|
||||
}
|
||||
}, [theme]);
|
||||
|
||||
// 检测屏幕尺寸
|
||||
useEffect(() => {
|
||||
const checkMobile = () => {
|
||||
@@ -581,7 +576,7 @@ function App() {
|
||||
/>
|
||||
<div ref={containerRef} className="flex flex-1 overflow-hidden">
|
||||
{/* 左侧边栏 */}
|
||||
<div id="left-panel" style={{ width: `${leftWidth}px` }} className="flex-shrink-0 h-full">
|
||||
<div id="left-panel" style={{ width: `${leftWidth}px` }} className="flex-shrink-0 h-full bg-white dark:bg-gray-800">
|
||||
<Sidebar />
|
||||
</div>
|
||||
|
||||
@@ -623,7 +618,7 @@ function App() {
|
||||
</div>
|
||||
|
||||
{/* 右侧边栏 */}
|
||||
<div id="right-panel" style={{ width: `${rightWidth}px` }} className="flex-shrink-0 h-full">
|
||||
<div id="right-panel" style={{ width: `${rightWidth}px` }} className="flex-shrink-0 h-full bg-white dark:bg-gray-800">
|
||||
<RightPanel />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,12 +4,14 @@ import { useLibraryStore } from '../stores/useLibraryStore';
|
||||
import { useImageStore } from '../stores/useImageStore';
|
||||
import { useUIStore } from '../stores/useUIStore';
|
||||
import { useScanStore } from '../stores/useScanStore';
|
||||
import { useTheme } from '../hooks/useTheme';
|
||||
import { libraryAPI, scanAPI, watchAPI } from '../api';
|
||||
|
||||
function Header() {
|
||||
const { currentLibraryId } = useLibraryStore();
|
||||
const { searchKeywords, originalImages, selectedFolder, setSearchKeywords, filters, setFilters, resetFilters } = useImageStore();
|
||||
const { theme, toggleTheme, thumbnailHeight, setThumbnailHeight, mobileView } = useUIStore();
|
||||
const { thumbnailHeight, setThumbnailHeight, mobileView } = useUIStore();
|
||||
const { theme, toggleTheme } = useTheme();
|
||||
|
||||
const [showFilters, setShowFilters] = useState(false);
|
||||
const [isRefreshing, setIsRefreshing] = useState(false);
|
||||
@@ -226,15 +228,6 @@ function Header() {
|
||||
setFilters({ formats: [], sizes: [], orientation: '' });
|
||||
};
|
||||
|
||||
const handleThemeToggle = async () => {
|
||||
toggleTheme();
|
||||
try {
|
||||
await libraryAPI.updateTheme(theme === 'light' ? 'dark' : 'light');
|
||||
} catch (error) {
|
||||
console.error('Error saving theme:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleThumbnailHeightChange = async (height) => {
|
||||
setThumbnailHeight(height);
|
||||
try {
|
||||
@@ -298,7 +291,7 @@ function Header() {
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={handleThemeToggle}
|
||||
onClick={toggleTheme}
|
||||
className="p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors"
|
||||
>
|
||||
{theme === 'light' ? (
|
||||
@@ -514,7 +507,7 @@ function Header() {
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={handleThemeToggle}
|
||||
onClick={toggleTheme}
|
||||
className="p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors"
|
||||
title={theme === 'light' ? '切换到暗色模式' : '切换到亮色模式'}
|
||||
>
|
||||
|
||||
@@ -425,11 +425,13 @@ function ImageWaterfall() {
|
||||
style={{ width: `${image.calculatedWidth}px` }}
|
||||
>
|
||||
<div
|
||||
className="relative group cursor-pointer overflow-hidden rounded-lg transition-all hover:shadow-lg"
|
||||
className={`relative group cursor-pointer overflow-hidden rounded-lg transition-all hover:shadow-lg ${
|
||||
isSelected
|
||||
? 'border-2 border-blue-400 dark:border-blue-500'
|
||||
: 'border border-gray-200 dark:border-gray-600'
|
||||
}`}
|
||||
style={{
|
||||
height: `${image.calculatedHeight}px`,
|
||||
backgroundColor: '#2a2a2a',
|
||||
border: isSelected ? '3px solid #3b82f6' : '3px solid transparent'
|
||||
height: `${image.calculatedHeight}px`
|
||||
}}
|
||||
onClick={(e) => handleImageClick(image, e, flatIndex)}
|
||||
onDoubleClick={() => {
|
||||
|
||||
@@ -840,7 +840,7 @@ function RightPanel() {
|
||||
|
||||
{/* Progressive Image Preview */}
|
||||
<div className="p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0">
|
||||
<div className="w-full aspect-square bg-gray-100 dark:bg-gray-700 rounded-lg overflow-hidden relative">
|
||||
<div className="w-full aspect-square bg-transparent border border-gray-200 dark:border-gray-600 rounded-lg overflow-hidden relative">
|
||||
<img
|
||||
src={imageUrl}
|
||||
alt={displayImage.filename}
|
||||
@@ -1019,7 +1019,7 @@ function RightPanel() {
|
||||
className={`w-full flex items-center justify-center gap-2 px-4 py-2 rounded-lg transition-all ${
|
||||
imageCopied
|
||||
? 'bg-green-500 text-white'
|
||||
: 'bg-blue-500 text-white hover:bg-blue-600'
|
||||
: 'bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600'
|
||||
}`}
|
||||
>
|
||||
{imageCopied ? (
|
||||
@@ -1065,7 +1065,7 @@ function RightPanel() {
|
||||
<button
|
||||
onClick={exportCurrentFolder}
|
||||
disabled={isExportingFolder}
|
||||
className="w-full flex flex-col items-center justify-center gap-2 px-4 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
className="w-full flex flex-col items-center justify-center gap-2 px-4 py-2 bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<FolderDown className="w-4 h-4" />
|
||||
@@ -1077,9 +1077,9 @@ function RightPanel() {
|
||||
</span>
|
||||
</div>
|
||||
{isExportingFolder && (
|
||||
<div className="w-full bg-purple-300 rounded-full h-1.5 mt-1">
|
||||
<div className="w-full bg-gray-300 dark:bg-gray-600 rounded-full h-1.5 mt-1">
|
||||
<div
|
||||
className="bg-white h-1.5 rounded-full transition-all duration-300"
|
||||
className="bg-gray-700 dark:bg-gray-300 h-1.5 rounded-full transition-all duration-300"
|
||||
style={{ width: `${folderExportProgress}%` }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -674,7 +674,7 @@ function Sidebar() {
|
||||
<button
|
||||
onClick={handleDeleteLibrary}
|
||||
disabled={isScanning()}
|
||||
className="px-3 py-2 border border-red-300 dark:border-red-600 rounded-lg hover:bg-red-50 dark:hover:bg-red-900 text-red-600 dark:text-red-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
className="px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
title={isScanning() ? "扫描进行中,无法删除" : "删除当前素材库"}
|
||||
>
|
||||
<Trash2 className="w-4 h-4" />
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* 统一主题管理 Hook - 轻量、快速、稳定
|
||||
* 集中处理:初始化、切换、持久化
|
||||
*/
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { useUIStore } from '../stores/useUIStore';
|
||||
import { libraryAPI } from '../api';
|
||||
|
||||
export function useTheme() {
|
||||
const theme = useUIStore(state => state.theme);
|
||||
const setTheme = useUIStore(state => state.setTheme);
|
||||
|
||||
// 初始化:应用主题到 DOM
|
||||
useEffect(() => {
|
||||
const root = document.documentElement;
|
||||
if (theme === 'dark') {
|
||||
root.classList.add('dark');
|
||||
} else {
|
||||
root.classList.remove('dark');
|
||||
}
|
||||
}, [theme]);
|
||||
|
||||
// 切换主题(带后端持久化)
|
||||
const toggleTheme = async () => {
|
||||
const newTheme = theme === 'light' ? 'dark' : 'light';
|
||||
setTheme(newTheme);
|
||||
|
||||
// 异步保存,不阻塞 UI
|
||||
try {
|
||||
await libraryAPI.updateTheme(newTheme);
|
||||
} catch (error) {
|
||||
console.error('保存主题失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
return { theme, toggleTheme };
|
||||
}
|
||||
+41
-316
@@ -22,335 +22,58 @@ body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 暗色主题 - 纯黑灰色调 */
|
||||
/* ==================== 主题系统 - CSS 变量方案 ==================== */
|
||||
/* 轻量、快速、稳定 - 仅定义核心变量,让 Tailwind 自动处理 */
|
||||
|
||||
:root {
|
||||
/* 亮色主题变量 */
|
||||
--bg-primary: #ffffff;
|
||||
--bg-secondary: #f9fafb;
|
||||
--bg-tertiary: #f3f4f6;
|
||||
--text-primary: #111827;
|
||||
--text-secondary: #6b7280;
|
||||
--border-color: #e5e7eb;
|
||||
--hover-bg: #f3f4f6;
|
||||
}
|
||||
|
||||
.dark {
|
||||
--tw-bg-opacity: 1;
|
||||
/* 暗色主题变量 - 护眼优化版 */
|
||||
/* 基于色彩心理学:避免纯黑,降低对比度,微暖色调 */
|
||||
--bg-primary: #1e1e1e; /* 主背景(避免纯黑 #171717,减少眼疲劳) */
|
||||
--bg-secondary: #2c2c2c; /* 侧边栏(从 #252525 调亮,增加层次) */
|
||||
--bg-tertiary: #323232; /* 三级背景(从 #2a2a2a 调亮) */
|
||||
--text-primary: #d4d4d4; /* 主文字(从 #e0e0e0 降低,减少对比度) */
|
||||
--text-secondary: #a8a8a8; /* 次要文字(从 #b0b0b0 微调) */
|
||||
--border-color: #3a3a3a; /* 边框(从 #333333 调亮,更柔和) */
|
||||
--hover-bg: #323232; /* 悬停背景 */
|
||||
}
|
||||
|
||||
/* 背景色 - 纯黑灰 */
|
||||
.dark .bg-gray-900 {
|
||||
background-color: #0a0a0a !important;
|
||||
}
|
||||
/* ==================== 必要的暗色主题覆盖 ==================== */
|
||||
/* 只保留真正需要自定义的样式 */
|
||||
|
||||
.dark .bg-gray-800 {
|
||||
background-color: #252525 !important; /* 侧边栏/顶部 - 稍微亮一些 */
|
||||
}
|
||||
|
||||
.dark .bg-gray-700 {
|
||||
background-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
.dark .bg-gray-600 {
|
||||
background-color: #3a3a3a !important;
|
||||
}
|
||||
|
||||
.dark .bg-gray-500 {
|
||||
background-color: #3a3a3a !important;
|
||||
}
|
||||
|
||||
.dark .bg-gray-400 {
|
||||
background-color: #4a4a4a !important;
|
||||
}
|
||||
|
||||
.dark .bg-gray-300 {
|
||||
background-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
.dark .bg-gray-200:not(img):not(.image-container) {
|
||||
background-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
.dark .bg-gray-100 {
|
||||
background-color: #1a1a1a !important;
|
||||
}
|
||||
|
||||
.dark .bg-gray-50 {
|
||||
background-color: #1a1a1a !important;
|
||||
}
|
||||
|
||||
.dark .bg-white {
|
||||
background-color: #1a1a1a !important;
|
||||
}
|
||||
|
||||
/* 边框色 - 深灰 */
|
||||
.dark .border-gray-700 {
|
||||
border-color: #333333 !important;
|
||||
}
|
||||
|
||||
.dark .border-gray-600 {
|
||||
border-color: #444444 !important;
|
||||
}
|
||||
|
||||
.dark .border-gray-300 {
|
||||
border-color: #333333 !important;
|
||||
}
|
||||
|
||||
.dark .border-gray-200 {
|
||||
border-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
.dark .border-gray-100 {
|
||||
border-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
/* 文字色 - 纯白灰 */
|
||||
.dark .text-gray-900 {
|
||||
color: #f5f5f5 !important;
|
||||
}
|
||||
|
||||
.dark .text-gray-700 {
|
||||
color: #e0e0e0 !important;
|
||||
}
|
||||
|
||||
.dark .text-gray-600 {
|
||||
color: #b0b0b0 !important;
|
||||
}
|
||||
|
||||
.dark .text-gray-500 {
|
||||
color: #909090 !important;
|
||||
}
|
||||
|
||||
.dark .text-gray-400 {
|
||||
color: #707070 !important;
|
||||
}
|
||||
|
||||
.dark .text-gray-300 {
|
||||
color: #d0d0d0 !important;
|
||||
}
|
||||
|
||||
.dark .text-white {
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.dark .text-gray-800 {
|
||||
color: #e0e0e0 !important;
|
||||
}
|
||||
|
||||
.dark .text-gray-200 {
|
||||
color: #d0d0d0 !important;
|
||||
}
|
||||
|
||||
.dark .text-gray-100 {
|
||||
color: #e0e0e0 !important;
|
||||
}
|
||||
|
||||
/* 透明度覆盖 */
|
||||
.dark .bg-opacity-0 {
|
||||
--tw-bg-opacity: 0 !important;
|
||||
}
|
||||
|
||||
.dark .bg-opacity-10 {
|
||||
--tw-bg-opacity: 0.1 !important;
|
||||
}
|
||||
|
||||
.dark .bg-opacity-20 {
|
||||
--tw-bg-opacity: 0.2 !important;
|
||||
}
|
||||
|
||||
.dark .bg-opacity-30 {
|
||||
--tw-bg-opacity: 0.3 !important;
|
||||
}
|
||||
|
||||
.dark .bg-opacity-50 {
|
||||
--tw-bg-opacity: 0.5 !important;
|
||||
}
|
||||
|
||||
/* 悬停效果 - 深灰 */
|
||||
.dark .hover\:bg-gray-100:hover {
|
||||
background-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
.dark .hover\:bg-gray-700:hover {
|
||||
background-color: #333333 !important;
|
||||
}
|
||||
|
||||
.dark .hover\:bg-gray-600:hover {
|
||||
background-color: #3a3a3a !important;
|
||||
}
|
||||
|
||||
.dark .hover\:bg-gray-200:hover {
|
||||
background-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
.dark .hover\:bg-gray-50:hover {
|
||||
background-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
/* 黑色相关 - 但不影响透明遮罩 */
|
||||
.dark .bg-black:not(.bg-opacity-0):not(.bg-opacity-10):not(.bg-opacity-20):not(.bg-opacity-30) {
|
||||
background-color: #0a0a0a !important;
|
||||
}
|
||||
|
||||
.dark .text-black {
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.dark .border-black {
|
||||
border-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
/* 移除所有颜色调,统一为黑灰 */
|
||||
|
||||
/* 蓝色系 -> 黑灰 */
|
||||
.dark .bg-blue-50 {
|
||||
background-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
.dark .bg-blue-100 {
|
||||
background-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
.dark .bg-blue-200 {
|
||||
background-color: #3a3a3a !important;
|
||||
}
|
||||
|
||||
.dark .bg-blue-500 {
|
||||
background-color: #4a4a4a !important;
|
||||
}
|
||||
|
||||
.dark .bg-blue-600 {
|
||||
background-color: #3a3a3a !important;
|
||||
}
|
||||
|
||||
.dark .bg-blue-800 {
|
||||
background-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
.dark .bg-blue-900 {
|
||||
background-color: #1a1a1a !important;
|
||||
}
|
||||
|
||||
.dark .text-blue-300 {
|
||||
color: #d0d0d0 !important;
|
||||
}
|
||||
|
||||
.dark .text-blue-400 {
|
||||
color: #e0e0e0 !important;
|
||||
}
|
||||
|
||||
.dark .text-blue-500 {
|
||||
color: #f0f0f0 !important;
|
||||
}
|
||||
|
||||
.dark .text-blue-600 {
|
||||
color: #f0f0f0 !important;
|
||||
}
|
||||
|
||||
.dark .text-blue-700 {
|
||||
color: #e0e0e0 !important;
|
||||
}
|
||||
|
||||
.dark .border-blue-200 {
|
||||
border-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
.dark .border-blue-500 {
|
||||
border-color: #4a4a4a !important;
|
||||
}
|
||||
|
||||
.dark .border-blue-700 {
|
||||
border-color: #333333 !important;
|
||||
}
|
||||
|
||||
.dark .hover\:bg-blue-600:hover {
|
||||
background-color: #4a4a4a !important;
|
||||
}
|
||||
|
||||
.dark .hover\:bg-blue-50:hover {
|
||||
background-color: #333333 !important;
|
||||
}
|
||||
|
||||
/* 绿色系 -> 黑灰 */
|
||||
.dark .bg-green-50 {
|
||||
background-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
.dark .text-green-600 {
|
||||
color: #e0e0e0 !important;
|
||||
}
|
||||
|
||||
/* 红色系 -> 黑灰 */
|
||||
.dark .bg-red-50 {
|
||||
background-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
.dark .text-red-600 {
|
||||
color: #f0a0a0 !important;
|
||||
}
|
||||
|
||||
/* 黄色系 -> 黑灰 */
|
||||
.dark .bg-yellow-50 {
|
||||
background-color: #2a2a2a !important;
|
||||
}
|
||||
|
||||
.dark .text-yellow-600 {
|
||||
color: #e0e0a0 !important;
|
||||
}
|
||||
|
||||
/* 图片容器不要覆盖 */
|
||||
/* 图片背景保持透明 */
|
||||
.dark img {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
/* 输入框和选择框 */
|
||||
/* 输入框样式 - 护眼优化 */
|
||||
.dark input,
|
||||
.dark select,
|
||||
.dark textarea {
|
||||
background-color: #1a1a1a !important;
|
||||
border-color: #333333 !important;
|
||||
color: #e0e0e0 !important;
|
||||
background-color: #1e1e1e; /* 使用主背景色 */
|
||||
border-color: #3a3a3a; /* 使用优化后的边框色 */
|
||||
color: #d4d4d4; /* 使用优化后的主文字色 */
|
||||
}
|
||||
|
||||
.dark input:focus,
|
||||
.dark select:focus,
|
||||
.dark textarea:focus {
|
||||
border-color: #4a4a4a !important;
|
||||
outline: none !important;
|
||||
--tw-ring-color: #4a4a4a !important;
|
||||
border-color: #5a5a5a; /* 焦点时稍微亮一点 */
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.dark input::placeholder {
|
||||
color: #707070 !important;
|
||||
}
|
||||
|
||||
/* 按钮 */
|
||||
.dark button {
|
||||
color: #e0e0e0 !important;
|
||||
}
|
||||
|
||||
.dark .bg-blue-500 {
|
||||
background-color: #4a4a4a !important;
|
||||
}
|
||||
|
||||
.dark .hover\:bg-blue-600:hover {
|
||||
background-color: #5a5a5a !important;
|
||||
}
|
||||
|
||||
/* 阴影 */
|
||||
.dark .shadow-lg {
|
||||
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3) !important;
|
||||
}
|
||||
|
||||
.dark .shadow-xl {
|
||||
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3) !important;
|
||||
}
|
||||
|
||||
.dark .hover\:shadow-lg:hover {
|
||||
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3) !important;
|
||||
}
|
||||
|
||||
/* Ring (focus outline) */
|
||||
.dark .ring-blue-500 {
|
||||
--tw-ring-color: #4a4a4a !important;
|
||||
}
|
||||
|
||||
.dark .focus\:ring-blue-500:focus {
|
||||
--tw-ring-color: #4a4a4a !important;
|
||||
}
|
||||
|
||||
.dark .focus\:ring-2:focus {
|
||||
--tw-ring-offset-shadow: 0 0 0 0px #000 !important;
|
||||
--tw-ring-shadow: 0 0 0 2px #4a4a4a !important;
|
||||
color: #7a7a7a; /* 占位符颜色调亮 */
|
||||
}
|
||||
|
||||
/* Custom scrollbar */
|
||||
@@ -365,24 +88,26 @@ body {
|
||||
|
||||
/* 亮色主题滚动条 */
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
background: rgba(0, 0, 0, 0.15); /* 降低不透明度,更柔和 */
|
||||
border-radius: 4px;
|
||||
transition: background 0.2s ease;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
background: rgba(0, 0, 0, 0.25); /* 悬停时稍微明显 */
|
||||
}
|
||||
|
||||
/* 暗色主题滚动条 */
|
||||
/* 暗色主题滚动条 - 护眼优化 */
|
||||
.dark ::-webkit-scrollbar-track {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
background: rgba(255, 255, 255, 0.03); /* 极淡背景 */
|
||||
}
|
||||
|
||||
.dark ::-webkit-scrollbar-thumb {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
background: rgba(255, 255, 255, 0.15); /* 降低亮度,减少刺激 */
|
||||
border-radius: 4px;
|
||||
transition: background 0.2s ease;
|
||||
}
|
||||
|
||||
.dark ::-webkit-scrollbar-thumb:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
background: rgba(255, 255, 255, 0.25); /* 悬停时更明显 */
|
||||
}
|
||||
@@ -6,7 +6,25 @@ export default {
|
||||
],
|
||||
darkMode: 'class',
|
||||
theme: {
|
||||
extend: {},
|
||||
extend: {
|
||||
colors: {
|
||||
// 优化后的灰色调 - 微暖色调,护眼舒适
|
||||
// 基于色彩心理学:避免纯黑,降低对比度,减少眼疲劳
|
||||
gray: {
|
||||
50: '#fafafa',
|
||||
100: '#f5f5f5',
|
||||
200: '#e8e8e8', // 稍微调亮,柔和边框
|
||||
300: '#d4d4d4',
|
||||
400: '#a8a8a8', // 微调亮度
|
||||
500: '#7a7a7a', // 中间色调亮
|
||||
600: '#5a5a5a', // 调亮,减少对比
|
||||
700: '#454545', // 调亮,更舒适
|
||||
800: '#2c2c2c', // 从 #262626 调亮(侧边栏)
|
||||
900: '#1e1e1e', // 从 #171717 调亮(主背景,避免纯黑)
|
||||
950: '#121212', // 保留深色选项
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
Reference in new issue
Block a user