mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
27 lines
601 B
TypeScript
27 lines
601 B
TypeScript
import { CoreTypes } from '../../core-types';
|
|
import { Color } from '../../color';
|
|
import { parseCSSShorthand } from './css-utils';
|
|
|
|
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);
|
|
if (!data) {
|
|
return null;
|
|
}
|
|
const [width] = data.values;
|
|
|
|
return {
|
|
width,
|
|
color: data.color ? new Color(data.color) : undefined,
|
|
};
|
|
}
|