Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mojzesh committed Jul 15, 2022
0 parents commit 65ad771
Show file tree
Hide file tree
Showing 39 changed files with 4,168 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/
DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
**/zzzTrash
166 changes: 166 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
{
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug swift-colorful",
"program": ".build/debug/swift-colorful",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Debug swift-colorful"
},
{
"type": "lldb",
"request": "launch",
"name": "Release swift-colorful",
"program": ".build/release/swift-colorful",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Release swift-colorful"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug DemoColorBlend-macOS",
"program": ".build/debug/DemoColorBlend-macOS",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Debug DemoColorBlend-macOS"
},
{
"type": "lldb",
"request": "launch",
"name": "Release DemoColorBlend-macOS",
"program": ".build/release/DemoColorBlend-macOS",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Release DemoColorBlend-macOS"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug DemoColorDist-macOS",
"program": ".build/debug/DemoColorDist-macOS",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Debug DemoColorDist-macOS"
},
{
"type": "lldb",
"request": "launch",
"name": "Release DemoColorDist-macOS",
"program": ".build/release/DemoColorDist-macOS",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Release DemoColorDist-macOS"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug DemoShared",
"program": ".build/debug/DemoShared",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Debug DemoShared"
},
{
"type": "lldb",
"request": "launch",
"name": "Release DemoShared",
"program": ".build/release/DemoShared",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Release DemoShared"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug DemoColorGens-macOS",
"program": ".build/debug/DemoColorGens-macOS",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Debug DemoColorGens-macOS"
},
{
"type": "lldb",
"request": "launch",
"name": "Release DemoColorGens-macOS",
"program": ".build/release/DemoColorGens-macOS",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Release DemoColorGens-macOS"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug DemoGradientGen-macOS",
"program": ".build/debug/DemoGradientGen-macOS",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Debug DemoGradientGen-macOS"
},
{
"type": "lldb",
"request": "launch",
"name": "Release DemoGradientGen-macOS",
"program": ".build/release/DemoGradientGen-macOS",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Release DemoGradientGen-macOS"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug DemoPaletteGens-macOS",
"program": ".build/debug/DemoPaletteGens-macOS",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Debug DemoPaletteGens-macOS"
},
{
"type": "lldb",
"request": "launch",
"name": "Release DemoPaletteGens-macOS",
"program": ".build/release/DemoPaletteGens-macOS",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Release DemoPaletteGens-macOS"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug DemoColorSort-macOS",
"program": ".build/debug/DemoColorSort-macOS",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Debug DemoColorSort-macOS"
},
{
"type": "lldb",
"request": "launch",
"name": "Release DemoColorSort-macOS",
"program": ".build/release/DemoColorSort-macOS",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Release DemoColorSort-macOS"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug Benchmark-macOS",
"program": ".build/debug/Benchmark-macOS",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Debug Benchmark-macOS"
},
{
"type": "lldb",
"request": "launch",
"name": "Release Benchmark-macOS",
"program": ".build/release/Benchmark-macOS",
"args": [],
"cwd": "${workspaceFolder:swift-colorful}",
"preLaunchTask": "swift: Build Release Benchmark-macOS"
}
]
}
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Please check original project CHANGELOG first:
https://github.com/lucasb-eyer/go-colorful/blob/master/CHANGELOG.md

# Changelog
All notable changes to this project will be documented in this file.
327 changes: 327 additions & 0 deletions Doc/LinearRGB Approximations.ipynb

Large diffs are not rendered by default.

Binary file added Doc/approx-quality.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (c) 2013 Lucas Beyer
Copyright (c) 2022 Artur Torun (a.k.a. Mojzesh)

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.
95 changes: 95 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// swift-tools-version: 5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "swift-colorful",
products: [
.library(name: "Colorful", targets: ["Colorful"])
],
dependencies: [],
targets: [
.target(
name: "Colorful",
dependencies: []),
.testTarget(
name: "ColorfulTests",
dependencies: ["Colorful"],
resources: [.process("Resources/hsluv-snapshot-rev4.json")]),
]
)

//--------------------------------------------
// Demo projects
//--------------------------------------------
#if os(macOS)
//--------------------------------------------
// DemoShared
//--------------------------------------------
package.products.append(.executable(name: "DemoColorBlend-macOS", targets: ["DemoColorBlend"]))
package.targets.append(.target(name: "DemoShared",
dependencies: ["Colorful"],
path: "Sources/Demos/Shared"))

//--------------------------------------------
// DemoColorBlend
//--------------------------------------------
package.targets.append(.executableTarget(name: "DemoColorBlend",
dependencies: ["Colorful", "DemoShared"],
path: "Sources/Demos/ColorBlend",
exclude:["colorblend.png", "invalid.xcf", "invalid.png", "clamped.png", "clamped.xcf"]))

//--------------------------------------------
// DemoColorDist
//--------------------------------------------
package.products.append(.executable(name: "DemoColorDist-macOS", targets: ["DemoColorDist"]))
package.targets.append(.executableTarget(name: "DemoColorDist",
dependencies: ["Colorful"],
path: "Sources/Demos/ColorDist",
exclude:["colordist.png", "colordist.xcf"]))

//--------------------------------------------
// DemoColorGens
//--------------------------------------------
package.products.append(.executable(name: "DemoColorGens-macOS", targets: ["DemoColorGens"]))
package.targets.append(.executableTarget(name: "DemoColorGens",
dependencies: ["Colorful", "DemoShared"],
path: "Sources/Demos/ColorGens",
exclude:["colorgens.png"]))

//--------------------------------------------
// DemoColorSort
//--------------------------------------------
package.products.append(.executable(name: "DemoColorSort-macOS", targets: ["DemoColorSort"]))
package.targets.append(.executableTarget(name: "DemoColorSort",
dependencies: ["Colorful", "DemoShared"],
path: "Sources/Demos/ColorSort",
exclude:["colorsort.png"]))

//--------------------------------------------
// DemoGradientGen
//--------------------------------------------
package.products.append(.executable(name: "DemoGradientGen-macOS", targets: ["DemoGradientGen"]))
package.targets.append(.executableTarget(name: "DemoGradientGen",
dependencies: ["Colorful", "DemoShared"],
path: "Sources/Demos/GradientGen",
exclude:["gradientgen.png"]))

//--------------------------------------------
// DemoPaletteGens
//--------------------------------------------
package.products.append(.executable(name: "DemoPaletteGens-macOS", targets: ["DemoPaletteGens"]))
package.targets.append(.executableTarget(name: "DemoPaletteGens",
dependencies: ["Colorful", "DemoShared"],
path: "Sources/Demos/PaletteGens",
exclude:["palettegens.png"]))

//--------------------------------------------
// Benchmark
//--------------------------------------------
package.products.append(.executable(name: "Benchmark-macOS", targets: ["Benchmark"]))
package.targets.append(.executableTarget(name: "Benchmark",
dependencies: ["Colorful", "DemoShared"],
path: "Sources/Demos/Benchmark"))
#endif
Loading

0 comments on commit 65ad771

Please sign in to comment.