feat: 添加渐变色工具函数

- 创建渐变色样式生成函数
- 创建光晕效果生成函数
- 创建文字渐变效果函数
- 支持蓝色和紫色光晕
This commit is contained in:
张翔
2026-02-22 15:04:25 +08:00
parent f88020ee5e
commit 5852e2a799
+29
View File
@@ -0,0 +1,29 @@
import { gradients } from './colors';
export const getGradientStyle = (type: keyof typeof gradients) => {
return {
background: gradients[type],
};
};
export const getGlowStyle = (color: 'blue' | 'purple', opacity: number = 0.15) => {
const colorValue = color === 'blue' ? '0, 217, 255' : '168, 85, 247';
return {
background: `radial-gradient(circle, rgba(${colorValue}, ${opacity}) 0%, transparent 70%)`,
};
};
export const getBorderGradientStyle = () => {
return {
borderImage: `${gradients.primary} 1`,
};
};
export const getTextGradientStyle = () => {
return {
background: gradients.primary,
WebkitBackgroundClip: 'text',
WebkitTextFillColor: 'transparent',
backgroundClip: 'text',
};
};