feat: 添加渐变色工具函数
- 创建渐变色样式生成函数 - 创建光晕效果生成函数 - 创建文字渐变效果函数 - 支持蓝色和紫色光晕
This commit is contained in:
@@ -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',
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user