This commit is contained in:
ysk2014 2020-10-13 12:11:33 +08:00
parent d7f681a60b
commit aedf3f4cba
2 changed files with 17 additions and 11 deletions

View File

@ -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);

View File

@ -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;
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;
}
}
};