0001 // 0002 // Style.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 styles to use in `Rainbow`. 0028 public enum Style: UInt8, ModeCode { 0029 case Default = 0 0030 case Bold
CodesParser.swift:30 (color: Color?, backgroundColor: BackgroundColor?, styles: [Style]?)CodesParser.swift:35 func parseModeCodes(codes: [UInt8]) -> (color: Color?, backgroundColor: BackgroundColor?, styles: [Style]?) {CodesParser.swift:38 var styles: [Style]? = nilCodesParser.swift:45 } else if let style = Style(rawValue: code) {CodesParser.swift:59 func parseModeCodes(codes: [String]) -> (color: Color?, backgroundColor: BackgroundColor?, styles: [Style]?) {Rainbow.swift:50 -> (color: Color?, backgroundColor: BackgroundColor?, styles: [Style]?, text: String)Rainbow.swift:67 styles: [Style]?,String+Rainbow.swift:89 public func stringByApplyingStyle(style: Style) -> String {String+Rainbow.swift:100 public func stringByRemovingStyle(style: Style) -> String {String+Rainbow.swift:166 var styles = [Style]()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 {= 1 0031 case Dim
String+Rainbow.swift:248 public var bold: String { return stringByApplyingStyle(.Bold) }= 2 0032 case Italic
String+Rainbow.swift:250 public var dim: String { return stringByApplyingStyle(.Dim) }= 3 0033 case Underline
String+Rainbow.swift:252 public var italic: String { return stringByApplyingStyle(.Italic) }= 4 0034 case Blink
String+Rainbow.swift:254 public var underline: String { return stringByApplyingStyle(.Underline) }= 5 0035 case Swap
String+Rainbow.swift:256 public var blink: String { return stringByApplyingStyle(.Blink) }= 7 0036 0037 public var value
String+Rainbow.swift:258 public var swap: String { return stringByApplyingStyle(.Swap) }: UInt8 { 0038 return rawValue 0039 } 0040 } 0041
StringGenerator.swift:41 codes += styles.map{$0.value}