mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-03 07:06:04 +00:00
feat: implement support for context-fill and context-stroke color
This commit is contained in:
@@ -4,6 +4,8 @@ import { Color } from './types';
|
||||
const urlIdPattern = /^url\(#(.+)\)$/;
|
||||
|
||||
const currentColorBrush = [2];
|
||||
const contextFillBrush = [3];
|
||||
const contextStrokeBrush = [4];
|
||||
|
||||
export default function extractBrush(color?: Color) {
|
||||
if (typeof color === 'number') {
|
||||
@@ -20,6 +22,14 @@ export default function extractBrush(color?: Color) {
|
||||
return currentColorBrush;
|
||||
}
|
||||
|
||||
if (color === 'context-fill') {
|
||||
return contextFillBrush;
|
||||
}
|
||||
|
||||
if (color === 'context-stroke') {
|
||||
return contextStrokeBrush;
|
||||
}
|
||||
|
||||
const brush = typeof color === 'string' && color.match(urlIdPattern);
|
||||
if (brush) {
|
||||
return [1, brush[1]];
|
||||
|
||||
Reference in New Issue
Block a user