优化组件/更新
This commit is contained in:
67
uni_modules/lime-style/token/dark.uts
Normal file
67
uni_modules/lime-style/token/dark.uts
Normal file
@@ -0,0 +1,67 @@
|
||||
import { TinyColor, generate, LGenerateOptions } from '@/uni_modules/lime-color';
|
||||
import { getAlphaColor, getSolidColor, generateColorPalettes } from './shared'
|
||||
import { SeedToken } from './interface'
|
||||
// #ifndef UNI-APP-X
|
||||
export type UTSJSONObject = Record<string, any>
|
||||
const UTSJSONObject = Object
|
||||
// #endif
|
||||
|
||||
export function generateNeutralColorPalettes(
|
||||
bgBaseColor : string | null,
|
||||
textBaseColor : string | null) : UTSJSONObject {
|
||||
const colorBgBase = bgBaseColor ?? '#000';
|
||||
const colorTextBase = textBaseColor ?? '#fff';
|
||||
|
||||
return {
|
||||
'bgColorBase': colorBgBase,
|
||||
'textColorBase': colorTextBase,
|
||||
|
||||
'textColor1': getAlphaColor(colorTextBase, 0.85),
|
||||
'textColor2': getAlphaColor(colorTextBase, 0.65),
|
||||
'textColor3': getAlphaColor(colorTextBase, 0.45),
|
||||
'textColor4': getAlphaColor(colorTextBase, 0.25),
|
||||
|
||||
'fill1': getAlphaColor(colorTextBase, 0.18),
|
||||
'fill2': getAlphaColor(colorTextBase, 0.12),
|
||||
'fill3': getAlphaColor(colorTextBase, 0.08),
|
||||
'fill4': getAlphaColor(colorTextBase, 0.04),
|
||||
|
||||
'bgColorElevated': getSolidColor(colorBgBase, 12),
|
||||
'bgColorContainer': getSolidColor(colorBgBase, 8),
|
||||
'bgColorPage': getSolidColor(colorBgBase, 0),
|
||||
'bgColorSpotlight': getSolidColor(colorBgBase, 26),
|
||||
// 'bgColor5': getAlphaColor(colorTextBase, 0.04),
|
||||
'bgColorMask': getAlphaColor(colorBgBase, 0.45),
|
||||
'bgColorBlur': getAlphaColor(colorTextBase, 0.04),
|
||||
|
||||
'borderColor1': getSolidColor(colorBgBase, 26),
|
||||
'borderColor2': getSolidColor(colorBgBase, 19)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export function genColorMapToken(token : SeedToken) : UTSJSONObject {
|
||||
const colorPrimaryBase = token.primaryColor
|
||||
const colorSuccessBase = token.successColor
|
||||
const colorWarningBase = token.warningColor
|
||||
const colorErrorBase = token.errorColor
|
||||
const colorInfoBase = token.infoColor
|
||||
const colorBgBase = token.bgColorBase
|
||||
const colorTextBase = token.textColorBase
|
||||
|
||||
const primaryColors = generateColorPalettes(colorPrimaryBase, 'primaryColor', 'dark');
|
||||
const successColors = generateColorPalettes(colorSuccessBase, 'successColor', 'dark');
|
||||
const warningColors = generateColorPalettes(colorWarningBase, 'warningColor', 'dark');
|
||||
const errorColors = generateColorPalettes(colorErrorBase, 'errorColor', 'dark');
|
||||
const infoColors = generateColorPalettes(colorInfoBase, 'infoColor', 'dark');
|
||||
const neutralColors = generateNeutralColorPalettes(colorBgBase, colorTextBase);
|
||||
|
||||
return UTSJSONObject.assign(
|
||||
{},
|
||||
primaryColors,
|
||||
successColors,
|
||||
warningColors,
|
||||
errorColors,
|
||||
infoColors,
|
||||
neutralColors)
|
||||
}
|
||||
Reference in New Issue
Block a user