1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-09-11 05:05:23 +03:00

Merge pull request #535 from exyte/fix/387

Fix #387: add "system" color support for SVG parser
This commit is contained in:
Yuri Strot 2019-04-08 16:57:55 +07:00 committed by GitHub
commit 9a1abccbb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 798 additions and 2 deletions

View File

@ -19,6 +19,8 @@
30FF496D215CF27E00FF653C /* MCAShapeLayerLineCap_macOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30FF496C215CF27E00FF653C /* MCAShapeLayerLineCap_macOS.swift */; };
30FF496F215CF3B000FF653C /* MCAMediaTimingFunctionName_iOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30FF496E215CF3B000FF653C /* MCAMediaTimingFunctionName_iOS.swift */; };
30FF4971215CF4CE00FF653C /* MCAMediaTimingFunctionName_macOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30FF4970215CF4CE00FF653C /* MCAMediaTimingFunctionName_macOS.swift */; };
421C66502225196900DD73F5 /* color-prop-04-t-manual.svg in Resources */ = {isa = PBXBuildFile; fileRef = 421C664F2225196900DD73F5 /* color-prop-04-t-manual.svg */; };
4269F43E2257265800D91393 /* color-prop-04-t-manual.reference in Resources */ = {isa = PBXBuildFile; fileRef = 4269F43D2257265700D91393 /* color-prop-04-t-manual.reference */; };
5713C4E21E51EC8F00BBA4D9 /* TouchEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5713C4E11E51EC8F00BBA4D9 /* TouchEvent.swift */; };
5713C4F31E5AD46800BBA4D9 /* ControlStatesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5713C4F21E5AD46800BBA4D9 /* ControlStatesTests.swift */; };
5713C4F51E5AE2C300BBA4D9 /* CombineAnimationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5713C4F41E5AE2C300BBA4D9 /* CombineAnimationTests.swift */; };
@ -555,6 +557,8 @@
30FF496C215CF27E00FF653C /* MCAShapeLayerLineCap_macOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MCAShapeLayerLineCap_macOS.swift; sourceTree = "<group>"; };
30FF496E215CF3B000FF653C /* MCAMediaTimingFunctionName_iOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MCAMediaTimingFunctionName_iOS.swift; sourceTree = "<group>"; };
30FF4970215CF4CE00FF653C /* MCAMediaTimingFunctionName_macOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MCAMediaTimingFunctionName_macOS.swift; sourceTree = "<group>"; };
421C664F2225196900DD73F5 /* color-prop-04-t-manual.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "color-prop-04-t-manual.svg"; sourceTree = "<group>"; };
4269F43D2257265700D91393 /* color-prop-04-t-manual.reference */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "color-prop-04-t-manual.reference"; sourceTree = "<group>"; };
5713C4E11E51EC8F00BBA4D9 /* TouchEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TouchEvent.swift; sourceTree = "<group>"; };
5713C4F21E5AD46800BBA4D9 /* ControlStatesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlStatesTests.swift; sourceTree = "<group>"; };
5713C4F41E5AE2C300BBA4D9 /* CombineAnimationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CombineAnimationTests.swift; sourceTree = "<group>"; };
@ -1356,6 +1360,8 @@
5B1AE18320B6A669007EECCB /* w3cSVGTests */ = {
isa = PBXGroup;
children = (
421C664F2225196900DD73F5 /* color-prop-04-t-manual.svg */,
4269F43D2257265700D91393 /* color-prop-04-t-manual.reference */,
5B1AE22D20B6A669007EECCB /* color-prop-01-b-manual.reference */,
5B1AE18A20B6A669007EECCB /* color-prop-01-b-manual.svg */,
5B1AE22C20B6A669007EECCB /* color-prop-02-f-manual.reference */,
@ -1765,6 +1771,7 @@
5B1AE26920B6A669007EECCB /* struct-use-03-t-manual.reference in Resources */,
5B1AE27820B6A669007EECCB /* struct-group-01-t-manual.reference in Resources */,
5B1AE2B820B6A669007EECCB /* painting-stroke-03-t-manual.reference in Resources */,
4269F43E2257265800D91393 /* color-prop-04-t-manual.reference in Resources */,
5B1AE2C720B6A669007EECCB /* paths-data-02-t-manual.svg in Resources */,
5B1AE27120B6A669007EECCB /* painting-stroke-04-t-manual.reference in Resources */,
5B1AE2C220B6A669007EECCB /* coords-trans-05-t-manual.svg in Resources */,
@ -1851,6 +1858,7 @@
5B1AE23C20B6A669007EECCB /* paths-data-15-t-manual.svg in Resources */,
5BAE2039208E163D006BF277 /* polygon.reference in Resources */,
5B1AE27220B6A669007EECCB /* struct-frag-06-t-manual.svg in Resources */,
421C66502225196900DD73F5 /* color-prop-04-t-manual.svg in Resources */,
5B1AE2A020B6A669007EECCB /* coords-trans-08-t-manual.svg in Resources */,
5B1AE23A20B6A669007EECCB /* painting-fill-03-t-manual.reference in Resources */,
5BAE2043208E163D006BF277 /* textBasicTransform.reference in Resources */,

View File

@ -485,6 +485,10 @@ class MacawSVGTests: XCTestCase {
validateJSON("color-prop-03-t-manual")
}
func testColorProp04() {
validateJSON("color-prop-04-t-manual")
}
func testTypesBasic01() {
validateJSON("types-basic-01-f-manual")
}

View File

@ -0,0 +1,642 @@
{
"contents" : [
{
"contents" : [
{
"contents" : [
{
"fill" : {
"type" : "Color",
"val" : 6513614
},
"form" : {
"h" : 300,
"type" : "Rect",
"w" : 460,
"x" : -230,
"y" : -170
},
"node" : "Shape"
},
{
"fill" : {
"type" : "Color",
"val" : 16777215
},
"form" : {
"h" : 280,
"type" : "Rect",
"w" : 440,
"x" : -220,
"y" : -160
},
"node" : "Shape"
},
{
"fill" : {
"type" : "Color",
"val" : 16777215
},
"form" : {
"h" : 221,
"type" : "Rect",
"w" : 317,
"x" : -152,
"y" : -108
},
"node" : "Shape"
},
{
"form" : {
"h" : 221,
"type" : "Rect",
"w" : 317,
"x" : -152,
"y" : -108
},
"node" : "Shape",
"stroke" : {
"cap" : "butt",
"dashes" : [
],
"fill" : {
"type" : "Color",
"val" : 13421772
},
"join" : "miter",
"width" : 3
}
},
{
"contents" : [
{
"align" : "min",
"baseline" : "bottom",
"fill" : {
"type" : "Color",
"val" : 0
},
"font" : {
"name" : "SVGFreeSansASCII,sans-serif",
"size" : 12,
"weight" : "normal"
},
"node" : "Text",
"place" : "1, 0, 0, 1, -148, 0",
"text" : "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "
},
{
"align" : "min",
"baseline" : "bottom",
"fill" : {
"type" : "Color",
"val" : 0
},
"font" : {
"name" : "SVGFreeSansASCII,sans-serif",
"size" : 12,
"weight" : "normal"
},
"node" : "Text",
"place" : "1, 0, 0, 1, -148, 20",
"text" : "Vestibulum pulvinar. Duis laoreet, nunc vitae facilisis "
},
{
"align" : "min",
"baseline" : "bottom",
"fill" : {
"type" : "Color",
"val" : 0
},
"font" : {
"name" : "SVGFreeSansASCII,sans-serif",
"size" : 12,
"weight" : "normal"
},
"node" : "Text",
"place" : "1, 0, 0, 1, -148, 40",
"text" : "tristique, pede sem iaculis mi, non consectetuer lorem "
},
{
"align" : "min",
"baseline" : "bottom",
"fill" : {
"type" : "Color",
"val" : 0
},
"font" : {
"name" : "SVGFreeSansASCII,sans-serif",
"size" : 12,
"weight" : "normal"
},
"node" : "Text",
"place" : "1, 0, 0, 1, -148, 60",
"text" : "libero et est. Donec imperdiet purus sed odio. Duis "
},
{
"align" : "min",
"baseline" : "bottom",
"fill" : {
"type" : "Color",
"val" : 0
},
"font" : {
"name" : "SVGFreeSansASCII,sans-serif",
"size" : 12,
"weight" : "normal"
},
"node" : "Text",
"place" : "1, 0, 0, 1, -148, 80",
"text" : "venenatis tortor eu lectus. Suspendisse sed metus at "
},
{
"align" : "min",
"baseline" : "bottom",
"fill" : {
"type" : "Color",
"val" : 0
},
"font" : {
"name" : "SVGFreeSansASCII,sans-serif",
"size" : 12,
"weight" : "normal"
},
"node" : "Text",
"place" : "1, 0, 0, 1, -148, 100",
"text" : "metus viverra ultricies. Mauris porttitor, justo a vulputate"
}
],
"node" : "Group"
},
{
"contents" : [
{
"fill" : {
"type" : "Color",
"val" : 12632256
},
"form" : {
"h" : 190,
"type" : "Rect",
"w" : 118,
"x" : -150,
"y" : -107
},
"node" : "Shape"
},
{
"fill" : {
"type" : "Color",
"val" : 12632256
},
"form" : {
"h" : 34,
"type" : "Rect",
"w" : 102,
"x" : -143,
"y" : 0
},
"node" : "Shape"
},
{
"align" : "min",
"baseline" : "bottom",
"fill" : {
"type" : "Color",
"val" : 0
},
"font" : {
"name" : "SVGFreeSansASCII,sans-serif",
"size" : 20,
"weight" : "bold"
},
"node" : "Text",
"place" : "1, 0, 0, 1, -138, 24",
"text" : "Load"
},
{
"fill" : {
"type" : "Color",
"val" : 12632256
},
"form" : {
"h" : 34,
"type" : "Rect",
"w" : 102,
"x" : -143,
"y" : 40
},
"node" : "Shape"
},
{
"align" : "min",
"baseline" : "bottom",
"fill" : {
"type" : "Color",
"val" : 0
},
"font" : {
"name" : "SVGFreeSansASCII,sans-serif",
"size" : 20,
"weight" : "bold"
},
"node" : "Text",
"place" : "1, 0, 0, 1, -138, 64",
"text" : "Save"
},
{
"form" : {
"segments" : [
{
"data" : [
-149,
83
],
"type" : "M"
},
{
"data" : [
114
],
"type" : "h"
},
{
"data" : [
-94
],
"type" : "v"
}
],
"type" : "Path"
},
"node" : "Shape",
"stroke" : {
"cap" : "butt",
"dashes" : [
],
"fill" : {
"type" : "Color",
"val" : 6710886
},
"join" : "miter",
"width" : 4
}
},
{
"form" : {
"segments" : [
{
"data" : [
-149,
83
],
"type" : "M"
},
{
"data" : [
-94
],
"type" : "v"
},
{
"data" : [
114
],
"type" : "h"
}
],
"type" : "Path"
},
"node" : "Shape",
"stroke" : {
"cap" : "butt",
"dashes" : [
],
"fill" : {
"type" : "Color",
"val" : 12632256
},
"join" : "miter",
"width" : 4
}
}
],
"node" : "Group",
"place" : "1, 0, 0, 1, 2, 0"
},
{
"contents" : [
{
"fill" : {
"type" : "Color",
"val" : 12632256
},
"form" : {
"h" : 46,
"type" : "Rect",
"w" : 310,
"x" : -148,
"y" : -62
},
"node" : "Shape"
},
{
"fill" : {
"type" : "Color",
"val" : 6710886
},
"form" : {
"segments" : [
{
"data" : [
152,
-52
],
"type" : "M"
},
{
"data" : [
10,
-10
],
"type" : "l"
},
{
"data" : [
46
],
"type" : "v"
},
{
"data" : [
-311
],
"type" : "h"
},
{
"data" : [
10,
-10
],
"type" : "l"
},
{
"data" : [
],
"type" : "z"
}
],
"type" : "Path"
},
"node" : "Shape"
},
{
"fill" : {
"type" : "Color",
"val" : 12632256
},
"form" : {
"h" : 37,
"type" : "Rect",
"w" : 302,
"x" : -144,
"y" : -58
},
"node" : "Shape"
},
{
"align" : "min",
"baseline" : "bottom",
"fill" : {
"type" : "Color",
"val" : 0
},
"font" : {
"name" : "SVGFreeSansASCII,sans-serif",
"size" : 20,
"weight" : "bold"
},
"node" : "Text",
"place" : "1, 0, 0, 1, -141, -32",
"text" : "File"
},
{
"align" : "min",
"baseline" : "bottom",
"fill" : {
"type" : "Color",
"val" : 0
},
"font" : {
"name" : "SVGFreeSansASCII,sans-serif",
"size" : 20,
"weight" : "bold"
},
"node" : "Text",
"place" : "1, 0, 0, 1, -90, -32",
"text" : "Edit"
}
],
"node" : "Group"
},
{
"contents" : [
{
"fill" : {
"type" : "Color",
"val" : 13421772
},
"form" : {
"h" : 42,
"type" : "Rect",
"w" : 311,
"x" : -149,
"y" : -106
},
"node" : "Shape",
"stroke" : {
"cap" : "butt",
"dashes" : [
],
"fill" : {
"type" : "Color",
"val" : 16777215
},
"join" : "miter",
"width" : 4
}
},
{
"align" : "mid",
"baseline" : "bottom",
"fill" : {
"type" : "Color",
"val" : 0
},
"font" : {
"name" : "SVGFreeSansASCII,sans-serif",
"size" : 24,
"weight" : "bold"
},
"node" : "Text",
"place" : "1, 0, 0, 1, 5, -78",
"text" : "Lorem"
},
{
"contents" : [
{
"fill" : {
"type" : "Color",
"val" : 12632256
},
"form" : {
"rect" : {
"h" : 26,
"type" : "Rect",
"w" : 26,
"x" : 120,
"y" : -99
},
"rx" : 8,
"ry" : 8,
"type" : "RoundRect"
},
"node" : "Shape"
},
{
"fill" : {
"type" : "Color",
"val" : 13421772
},
"form" : {
"rect" : {
"h" : 24,
"type" : "Rect",
"w" : 24,
"x" : 120,
"y" : -99
},
"rx" : 8,
"ry" : 8,
"type" : "RoundRect"
},
"node" : "Shape"
},
{
"fill" : {
"type" : "Color",
"val" : 8947848
},
"form" : {
"rect" : {
"h" : 24,
"type" : "Rect",
"w" : 24,
"x" : 122,
"y" : -97
},
"rx" : 8,
"ry" : 8,
"type" : "RoundRect"
},
"node" : "Shape"
},
{
"fill" : {
"type" : "Color",
"val" : 12632256
},
"form" : {
"rect" : {
"h" : 22,
"type" : "Rect",
"w" : 22,
"x" : 122,
"y" : -97
},
"rx" : 8,
"ry" : 8,
"type" : "RoundRect"
},
"node" : "Shape"
}
],
"node" : "Group"
}
],
"node" : "Group"
}
],
"node" : "Group",
"place" : "1, 0, 0, 1, 240, 180"
}
],
"node" : "Group"
},
{
"contents" : [
{
"align" : "min",
"baseline" : "bottom",
"fill" : {
"type" : "Color",
"val" : 0
},
"font" : {
"name" : "SVGFreeSansASCII,sans-serif",
"size" : 32,
"weight" : "normal"
},
"node" : "Text",
"place" : "1, 0, 0, 1, 10, 340",
"text" : "$Revision: 1.7 $"
}
],
"node" : "Group"
},
{
"form" : {
"h" : 358,
"type" : "Rect",
"w" : 478,
"x" : 1,
"y" : 1
},
"node" : "Shape",
"stroke" : {
"cap" : "butt",
"dashes" : [
],
"fill" : {
"type" : "Color",
"val" : 0
},
"join" : "miter",
"width" : 1
}
}
],
"layout" : {
"scalingMode" : "meet",
"svgSize" : {
"height" : "100.0%",
"width" : "100.0%"
},
"viewBox" : {
"h" : 360,
"type" : "Rect",
"w" : 480,
"x" : 0,
"y" : 0
},
"xAligningMode" : "mid",
"yAligningMode" : "mid"
},
"node" : "Canvas"
}

View File

@ -0,0 +1,96 @@
<svg version="1.1" baseProfile="tiny" id="svg-root"
width="100%" height="100%" viewBox="0 0 480 360"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!--======================================================================-->
<!--= SVG 1.1 2nd Edition Test Case =-->
<!--======================================================================-->
<!--= Copyright 2009 World Wide Web Consortium, (Massachusetts =-->
<!--= Institute of Technology, European Research Consortium for =-->
<!--= Informatics and Mathematics (ERCIM), Keio University). =-->
<!--= All Rights Reserved. =-->
<!--= See http://www.w3.org/Consortium/Legal/. =-->
<!--======================================================================-->
<d:SVGTestCase xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/"
template-version="1.4" reviewer="[reviewer]" author="CL" status="accepted"
version="$Revision: 1.7 $" testname="$RCSfile: color-prop-04-t.svg,v $">
<d:testDescription xmlns="http://www.w3.org/1999/xhtml" href="http://www.w3.org/TR/SVG11/color.html#ColorProperty">
<p>
This tests the 'system' colors.
</p>
</d:testDescription>
<d:operatorScript xmlns="http://www.w3.org/1999/xhtml">
<p>Run the test. No interaction required.</p>
</d:operatorScript>
<d:passCriteria xmlns="http://www.w3.org/1999/xhtml">
<p>
This test has no specific pass criteria, except that no error must be indicated.
</p>
<p>
The colors on your screen might not match the reference
image at all, but they should at minimum be legible and should
preferably resemble the colors used on menus and other user interface
elements on your computer, pda or phone.
</p>
</d:passCriteria>
</d:SVGTestCase>
<title id="test-title">$RCSfile: color-prop-04-t.svg,v $</title>
<defs>
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F">
<font-face-src>
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/>
</font-face-src>
</font-face>
</defs>
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
<g id="Scene_1" transform="translate(240, 180)">
<rect x="-230" y="-170" width="460" height="300" fill="Background"/>
<rect x="-220" y="-160" width="440" height="280" fill="AppWorkspace"/>
<rect x="-152" y="-108" width="317" height="221" fill="Window"/>
<rect x="-152" y="-108" width="317" height="221" fill="none" stroke-width="3" stroke="WindowFrame"/>
<g id="contents" font-size="12" fill="WindowText">
<text x="-148" y="0">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. </text>
<text x="-148" y="20">Vestibulum pulvinar. Duis laoreet, nunc vitae facilisis </text>
<text x="-148" y="40">tristique, pede sem iaculis mi, non consectetuer lorem </text>
<text x="-148" y="60">libero et est. Donec imperdiet purus sed odio. Duis </text>
<text x="-148" y="80">venenatis tortor eu lectus. Suspendisse sed metus at </text>
<text x="-148" y="100">metus viverra ultricies. Mauris porttitor, justo a vulputate</text>
</g>
<g id="dropdown" transform="translate(2,0)">
<rect x="-150" y="-107" width="118" height="190" fill="ThreeDFace" id="drop-bg"/>
<rect x="-143" y="0" width="102" height="34" fill="Menu"/>
<text x="-138" y="24" font-size="20" font-weight="bold" fill="MenuText">Load</text>
<rect x="-143" y="40" width="102" height="34" fill="Menu"/>
<text x="-138" y="64" font-size="20" font-weight="bold" fill="MenuText">Save</text>
<path d="M-149 83 h114 v-94" stroke-width="4" stroke="ThreeDDarkShadow" fill="none"/>
<path d="M-149 83 v-94 h114" stroke-width="4" stroke="ThreeDLightShadow" fill="none"/>
</g>
<g id="menubar">
<rect x="-148" y="-62" width="310" height="46" fill="ThreeDLightShadow"/>
<path d="M152 -52 l 10 -10 v 46 h -311 l10-10 z" fill="ThreeDDarkShadow"/>
<rect x="-144" y="-58" width="302" height="37" fill="ThreeDFace"/>
<text x="-141" y="-32" font-size="20" font-weight="bold" fill="HighlightText">File</text>
<text x="-90" y="-32" font-size="20" font-weight="bold" fill="MenuText">Edit</text>
</g>
<g id="windowdecoration">
<rect x="-149" y="-106" width="311" height="42" fill="ActiveCaption" stroke-width="4" stroke="ActiveBorder" id="windowbar"/>
<text x="5" y="-78" text-anchor="middle" font-size="24" font-weight="bold" fill="CaptionText">Lorem</text>
<g id="button">
<rect x="120" y="-99" rx="8" width="26" height="26" fill="ButtonFace"/>
<rect x="120" y="-99" rx="8" width="24" height="24" fill="ButtonHighlight"/>
<rect x="122" y="-97" rx="8" width="24" height="24" fill="ButtonShadow"/>
<rect x="122" y="-97" rx="8" width="22" height="22" fill="ButtonFace"/>
</g>
</g>
</g>
</g>
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.7 $</text>
</g>
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/>
<!-- comment out this watermark once the test is approved -->
<!--<g id="draft-watermark">
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
</g>-->
</svg>

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -292,7 +292,49 @@ open class SVGConstants {
"yellow": 0xffff00,
"yellowgreen": 0x9acd32
]
#if os(iOS)
public static let systemColorList = [
"AppWorkspace": 0xffffff,
"ActiveBorder": 0xffffff,
"ActiveCaption": 0xcccccc,
"Background": 0x6363ce,
"ButtonFace": 0xc0c0c0,
"ButtonHighlight": 0xcccccc,
"ButtonShadow": 0x888888,
"CaptionText": 0x000000,
"HighlightText": 0x000000,
"Menu": 0xc0c0c0,
"MenuText": 0x000000,
"ThreeDFace": 0xc0c0c0,
"ThreeDDarkShadow": 0x666666,
"ThreeDLightShadow": 0xc0c0c0,
"Window": 0xffffff,
"WindowFrame": 0xcccccc,
"WindowText": 0x000000
]
#elseif os(OSX)
public static let systemColorList = [
"AppWorkspace": 0xaaaaaa,
"ActiveBorder": 0x992a6ccd,
"ActiveCaption": 0x242424,
"Background": 0x6363ce,
"ButtonFace": 0xc0c0c0,
"ButtonHighlight": 0xffffff,
"ButtonShadow": 0x8d8d8d,
"CaptionText": 0x000000,
"HighlightText": 0x000000,
"Menu": 0xf6f6f6,
"MenuText": 0xffffff,
"ThreeDFace": 0xc0c0c0,
"ThreeDDarkShadow": 0x000000,
"ThreeDLightShadow": 0xffffff,
"Window": 0xececec,
"WindowFrame": 0xaaaaaa,
"WindowText": 0x242424
]
#endif
public static func valueToColor(_ color: Int) -> String? {
return SVGConstants.colorList.filter { _, v -> Bool in v == color }.map { k, _ -> String in k }.first
}

View File

@ -595,7 +595,7 @@ open class SVGParser {
let red = CGFloat((rgbValue >> 16) & 0xff)
let green = CGFloat((rgbValue >> 08) & 0xff)
let blue = CGFloat((rgbValue >> 00) & 0xff)
return Color.rgba(r: Int(red), g: Int(green), b: Int(blue), a: opacity)
}
@ -608,6 +608,10 @@ open class SVGParser {
let color = Color(val: defaultColor)
return opacity != 1 ? color.with(a: opacity) : color
}
if let systemColor = SVGConstants.systemColorList[colorString] {
let color = Color(val: systemColor)
return opacity != 1 ? color.with(a: opacity) : color
}
if colorString.hasPrefix("rgb") {
let color = parseRGBNotation(colorString: colorString)
return opacity != 1 ? color.with(a: opacity) : color