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

wip on Fix 387 - add "system" color support for SVG parser

This commit is contained in:
Mark Goldin 2019-02-28 18:07:41 +07:00
parent 99c9f79625
commit 9f9821a8ac

View File

@ -595,8 +595,111 @@ 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)
switch cleanedHexString {
case "AppWorkspace":
#if os(iOS)
return Color.white
#elseif os(OSX)
return Color.rgba(r: Int(170), g: Int(170), b: Int(170), a: opacity)
#endif
case "ActiveBorder":
#if os(iOS)
return Color.white
#elseif os(OSX)
return Color.rgba(r: Int(42), g: Int(108), b: Int(205), a: 0.36)
#endif
case "ActiveCaption":
#if os(iOS)
return Color.rgba(r: Int(204), g: Int(204), b: Int(204), a: opacity)
#elseif os(OSX)
return Color.rgba(r: Int(36), g: Int(36), b: Int(36), a: opacity)
#endif
case "Background":
return Color.rgba(r: Int(99), g: Int(99), b: Int(206), a: opacity)
case "ButtonFace":
return Color.silver
case "ButtonHighlight":
#if os(iOS)
return Color.rgba(r: Int(204), g: Int(204), b: Int(204), a: opacity)
#elseif os(OSX)
return Color.white
#endif
case "ButtonShadow":
#if os(iOS)
return Color.rgba(r: Int(136), g: Int(136), b: Int(136), a: opacity)
#elseif os(OSX)
return Color.rgba(r: Int(141), g: Int(141), b: Int(141), a: opacity)
#endif
case "CaptionText":
return Color.black
case "HighlightText":
return Color.black
case "Menu":
#if os(iOS)
return Color.silver
#elseif os(OSX)
return Color.rgba(r: Int(246), g: Int(246), b: Int(246), a: opacity)
#endif
case "MenuText":
#if os(iOS)
return Color.black
#elseif os(OSX)
return Color.white
#endif
case "ThreeDFace":
return Color.silver
case "ThreeDDarkShadow":
#if os(iOS)
return Color.rgba(r: Int(102), g: Int(102), b: Int(102), a: opacity)
#elseif os(OSX)
return Color.black
#endif
case "ThreeDLightShadow":
#if os(iOS)
return Color.silver
#elseif os(OSX)
return Color.white
#endif
case "Window":
#if os(iOS)
return Color.white
#elseif os(OSX)
return Color.rgba(r: Int(236), g: Int(236), b: Int(236), a: opacity)
#endif
case "WindowFrame":
#if os(iOS)
return Color.rgba(r: Int(204), g: Int(204), b: Int(204), a: opacity)
#elseif os(OSX)
return Color.rgba(r: Int(170), g: Int(170), b: Int(170), a: opacity)
#endif
case "WindowText":
#if os(iOS)
return Color.black
#elseif os(OSX)
return Color.rgba(r: Int(36), g: Int(36), b: Int(36), a: opacity)
#endif
default:
return Color.rgba(r: Int(red), g: Int(green), b: Int(blue), a: opacity)
}
}
fileprivate func createColor(_ colorString: String, opacity: Double = 1) -> Color? {