Skip to content

Commit

Permalink
Merge branch 'release/2.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
1024jp committed Nov 15, 2017
2 parents 73ea48e + 8939eb1 commit c470ad6
Show file tree
Hide file tree
Showing 11 changed files with 275 additions and 178 deletions.
40 changes: 40 additions & 0 deletions .swiftlint.yml
@@ -0,0 +1,40 @@
opt_in_rules:
- attributes
- closure_end_indentation
- closure_spacing
- conditional_returns_on_newline
- empty_count
- explicit_init
- fatal_error_message
- first_where
- force_unwrapping
- implicit_return
- implicitly_unwrapped_optional
- let_var_whitespace
- multiline_parameters
- nimble_operator
- object_literal
- operator_usage_whitespace
- private_outlet
- redundant_nil_coalescing
- strict_fileprivate
- switch_case_on_newline
- unneeded_parentheses_in_closure_argument
- vertical_parameter_alignment_on_call

disabled_rules:
- force_unwrapping
- force_try

trailing_comma:
mandatory_comma: true

trailing_whitespace:
ignores_empty_lines: true

vertical_whitespace:
max_empty_lines: 3

line_length: 500
function_body_length: 80
cyclomatic_complexity: 11
3 changes: 3 additions & 0 deletions .travis.yml
Expand Up @@ -2,7 +2,10 @@ language: objective-c
osx_image: xcode9.1

script:
- swiftlint
- swift test
- set -o pipefail
- xcodebuild -scheme ColorCode test | xcpretty
- pod lib lint --quick
after_success:
- bash <(curl -s https://codecov.io/bash)
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,13 @@
CHANGELOG
===========

2.1.2
-----------
### mod
- Tweak code
### fix
- Fix swift package manager

2.1.0
-----------
### mod
Expand Down
2 changes: 1 addition & 1 deletion ColorCode.xcodeproj/ColorCode_Info.plist
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.1.1</string>
<string>2.1.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
25 changes: 24 additions & 1 deletion ColorCode.xcodeproj/project.pbxproj
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
2AC3E84E1FBBD7920082CA63 /* ColorKeywordMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AC3E84D1FBBD7920082CA63 /* ColorKeywordMap.swift */; };
OBJ_22 /* NSColor+ColorCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_9 /* NSColor+ColorCode.swift */; };
OBJ_23 /* NSColor+HSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_10 /* NSColor+HSL.swift */; };
OBJ_30 /* ColorCodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_13 /* ColorCodeTests.swift */; };
Expand All @@ -24,6 +25,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
2AC3E84D1FBBD7920082CA63 /* ColorKeywordMap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorKeywordMap.swift; sourceTree = "<group>"; };
OBJ_10 /* NSColor+HSL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSColor+HSL.swift"; sourceTree = "<group>"; };
OBJ_13 /* ColorCodeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ColorCodeTests.swift; path = ColorCodeTests/ColorCodeTests.swift; sourceTree = "<group>"; };
OBJ_15 /* ColorCode.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = ColorCode.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -76,8 +78,10 @@
children = (
OBJ_9 /* NSColor+ColorCode.swift */,
OBJ_10 /* NSColor+HSL.swift */,
2AC3E84D1FBBD7920082CA63 /* ColorKeywordMap.swift */,
);
path = Sources;
name = Sources;
path = Sources/ColorCode;
sourceTree = "<group>";
};
/* End PBXGroup section */
Expand All @@ -87,6 +91,7 @@
isa = PBXNativeTarget;
buildConfigurationList = OBJ_18 /* Build configuration list for PBXNativeTarget "ColorCode" */;
buildPhases = (
2A7DC7B91FBBCA6A00539D90 /* Lint Swift Code */,
OBJ_21 /* Sources */,
);
buildRules = (
Expand Down Expand Up @@ -149,12 +154,30 @@
};
/* End PBXProject section */

