Nathan Walker
2023-10-09 12:00:21 -07:00
committed by GitHub
parent 93e24783a1
commit d6478237ec
18 changed files with 230 additions and 76 deletions

View File

@@ -0,0 +1,23 @@
import { CoreTypes } from '../../core-types';
import { Color } from '../../color';
import { parseCSSShorthand } from './css-shadow';
export interface StrokeCSSValues {
width: CoreTypes.LengthType;
color: Color;
}
/**
* Parse a string into StrokeCSSValues
* https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-text-stroke
* @param value
*/
export function parseCSSStroke(value: string): StrokeCSSValues {
const data = parseCSSShorthand(value);
const [width] = data.values;
return {
width,
color: new Color(data.color),
};
}