0001 // 0002 // Color.swift 0003 // Rainbow 0004 // 0005 // Created by Wei Wang on 15/12/22. 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 /// Valid text colors to use in `Rainbow`. 0028 public enum Color: UInt8, ModeCode { 0029 case Black
CodesParser.swift:30 (color: Color?, backgroundColor: BackgroundColor?, styles: [Style]?)CodesParser.swift:35 func parseModeCodes(codes: [UInt8]) -> (color: Color?, backgroundColor: BackgroundColor?, styles: [Style]?) {CodesParser.swift:36 var color: Color? = nilCodesParser.swift:41 if let c = Color(rawValue: code) {CodesParser.swift:59 func parseModeCodes(codes: [String]) -> (color: Color?, backgroundColor: BackgroundColor?, styles: [Style]?) {CodesParser.swift:60 var color: Color? = nilCodesParser.swift:64 if let c = Color(xcodeColorsDescription: code) {Rainbow.swift:50 -> (color: Color?, backgroundColor: BackgroundColor?, styles: [Style]?, text: String)Rainbow.swift:65 static func generateStringForColor(color: Color?,String+Rainbow.swift:36 public func stringByApplyingColor(color: Color) -> String {StringGenerator.swift:28 func generateStringColor(color: Color?, backgroundColor: BackgroundColor?, styles: [Style]?, text: String) -> StringStringGenerator.swift:32 func generateStringColor(color: Color?, backgroundColor: BackgroundColor?, styles: [Style]?, text: String) -> String {StringGenerator.swift:53 func generateStringColor(color: Color?, backgroundColor: BackgroundColor?, styles: [Style]?, text: String) -> String {XcodeColorsSupport.swift:34 extension Color: XcodeColorsConvertible {XcodeColorsSupport.swift:59 case Color.Black.xcodeColorsDescription: self = .BlackXcodeColorsSupport.swift:60 case Color.Red.xcodeColorsDescription: self = .RedXcodeColorsSupport.swift:61 case Color.Green.xcodeColorsDescription: self = .GreenXcodeColorsSupport.swift:62 case Color.Yellow.xcodeColorsDescription: self = .YellowXcodeColorsSupport.swift:63 case Color.Blue.xcodeColorsDescription: self = .BlueXcodeColorsSupport.swift:64 case Color.Magenta.xcodeColorsDescription: self = .MagentaXcodeColorsSupport.swift:65 case Color.Cyan.xcodeColorsDescription: self = .CyanXcodeColorsSupport.swift:66 case Color.White.xcodeColorsDescription: self = .WhiteXcodeColorsSupport.swift:67 case Color.LightBlack.xcodeColorsDescription: self = .LightBlackXcodeColorsSupport.swift:68 case Color.LightRed.xcodeColorsDescription: self = .LightRedXcodeColorsSupport.swift:69 case Color.LightGreen.xcodeColorsDescription: self = .LightGreenXcodeColorsSupport.swift:70 case Color.LightYellow.xcodeColorsDescription: self = .LightYellowXcodeColorsSupport.swift:71 case Color.LightBlue.xcodeColorsDescription: self = .LightBlueXcodeColorsSupport.swift:72 case Color.LightMagenta.xcodeColorsDescription: self = .LightMagentaXcodeColorsSupport.swift:73 case Color.LightCyan.xcodeColorsDescription: self = .LightCyanXcodeColorsSupport.swift:74 case Color.LightWhite.xcodeColorsDescription: self = .LightWhite= 30 0030 case Red
String+Rainbow.swift:192 public var black: String { return stringByApplyingColor(.Black) }XcodeColorsSupport.swift:37 case .Black: return "fg0,0,0"XcodeColorsSupport.swift:59 case Color.Black.xcodeColorsDescription: self = .BlackXcodeColorsSupport.swift:59 case Color.Black.xcodeColorsDescription: self = .Black0031 case Green
String+Rainbow.swift:194 public var red: String { return stringByApplyingColor(.Red) }XcodeColorsSupport.swift:38 case .Red: return "fg255,0,0"XcodeColorsSupport.swift:60 case Color.Red.xcodeColorsDescription: self = .RedXcodeColorsSupport.swift:60 case Color.Red.xcodeColorsDescription: self = .Red0032 case Yellow
String+Rainbow.swift:196 public var green: String { return stringByApplyingColor(.Green) }XcodeColorsSupport.swift:39 case .Green: return "fg0,204,0"XcodeColorsSupport.swift:61 case Color.Green.xcodeColorsDescription: self = .GreenXcodeColorsSupport.swift:61 case Color.Green.xcodeColorsDescription: self = .Green0033 case Blue
String+Rainbow.swift:198 public var yellow: String { return stringByApplyingColor(.Yellow) }XcodeColorsSupport.swift:40 case .Yellow: return "fg255,255,0"XcodeColorsSupport.swift:62 case Color.Yellow.xcodeColorsDescription: self = .YellowXcodeColorsSupport.swift:62 case Color.Yellow.xcodeColorsDescription: self = .Yellow0034 case Magenta
String+Rainbow.swift:200 public var blue: String { return stringByApplyingColor(.Blue) }XcodeColorsSupport.swift:41 case .Blue: return "fg0,0,255"XcodeColorsSupport.swift:63 case Color.Blue.xcodeColorsDescription: self = .BlueXcodeColorsSupport.swift:63 case Color.Blue.xcodeColorsDescription: self = .Blue0035 case Cyan
String+Rainbow.swift:202 public var magenta: String { return stringByApplyingColor(.Magenta) }XcodeColorsSupport.swift:42 case .Magenta: return "fg255,0,255"XcodeColorsSupport.swift:64 case Color.Magenta.xcodeColorsDescription: self = .MagentaXcodeColorsSupport.swift:64 case Color.Magenta.xcodeColorsDescription: self = .Magenta0036 case White
String+Rainbow.swift:204 public var cyan: String { return stringByApplyingColor(.Cyan) }XcodeColorsSupport.swift:43 case .Cyan: return "fg0,255,255"XcodeColorsSupport.swift:65 case Color.Cyan.xcodeColorsDescription: self = .CyanXcodeColorsSupport.swift:65 case Color.Cyan.xcodeColorsDescription: self = .Cyan0037 case Default
String+Rainbow.swift:206 public var white: String { return stringByApplyingColor(.White) }XcodeColorsSupport.swift:44 case .White: return "fg204,204,204"XcodeColorsSupport.swift:66 case Color.White.xcodeColorsDescription: self = .WhiteXcodeColorsSupport.swift:66 case Color.White.xcodeColorsDescription: self = .White= 39 0038 case LightBlack
String+Rainbow.swift:52 return stringByApplyingColor(.Default)StringGenerator.swift:58 if let color = color where color != .Default {XcodeColorsSupport.swift:45 case .Default: return ""= 90 0039 case LightRed
String+Rainbow.swift:208 public var lightBlack: String { return stringByApplyingColor(.LightBlack) }XcodeColorsSupport.swift:46 case .LightBlack: return "fg128,128,128"XcodeColorsSupport.swift:67 case Color.LightBlack.xcodeColorsDescription: self = .LightBlackXcodeColorsSupport.swift:67 case Color.LightBlack.xcodeColorsDescription: self = .LightBlack0040 case LightGreen
String+Rainbow.swift:210 public var lightRed: String { return stringByApplyingColor(.LightRed) }XcodeColorsSupport.swift:47 case .LightRed: return "fg255,102,102"XcodeColorsSupport.swift:68 case Color.LightRed.xcodeColorsDescription: self = .LightRedXcodeColorsSupport.swift:68 case Color.LightRed.xcodeColorsDescription: self = .LightRed0041 case LightYellow
String+Rainbow.swift:212 public var lightGreen: String { return stringByApplyingColor(.LightGreen) }XcodeColorsSupport.swift:48 case .LightGreen: return "fg102,255,102"XcodeColorsSupport.swift:69 case Color.LightGreen.xcodeColorsDescription: self = .LightGreenXcodeColorsSupport.swift:69 case Color.LightGreen.xcodeColorsDescription: self = .LightGreen0042 case LightBlue
String+Rainbow.swift:214 public var lightYellow: String { return stringByApplyingColor(.LightYellow) }XcodeColorsSupport.swift:49 case .LightYellow: return "fg255,255,102"XcodeColorsSupport.swift:70 case Color.LightYellow.xcodeColorsDescription: self = .LightYellowXcodeColorsSupport.swift:70 case Color.LightYellow.xcodeColorsDescription: self = .LightYellow0043 case LightMagenta
String+Rainbow.swift:216 public var lightBlue: String { return stringByApplyingColor(.LightBlue) }XcodeColorsSupport.swift:50 case .LightBlue: return "fg102,102,255"XcodeColorsSupport.swift:71 case Color.LightBlue.xcodeColorsDescription: self = .LightBlueXcodeColorsSupport.swift:71 case Color.LightBlue.xcodeColorsDescription: self = .LightBlue0044 case LightCyan
String+Rainbow.swift:218 public var lightMagenta: String { return stringByApplyingColor(.LightMagenta) }XcodeColorsSupport.swift:51 case .LightMagenta: return "fg255,102,255"XcodeColorsSupport.swift:72 case Color.LightMagenta.xcodeColorsDescription: self = .LightMagentaXcodeColorsSupport.swift:72 case Color.LightMagenta.xcodeColorsDescription: self = .LightMagenta0045 case LightWhite
String+Rainbow.swift:220 public var lightCyan: String { return stringByApplyingColor(.LightCyan) }XcodeColorsSupport.swift:52 case .LightCyan: return "fg102,255,255"XcodeColorsSupport.swift:73 case Color.LightCyan.xcodeColorsDescription: self = .LightCyanXcodeColorsSupport.swift:73 case Color.LightCyan.xcodeColorsDescription: self = .LightCyan0046 0047 public var value
String+Rainbow.swift:222 public var lightWhite: String { return stringByApplyingColor(.LightWhite) }XcodeColorsSupport.swift:53 case .LightWhite: return "fg255,255,255"XcodeColorsSupport.swift:74 case Color.LightWhite.xcodeColorsDescription: self = .LightWhiteXcodeColorsSupport.swift:74 case Color.LightWhite.xcodeColorsDescription: self = .LightWhite: UInt8 { 0048 return rawValue 0049 } 0050 } 0051
StringGenerator.swift:35 codes.append(color.value)