/* Begin PBXShellScriptBuildPhase section */
2A7DC7B91FBBCA6A00539D90 /* Lint Swift Code */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Lint Swift Code";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"SwiftLint does not exist, download from https://github.com/realm/SwiftLint\"\nfi";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
OBJ_21 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 0;
files = (
OBJ_22 /* NSColor+ColorCode.swift in Sources */,
2AC3E84E1FBBD7920082CA63 /* ColorKeywordMap.swift in Sources */,
OBJ_23 /* NSColor+HSL.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
8 changes: 7 additions & 1 deletion Package.swift
@@ -1,5 +1,11 @@
// swift-tools-version:4.0

import PackageDescription

let package = Package(
name: "ColorCode"
name: "ColorCode",
targets: [
.target(name: "ColorCode"),
.testTarget(name: "ColorCodeTests", dependencies: ["ColorCode"]),
]
)
175 changes: 175 additions & 0 deletions Sources/ColorCode/ColorKeywordMap.swift
@@ -0,0 +1,175 @@
//
// ColorKeywordMap.swift
//
// Created by 1024jp on 2017-11-15.

/*
The MIT License (MIT)
Copyright (c) 2014-2016 1024jp
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

let colorKeywordMap: [String: Int] = [
// CSS2.1
"Black": 0x000000,
"Navy": 0x000080,
"Blue": 0x0000FF,
"Green": 0x008000,
"Lime": 0x00FF00,
"Aqua": 0x00FFFF,
"Teal": 0x008080,
"Maroon": 0x800000,
"Purple": 0x800080,
"Olive": 0x808000,
"Gray": 0x808080,
"Silver": 0xC0C0C0,
"Red": 0xFF0000,
"Fuchsia": 0xFF00FF,
"Orange": 0xFFA500,
"Yellow": 0xFFFF00,
"White": 0xFFFFFF,

// CSS3
"DarkBlue": 0x00008B,
"MediumBlue": 0x0000CD,
"DarkGreen": 0x006400,
"DarkCyan": 0x008B8B,
"DeepSkyBlue": 0x00BFFF,
"DarkTurquoise": 0x00CED1,
"MediumSpringGreen": 0x00FA9A,
"SpringGreen": 0x00FF7F,
"Cyan": 0x00FFFF,
"MidnightBlue": 0x191970,
"DodgerBlue": 0x1E90FF,
"LightSeaGreen": 0x20B2AA,
"ForestGreen": 0x228B22,
"SeaGreen": 0x2E8B57,
"DarkSlateGray": 0x2F4F4F,
"LimeGreen": 0x32CD32,
"MediumSeaGreen": 0x3CB371,
"Turquoise": 0x40E0D0,
"RoyalBlue": 0x4169E1,
"SteelBlue": 0x4682B4,
"DarkSlateBlue": 0x483D8B,
"MediumTurquoise": 0x48D1CC,
"Indigo ": 0x4B0082,
"DarkOliveGreen": 0x556B2F,
"CadetBlue": 0x5F9EA0,
"CornflowerBlue": 0x6495ED,
"RebeccaPurple": 0x663399,
"MediumAquaMarine": 0x66CDAA,
"DimGray": 0x696969,
"SlateBlue": 0x6A5ACD,
"OliveDrab": 0x6B8E23,
"SlateGray": 0x708090,
"LightSlateGray": 0x778899,
"MediumSlateBlue": 0x7B68EE,
"LawnGreen": 0x7CFC00,
"Chartreuse": 0x7FFF00,
"Aquamarine": 0x7FFFD4,
"SkyBlue": 0x87CEEB,
"LightSkyBlue": 0x87CEFA,
"BlueViolet": 0x8A2BE2,
"DarkRed": 0x8B0000,
"DarkMagenta": 0x8B008B,
"SaddleBrown": 0x8B4513,
"DarkSeaGreen": 0x8FBC8F,
"LightGreen": 0x90EE90,
"MediumPurple": 0x9370DB,
"DarkViolet": 0x9400D3,
"PaleGreen": 0x98FB98,
"DarkOrchid": 0x9932CC,
"YellowGreen": 0x9ACD32,
"Sienna": 0xA0522D,
"Brown": 0xA52A2A,
"DarkGray": 0xA9A9A9,
"LightBlue": 0xADD8E6,
"GreenYellow": 0xADFF2F,
"PaleTurquoise": 0xAFEEEE,
"LightSteelBlue": 0xB0C4DE,
"PowderBlue": 0xB0E0E6,
"FireBrick": 0xB22222,
"DarkGoldenRod": 0xB8860B,
"MediumOrchid": 0xBA55D3,
"RosyBrown": 0xBC8F8F,
"DarkKhaki": 0xBDB76B,
"MediumVioletRed": 0xC71585,
"IndianRed ": 0xCD5C5C,
"Peru": 0xCD853F,
"Chocolate": 0xD2691E,
"Tan": 0xD2B48C,
"LightGray": 0xD3D3D3,
"Thistle": 0xD8BFD8,
"Orchid": 0xDA70D6,
"GoldenRod": 0xDAA520,
"PaleVioletRed": 0xDB7093,
"Crimson": 0xDC143C,
"Gainsboro": 0xDCDCDC,
"Plum": 0xDDA0DD,
"BurlyWood": 0xDEB887,
"LightCyan": 0xE0FFFF,
"Lavender": 0xE6E6FA,
"DarkSalmon": 0xE9967A,
"Violet": 0xEE82EE,
"PaleGoldenRod": 0xEEE8AA,
"LightCoral": 0xF08080,
"Khaki": 0xF0E68C,
"AliceBlue": 0xF0F8FF,
"HoneyDew": 0xF0FFF0,
"Azure": 0xF0FFFF,
"SandyBrown": 0xF4A460,
"Wheat": 0xF5DEB3,
"Beige": 0xF5F5DC,
"WhiteSmoke": 0xF5F5F5,
"MintCream": 0xF5FFFA,
"GhostWhite": 0xF8F8FF,
"Salmon": 0xFA8072,
"AntiqueWhite": 0xFAEBD7,
"Linen": 0xFAF0E6,
"LightGoldenRodYellow": 0xFAFAD2,
"OldLace": 0xFDF5E6,
"Magenta": 0xFF00FF,
"DeepPink": 0xFF1493,
"OrangeRed": 0xFF4500,
"Tomato": 0xFF6347,
"HotPink": 0xFF69B4,
"Coral": 0xFF7F50,
"DarkOrange": 0xFF8C00,
"LightSalmon": 0xFFA07A,
"LightPink": 0xFFB6C1,
"Pink": 0xFFC0CB,
"Gold": 0xFFD700,
"PeachPuff": 0xFFDAB9,
"NavajoWhite": 0xFFDEAD,
"Moccasin": 0xFFE4B5,
"Bisque": 0xFFE4C4,
"MistyRose": 0xFFE4E1,
"BlanchedAlmond": 0xFFEBCD,
"PapayaWhip": 0xFFEFD5,
"LavenderBlush": 0xFFF0F5,
"SeaShell": 0xFFF5EE,
"Cornsilk": 0xFFF8DC,
"LemonChiffon": 0xFFFACD,
"FloralWhite": 0xFFFAF0,
"Snow": 0xFFFAFA,
"LightYellow": 0xFFFFE0,
"Ivory": 0xFFFFF0,
]

0 comments on commit c470ad6

Please sign in to comment.