mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(css): text-stroke support (#10399)
closes https://github.com/NativeScript/NativeScript/issues/3597 closes https://github.com/NativeScript/NativeScript/issues/3972
This commit is contained in:
23
packages/core/ui/styling/css-stroke.ts
Normal file
23
packages/core/ui/styling/css-stroke.ts
Normal 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),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user