Skip to content

Commit 65ad771

Browse files
committed
Initial commit
0 parents  commit 65ad771

39 files changed

+4168
-0
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
/*.xcodeproj
5+
xcuserdata/
6+
DerivedData/
7+
.swiftpm/config/registries.json
8+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
9+
.netrc
10+
**/zzzTrash

.vscode/launch.json

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
{
2+
"configurations": [
3+
{
4+
"type": "lldb",
5+
"request": "launch",
6+
"name": "Debug swift-colorful",
7+
"program": ".build/debug/swift-colorful",
8+
"args": [],
9+
"cwd": "${workspaceFolder:swift-colorful}",
10+
"preLaunchTask": "swift: Build Debug swift-colorful"
11+
},
12+
{
13+
"type": "lldb",
14+
"request": "launch",
15+
"name": "Release swift-colorful",
16+
"program": ".build/release/swift-colorful",
17+
"args": [],
18+
"cwd": "${workspaceFolder:swift-colorful}",
19+
"preLaunchTask": "swift: Build Release swift-colorful"
20+
},
21+
{
22+
"type": "lldb",
23+
"request": "launch",
24+
"name": "Debug DemoColorBlend-macOS",
25+
"program": ".build/debug/DemoColorBlend-macOS",
26+
"args": [],
27+
"cwd": "${workspaceFolder:swift-colorful}",
28+
"preLaunchTask": "swift: Build Debug DemoColorBlend-macOS"
29+
},
30+
{
31+
"type": "lldb",
32+
"request": "launch",
33+
"name": "Release DemoColorBlend-macOS",
34+
"program": ".build/release/DemoColorBlend-macOS",
35+
"args": [],
36+
"cwd": "${workspaceFolder:swift-colorful}",
37+
"preLaunchTask": "swift: Build Release DemoColorBlend-macOS"
38+
},
39+
{
40+
"type": "lldb",
41+
"request": "launch",
42+
"name": "Debug DemoColorDist-macOS",
43+
"program": ".build/debug/DemoColorDist-macOS",
44+
"args": [],
45+
"cwd": "${workspaceFolder:swift-colorful}",
46+
"preLaunchTask": "swift: Build Debug DemoColorDist-macOS"
47+
},
48+
{
49+
"type": "lldb",
50+
"request": "launch",
51+
"name": "Release DemoColorDist-macOS",
52+
"program": ".build/release/DemoColorDist-macOS",
53+
"args": [],
54+
"cwd": "${workspaceFolder:swift-colorful}",
55+
"preLaunchTask": "swift: Build Release DemoColorDist-macOS"
56+
},
57+
{
58+
"type": "lldb",
59+
"request": "launch",
60+
"name": "Debug DemoShared",
61+
"program": ".build/debug/DemoShared",
62+
"args": [],
63+
"cwd": "${workspaceFolder:swift-colorful}",
64+
"preLaunchTask": "swift: Build Debug DemoShared"
65+
},
66+
{
67+
"type": "lldb",
68+
"request": "launch",
69+
"name": "Release DemoShared",
70+
"program": ".build/release/DemoShared",
71+
"args": [],
72+
"cwd": "${workspaceFolder:swift-colorful}",
73+
"preLaunchTask": "swift: Build Release DemoShared"
74+
},
75+
{
76+
"type": "lldb",
77+
"request": "launch",
78+
"name": "Debug DemoColorGens-macOS",
79+
"program": ".build/debug/DemoColorGens-macOS",
80+
"args": [],
81+
"cwd": "${workspaceFolder:swift-colorful}",
82+
"preLaunchTask": "swift: Build Debug DemoColorGens-macOS"
83+
},
84+
{
85+
"type": "lldb",
86+
"request": "launch",
87+
"name": "Release DemoColorGens-macOS",
88+
"program": ".build/release/DemoColorGens-macOS",
89+
"args": [],
90+
"cwd": "${workspaceFolder:swift-colorful}",
91+
"preLaunchTask": "swift: Build Release DemoColorGens-macOS"
92+
},
93+
{
94+
"type": "lldb",
95+
"request": "launch",
96+
"name": "Debug DemoGradientGen-macOS",
97+
"program": ".build/debug/DemoGradientGen-macOS",
98+
"args": [],
99+
"cwd": "${workspaceFolder:swift-colorful}",
100+
"preLaunchTask": "swift: Build Debug DemoGradientGen-macOS"
101+
},
102+
{
103+
"type": "lldb",
104+
"request": "launch",
105+
"name": "Release DemoGradientGen-macOS",
106+
"program": ".build/release/DemoGradientGen-macOS",
107+
"args": [],
108+
"cwd": "${workspaceFolder:swift-colorful}",
109+
"preLaunchTask": "swift: Build Release DemoGradientGen-macOS"
110+
},
111+
{
112+
"type": "lldb",
113+
"request": "launch",
114+
"name": "Debug DemoPaletteGens-macOS",
115+
"program": ".build/debug/DemoPaletteGens-macOS",
116+
"args": [],
117+
"cwd": "${workspaceFolder:swift-colorful}",
118+
"preLaunchTask": "swift: Build Debug DemoPaletteGens-macOS"
119+
},
120+
{
121+
"type": "lldb",
122+
"request": "launch",
123+
"name": "Release DemoPaletteGens-macOS",
124+
"program": ".build/release/DemoPaletteGens-macOS",
125+
"args": [],
126+
"cwd": "${workspaceFolder:swift-colorful}",
127+
"preLaunchTask": "swift: Build Release DemoPaletteGens-macOS"
128+
},
129+
{
130+
"type": "lldb",
131+
"request": "launch",
132+
"name": "Debug DemoColorSort-macOS",
133+
"program": ".build/debug/DemoColorSort-macOS",
134+
"args": [],
135+
"cwd": "${workspaceFolder:swift-colorful}",
136+
"preLaunchTask": "swift: Build Debug DemoColorSort-macOS"
137+
},
138+
{
139+
"type": "lldb",
140+
"request": "launch",
141+
"name": "Release DemoColorSort-macOS",
142+
"program": ".build/release/DemoColorSort-macOS",
143+
"args": [],
144+
"cwd": "${workspaceFolder:swift-colorful}",
145+
"preLaunchTask": "swift: Build Release DemoColorSort-macOS"
146+
},
147+
{
148+
"type": "lldb",
149+
"request": "launch",
150+
"name": "Debug Benchmark-macOS",
151+
"program": ".build/debug/Benchmark-macOS",
152+
"args": [],
153+
"cwd": "${workspaceFolder:swift-colorful}",
154+
"preLaunchTask": "swift: Build Debug Benchmark-macOS"
155+
},
156+
{
157+
"type": "lldb",
158+
"request": "launch",
159+
"name": "Release Benchmark-macOS",
160+
"program": ".build/release/Benchmark-macOS",
161+
"args": [],
162+
"cwd": "${workspaceFolder:swift-colorful}",
163+
"preLaunchTask": "swift: Build Release Benchmark-macOS"
164+
}
165+
]
166+
}

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Please check original project CHANGELOG first:
2+
https://github.com/lucasb-eyer/go-colorful/blob/master/CHANGELOG.md
3+
4+
# Changelog
5+
All notable changes to this project will be documented in this file.

