From aedf3f4cba0fd881e081056d2af064af0d2f4bfb Mon Sep 17 00:00:00 2001 From: ysk2014 <1181102772@qq.com> Date: Tue, 13 Oct 2020 12:11:33 +0800 Subject: [PATCH] prettier --- src/css/index.ts | 6 +++--- src/render/font-color-gradient.ts | 22 ++++++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/css/index.ts b/src/css/index.ts index 148a33a..0eab690 100644 --- a/src/css/index.ts +++ b/src/css/index.ts @@ -44,8 +44,8 @@ import {overflow, OVERFLOW} from './property-descriptors/overflow'; import {overflowWrap} from './property-descriptors/overflow-wrap'; import {paddingBottom, paddingLeft, paddingRight, paddingTop} from './property-descriptors/padding'; import {textAlign} from './property-descriptors/text-align'; -import { position, POSITION } from './property-descriptors/position'; -import { textFillColor } from './property-descriptors/text-fill-color'; +import {position, POSITION} from './property-descriptors/position'; +import {textFillColor} from './property-descriptors/text-fill-color'; import {textShadow} from './property-descriptors/text-shadow'; import {textTransform} from './property-descriptors/text-transform'; import {textStrokeColor} from './property-descriptors/text-stroke-color'; @@ -202,7 +202,7 @@ export class CSSParsedDeclaration { this.paddingLeft = parse(paddingLeft, declaration.paddingLeft); this.position = parse(position, declaration.position); this.textAlign = parse(textAlign, declaration.textAlign); - this.textFillColor = parse(textFillColor, declaration.textFillColor) + this.textFillColor = parse(textFillColor, declaration.textFillColor); this.textDecorationColor = parse(textDecorationColor, declaration.textDecorationColor || declaration.color); this.textDecorationLine = parse(textDecorationLine, declaration.textDecorationLine); this.textShadow = parse(textShadow, declaration.textShadow); diff --git a/src/render/font-color-gradient.ts b/src/render/font-color-gradient.ts index 8196e73..c916395 100644 --- a/src/render/font-color-gradient.ts +++ b/src/render/font-color-gradient.ts @@ -1,12 +1,18 @@ - -import { CSSParsedDeclaration } from '../css/index'; -import { isLinearGradient, isRadialGradient } from '../css/types/image'; -import { BACKGROUND_CLIP } from '../css/property-descriptors/background-clip'; +import {CSSParsedDeclaration} from '../css/index'; +import {isLinearGradient, isRadialGradient} from '../css/types/image'; +import {BACKGROUND_CLIP} from '../css/property-descriptors/background-clip'; export const isFontColorGradient = (styles: CSSParsedDeclaration) => { - if (styles.backgroundImage.length === 1 && (isLinearGradient(styles.backgroundImage[0]) || isRadialGradient(styles.backgroundImage[0]))) { - return (styles.textFillColor === 0 || styles.color === 0) && styles.backgroundClip.length === 1 && styles.backgroundClip[0] === BACKGROUND_CLIP.TEXT; - } else { + if ( + styles.backgroundImage.length === 1 && + (isLinearGradient(styles.backgroundImage[0]) || isRadialGradient(styles.backgroundImage[0])) + ) { + return ( + (styles.textFillColor === 0 || styles.color === 0) && + styles.backgroundClip.length === 1 && + styles.backgroundClip[0] === BACKGROUND_CLIP.TEXT + ); + } else { return false; } -} +};