0001    //
0002    //  XcodeColorsSupport.swift
0003    //  Rainbow
0004    //
0005    //  Created by Wei Wang on 15/12/23.
0006    //
0007    //  Copyright (c) 2015 Wei Wang <onevcat@gmail.com>
0008    //
0009    //  Permission is hereby granted, free of charge, to any person obtaining a copy
0010    //  of this software and associated documentation files (the "Software"), to deal
0011    //  in the Software without restriction, including without limitation the rights
0012    //  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
0013    //  copies of the Software, and to permit persons to whom the Software is
0014    //  furnished to do so, subject to the following conditions:
0015    //
0016    //  The above copyright notice and this permission notice shall be included in
0017    //  all copies or substantial portions of the Software.
0018    //
0019    //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0020    //  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0021    //  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0022    //  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0023    //  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
0024    //  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
0025    //  THE SOFTWARE.
0026    
0027    protocol XcodeColorsConvertible
XcodeColorsSupport.swift:34
extension Color: XcodeColorsConvertible {
XcodeColorsSupport.swift:80
extension BackgroundColor: XcodeColorsConvertible {
{ 0028 var xcodeColorsDescription: String { get } 0029 init?(xcodeColorsDescription string: String) 0030 } 0031 0032 // MARK: - XcodeColorsConvertible 0033 // Supports XcodeColors format of mode string. 0034 extension Color: XcodeColorsConvertible { 0035 var xcodeColorsDescription
StringGenerator.swift:59
            result += "\(ControlCode.CSI)\(color.xcodeColorsDescription);"
XcodeColorsSupport.swift:59
        case Color.Black.xcodeColorsDescription: self = .Black
XcodeColorsSupport.swift:60
        case Color.Red.xcodeColorsDescription: self = .Red
XcodeColorsSupport.swift:61
        case Color.Green.xcodeColorsDescription: self = .Green
XcodeColorsSupport.swift:62
        case Color.Yellow.xcodeColorsDescription: self = .Yellow
XcodeColorsSupport.swift:63
        case Color.Blue.xcodeColorsDescription: self = .Blue
XcodeColorsSupport.swift:64
        case Color.Magenta.xcodeColorsDescription: self = .Magenta
XcodeColorsSupport.swift:65
        case Color.Cyan.xcodeColorsDescription: self = .Cyan
XcodeColorsSupport.swift:66
        case Color.White.xcodeColorsDescription: self = .White
XcodeColorsSupport.swift:67
        case Color.LightBlack.xcodeColorsDescription: self = .LightBlack
XcodeColorsSupport.swift:68
        case Color.LightRed.xcodeColorsDescription: self = .LightRed
XcodeColorsSupport.swift:69
        case Color.LightGreen.xcodeColorsDescription: self = .LightGreen
XcodeColorsSupport.swift:70
        case Color.LightYellow.xcodeColorsDescription: self = .LightYellow
XcodeColorsSupport.swift:71
        case Color.LightBlue.xcodeColorsDescription: self = .LightBlue
XcodeColorsSupport.swift:72
        case Color.LightMagenta.xcodeColorsDescription: self = .LightMagenta
XcodeColorsSupport.swift:73
        case Color.LightCyan.xcodeColorsDescription: self = .LightCyan
XcodeColorsSupport.swift:74
        case Color.LightWhite.xcodeColorsDescription: self = .LightWhite
: String { 0036 switch self { 0037 case .Black: return "fg0,0,0" 0038 case .Red: return "fg255,0,0" 0039 case .Green: return "fg0,204,0" 0040 case .Yellow: return "fg255,255,0" 0041 case .Blue: return "fg0,0,255" 0042 case .Magenta: return "fg255,0,255" 0043 case .Cyan: return "fg0,255,255" 0044 case .White: return "fg204,204,204" 0045 case .Default: return "" 0046 case .LightBlack: return "fg128,128,128" 0047 case .LightRed: return "fg255,102,102" 0048 case .LightGreen: return "fg102,255,102" 0049 case .LightYellow: return "fg255,255,102" 0050 case .LightBlue: return "fg102,102,255" 0051 case .LightMagenta: return "fg255,102,255" 0052 case .LightCyan: return "fg102,255,255" 0053 case .LightWhite: return "fg255,255,255" 0054 } 0055 } 0056 0057 init
CodesParser.swift:64
            if let c = Color(xcodeColorsDescription: code) {
?(xcodeColorsDescription string: String) { 0058 switch string { 0059 case Color.Black.xcodeColorsDescription: self = .Black 0060 case Color.Red.xcodeColorsDescription: self = .Red 0061 case Color.Green.xcodeColorsDescription: self = .Green 0062 case Color.Yellow.xcodeColorsDescription: self = .Yellow 0063 case Color.Blue.xcodeColorsDescription: self = .Blue 0064 case Color.Magenta.xcodeColorsDescription: self = .Magenta 0065 case Color.Cyan.xcodeColorsDescription: self = .Cyan 0066 case Color.White.xcodeColorsDescription: self = .White 0067 case Color.LightBlack.xcodeColorsDescription: self = .LightBlack 0068 case Color.LightRed.xcodeColorsDescription: self = .LightRed 0069 case Color.LightGreen.xcodeColorsDescription: self = .LightGreen 0070 case Color.LightYellow.xcodeColorsDescription: self = .LightYellow 0071 case Color.LightBlue.xcodeColorsDescription: self = .LightBlue 0072 case Color.LightMagenta.xcodeColorsDescription: self = .LightMagenta 0073 case Color.LightCyan.xcodeColorsDescription: self = .LightCyan 0074 case Color.LightWhite.xcodeColorsDescription: self = .LightWhite 0075 default: return nil 0076 } 0077 } 0078 } 0079 0080 extension BackgroundColor: XcodeColorsConvertible { 0081 var xcodeColorsDescription
StringGenerator.swift:64
            result += "\(ControlCode.CSI)\(backgroundColor.xcodeColorsDescription);"
XcodeColorsSupport.swift:97
        case BackgroundColor.Black.xcodeColorsDescription: self = .Black
XcodeColorsSupport.swift:98
        case BackgroundColor.Red.xcodeColorsDescription: self = .Red
XcodeColorsSupport.swift:99
        case BackgroundColor.Green.xcodeColorsDescription: self = .Green
XcodeColorsSupport.swift:100
        case BackgroundColor.Yellow.xcodeColorsDescription: self = .Yellow
XcodeColorsSupport.swift:101
        case BackgroundColor.Blue.xcodeColorsDescription: self = .Blue
XcodeColorsSupport.swift:102
        case BackgroundColor.Magenta.xcodeColorsDescription: self = .Magenta
XcodeColorsSupport.swift:103
        case BackgroundColor.Cyan.xcodeColorsDescription: self = .Cyan
XcodeColorsSupport.swift:104
        case BackgroundColor.White.xcodeColorsDescription: self = .White
: String { 0082 switch self { 0083 case .Black: return "bg0,0,0" 0084 case .Red: return "bg255,0,0" 0085 case .Green: return "bg0,204,0" 0086 case .Yellow: return "bg255,255,0" 0087 case .Blue: return "bg0,0,255" 0088 case .Magenta: return "bg255,0,255" 0089 case .Cyan: return "bg0,255,255" 0090 case .White: return "bg204,204,204" 0091 case .Default: return "" 0092 } 0093 } 0094 0095 init
CodesParser.swift:66
            } else if let bg = BackgroundColor(xcodeColorsDescription: code) {
?(xcodeColorsDescription string: String) { 0096 switch string { 0097 case BackgroundColor.Black.xcodeColorsDescription: self = .Black 0098 case BackgroundColor.Red.xcodeColorsDescription: self = .Red 0099 case BackgroundColor.Green.xcodeColorsDescription: self = .Green 0100 case BackgroundColor.Yellow.xcodeColorsDescription: self = .Yellow 0101 case BackgroundColor.Blue.xcodeColorsDescription: self = .Blue 0102 case BackgroundColor.Magenta.xcodeColorsDescription: self = .Magenta 0103 case BackgroundColor.Cyan.xcodeColorsDescription: self = .Cyan 0104 case BackgroundColor.White.xcodeColorsDescription: self = .White 0105 default: return nil 0106 } 0107 } 0108 }