Doc/LinearRGB Approximations.ipynb

Lines changed: 327 additions & 0 deletions
Large diffs are not rendered by default.

Doc/approx-quality.png

113 KB
Loading

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) 2013 Lucas Beyer
2+
Copyright (c) 2022 Artur Torun (a.k.a. Mojzesh)
3+
4+
Permission is hereby granted, free of charge, to any person obtaining
5+
a copy of this software and associated documentation files (the
6+
"Software"), to deal in the Software without restriction, including
7+
without limitation the rights to use, copy, modify, merge, publish,
8+
distribute, sublicense, and/or sell copies of the Software, and to
9+
permit persons to whom the Software is furnished to do so, subject to
10+
the following conditions:
11+
12+
The above copyright notice and this permission notice shall be
13+
included in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package.swift

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
// swift-tools-version: 5.6
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "swift-colorful",
8+
products: [
9+
.library(name: "Colorful", targets: ["Colorful"])
10+
],
11+
dependencies: [],
12+
targets: [
13+
.target(
14+
name: "Colorful",
15+
dependencies: []),
16+
.testTarget(
17+
name: "ColorfulTests",
18+
dependencies: ["Colorful"],
19+
resources: [.process("Resources/hsluv-snapshot-rev4.json")]),
20+
]
21+
)
22+
23+
//--------------------------------------------
24+
// Demo projects
25+
//--------------------------------------------
26+
#if os(macOS)
27+
//--------------------------------------------
28+
// DemoShared
29+
//--------------------------------------------
30+
package.products.append(.executable(name: "DemoColorBlend-macOS", targets: ["DemoColorBlend"]))
31+
package.targets.append(.target(name: "DemoShared",
32+
dependencies: ["Colorful"],
33+
path: "Sources/Demos/Shared"))
34+
35+
//--------------------------------------------
36+
// DemoColorBlend
37+
//--------------------------------------------
38+
package.targets.append(.executableTarget(name: "DemoColorBlend",
39+
dependencies: ["Colorful", "DemoShared"],
40+
path: "Sources/Demos/ColorBlend",
41+
exclude:["colorblend.png", "invalid.xcf", "invalid.png", "clamped.png", "clamped.xcf"]))
42+
43+
//--------------------------------------------
44+
// DemoColorDist
45+
//--------------------------------------------
46+
package.products.append(.executable(name: "DemoColorDist-macOS", targets: ["DemoColorDist"]))
47+
package.targets.append(.executableTarget(name: "DemoColorDist",
48+
dependencies: ["Colorful"],
49+
path: "Sources/Demos/ColorDist",
50+
exclude:["colordist.png", "colordist.xcf"]))
51+
52+
//--------------------------------------------
53+
// DemoColorGens
54+
//--------------------------------------------
55+
package.products.append(.executable(name: "DemoColorGens-macOS", targets: ["DemoColorGens"]))
56+
package.targets.append(.executableTarget(name: "DemoColorGens",
57+
dependencies: ["Colorful", "DemoShared"],
58+
path: "Sources/Demos/ColorGens",
59+
exclude:["colorgens.png"]))
60+
61+
//--------------------------------------------
62+
// DemoColorSort
63+
//--------------------------------------------
64+
package.products.append(.executable(name: "DemoColorSort-macOS", targets: ["DemoColorSort"]))
65+
package.targets.append(.executableTarget(name: "DemoColorSort",
66+
dependencies: ["Colorful", "DemoShared"],
67+
path: "Sources/Demos/ColorSort",
68+
exclude:["colorsort.png"]))
69+
70+
//--------------------------------------------
71+
// DemoGradientGen
72+
//--------------------------------------------
73+
package.products.append(.executable(name: "DemoGradientGen-macOS", targets: ["DemoGradientGen"]))
74+
package.targets.append(.executableTarget(name: "DemoGradientGen",
75+
dependencies: ["Colorful", "DemoShared"],
76+
path: "Sources/Demos/GradientGen",
77+
exclude:["gradientgen.png"]))
78+
79+
//--------------------------------------------
80+
// DemoPaletteGens
81+
//--------------------------------------------
82+
package.products.append(.executable(name: "DemoPaletteGens-macOS", targets: ["DemoPaletteGens"]))
83+
package.targets.append(.executableTarget(name: "DemoPaletteGens",
84+
dependencies: ["Colorful", "DemoShared"],
85+
path: "Sources/Demos/PaletteGens",
86+
exclude:["palettegens.png"]))
87+
88+
//--------------------------------------------
89+
// Benchmark
90+
//--------------------------------------------
91+
package.products.append(.executable(name: "Benchmark-macOS", targets: ["Benchmark"]))
92+
package.targets.append(.executableTarget(name: "Benchmark",
93+
dependencies: ["Colorful", "DemoShared"],
94+
path: "Sources/Demos/Benchmark"))
95+
#endif

0 commit comments

Comments
 (0)