diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 76e25c7f..5d6c72cf 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -3,7 +3,6 @@
# Workflow & Deployment related files
.github/* @ffried
-.jazzy.yaml @ffried
.codecov.yml @ffried
# Project & Source files
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 0b244e4c..1cdf9b2c 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -1,13 +1,24 @@
version: 2
updates:
- - package-ecosystem: "github-actions"
- directory: "/"
+ - package-ecosystem: github-actions
+ directory: /
open-pull-requests-limit: 10
schedule:
- interval: "daily"
- time: "07:00"
- timezone: "Europe/Berlin"
+ interval: daily
+ time: 07:00
+ timezone: Europe/Berlin
+ assignees:
+ - ffried
+ reviewers:
+ - ffried
+ - package-ecosystem: swift
+ directory: /
+ open-pull-requests-limit: 10
+ schedule:
+ interval: daily
+ time: 07:00
+ timezone: Europe/Berlin
assignees:
- ffried
reviewers:
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 494b3506..485cc107 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -8,229 +8,19 @@ on:
push:
branches: [ main ]
-jobs:
- release-context:
- runs-on: ubuntu-latest
- outputs:
- version-name: ${{ github.ref_name }}
- is-latest: ${{ steps.compare-tags.outputs.is-latest }}
- steps:
- - uses: joutvhu/get-release@v1
- id: latest-release
- with:
- latest: true
- throwing: false
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Compare tags
- id: compare-tags
- env:
- REF_TYPE: ${{ github.ref_type }}
- REF_NAME: ${{ github.ref_name }}
- LATEST_TAG: ${{ steps.latest-release.outputs.tag_name }}
- run: |
- if [ "${REF_TYPE}" == 'tag' ] && [ "${REF_NAME}" == "${LATEST_TAG}" ]; then
- echo 'is-latest=true' >> "${GITHUB_OUTPUT}"
- else
- echo 'is-latest=false' >> "${GITHUB_OUTPUT}"
- fi
-
- spm-context:
- runs-on: ubuntu-latest
- outputs:
- package-dump: ${{ steps.dump-package.outputs.package-dump }}
- steps:
- - uses: swift-actions/setup-swift@v1.24.0
- with:
- swift-version: '5.7'
- - uses: actions/checkout@v4
- # We don't use a cache here, because SPM doesn't resolve dependencies when dumping packages.
- - name: Dump package
- id: dump-package
- run: |
- delimiter="$(openssl rand -hex 8)"
- echo "package-dump<<${delimiter}" >> "${GITHUB_OUTPUT}"
- swift package dump-package >> "${GITHUB_OUTPUT}"
- echo "${delimiter}" >> "${GITHUB_OUTPUT}"
+permissions:
+ contents: write
- generate-docs:
- needs:
- - release-context
- - spm-context
- runs-on: macos-12
- strategy:
- matrix:
- target: ${{ fromJson(needs.spm-context.outputs.package-dump).products.*.targets.* }}
- steps:
- - uses: swift-actions/setup-swift@v1.24.0
- id: swift-setup
- with:
- swift-version: '5.7'
- - name: Read OS Version
- uses: sersoft-gmbh/os-version-action@v3
- id: os-version
- - uses: actions/checkout@v4
- - uses: actions/cache@v3
- with:
- path: .build
- key: ${{ runner.os }}-${{ steps.os-version.outputs.version }}-spm-${{ steps.swift-setup.outputs.version }}-${{ hashFiles('**/Package.resolved') }}
- restore-keys: |
- ${{ runner.os }}-${{ steps.os-version.outputs.version }}-spm-${{ steps.swift-setup.outputs.version }}-
- - uses: sersoft-gmbh/swifty-docs-action@v3
- env:
- ENABLE_DOCC_SUPPORT: '1'
- DOCC_JSON_PRETTYPRINT: 'YES'
- with:
- package-version: ${{ needs.release-context.outputs.version-name }}
- targets: ${{ matrix.target }}
- enable-inherited-docs: true
- enable-index-building: false
- transform-for-static-hosting: true
- hosting-base-path: ${{ github.event.repository.name }}/${{ needs.release-context.outputs.version-name }}
- output: ${{ matrix.target }}-docs
- - name: Package docs
- env:
- TARGET: ${{ matrix.target }}
- run: tar -cvf "${TARGET}-docs.tar" "${TARGET}-docs"
- - uses: actions/upload-artifact@v3
- with:
- name: ${{ matrix.target }}-docs
- path: ${{ matrix.target }}-docs.tar
+concurrency:
+ group: ${{ github.ref }}
+ cancel-in-progress: true
- publish-docs:
- needs:
- - release-context
- - spm-context
- - generate-docs
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- with:
- ref: gh-pages
- path: repository
- - uses: actions/download-artifact@v3
- with:
- path: artifacts
- - name: Extract tars
- run: find artifacts -name '*.tar' -execdir tar -xvf '{}' --strip-components 1 \; -delete
- - name: Merge documentations
- env:
- TARGETS: ${{ join(fromJson(needs.spm-context.outputs.package-dump).products.*.targets.*, ' ') }}
- DOCS_BASE_DIR: repository/${{ needs.release-context.outputs.version-name }}
- run: |
- rm -rf "${DOCS_BASE_DIR}"
- is_first=1
- for target in $TARGETS; do
- if [ $is_first -eq 1 ]; then
- echo "Copying initial documentation for ${target}"
- cp -R "artifacts/${target}-docs" "${DOCS_BASE_DIR}"
- is_first=0
- else
- echo "Merging documentation for ${target}"
- cp -R "artifacts/${target}-docs/data/documentation/"* "${DOCS_BASE_DIR}/data/documentation/"
- cp -R "artifacts/${target}-docs/documentation/"* "${DOCS_BASE_DIR}/documentation/"
- fi
- done
- echo "Deleting non-mergable metadata.json"
- rm -f "${DOCS_BASE_DIR}/metadata.json"
- - name: Create version index
- working-directory: repository
- env:
- TARGET_DOCS_DIR: ${{ needs.release-context.outputs.version-name }}/documentation
- INDEX_FILE: ${{ needs.release-context.outputs.version-name }}/index.html
- BASE_URL: 'https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ needs.release-context.outputs.version-name }}/documentation'
- REPO_NAME: ${{ github.event.repository.name }}
- run: |
- target_count=0
- target_list=""
- single_target_name=""
- for target in $(ls "${TARGET_DOCS_DIR}"); do
- if [ -d "${TARGET_DOCS_DIR}/${target}" ]; then
- single_target_name="${target}"
- target_count=$((target_count+1))
- target_list="${target_list}
${target}
Documentation"
- fi
- done
- if [ ${target_count} -gt 1 ]; then
- echo "Found ${target_count} targets. Generating list..."
- cat > "${INDEX_FILE}" <
-
-
- ${REPO_NAME} Documentation
-
-
-
-
-
- EOF
- else
- echo "Found one target. Generating redirect file to target ${single_target_name}"
- cat > "${INDEX_FILE}" <
-
-
- ${REPO_NAME} Documentation
-
-
-
- Redirecting...
-
-
- EOF
- fi
- - name: Create root index
- working-directory: repository
- env:
- REDIRECT_URL: 'https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/latest'
- REPO_NAME: ${{ github.event.repository.name }}
- run: |
- cat > 'index.html' <
-
-
- ${REPO_NAME} Documentation
-
-
-
- Redirecting...
-
-
- EOF
- - name: Create latest symlink
- if: ${{ needs.release-context.outputs.is-latest }}
- working-directory: repository
- env:
- VERSION_NAME: ${{ needs.release-context.outputs.version-name }}
- run: |
- rm -f 'latest'
- ln -s "${VERSION_NAME}" 'latest'
- - name: Determine changes
- id: check-changes
- working-directory: repository
- run: |
- if [ -n "$(git status --porcelain)" ]; then
- echo 'has-changes=true' >> "${GITHUB_OUTPUT}"
- else
- echo 'has-changes=false' >> "${GITHUB_OUTPUT}"
- fi
- - uses: crazy-max/ghaction-github-pages@v4
- if: ${{ steps.check-changes.outputs.has-changes }}
- with:
- keep_history: true
- build_dir: repository
- commit_message: Deploy documentation for '${{ needs.release-context.outputs.version-name }}'
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- cleanup:
- needs:
- - generate-docs
- - publish-docs
- if: ${{ always() }}
- runs-on: ubuntu-latest
- steps:
- - name: Cleanup Artifacts
- uses: joutvhu/delete-artifact@v1
+jobs:
+ generate-and-publish-docs:
+ uses: sersoft-gmbh/oss-common-actions/.github/workflows/swift-generate-and-publish-docs.yml@main
+ with:
+ os: macOS
+ swift-version: '5.9'
+ organisation: ${{ github.repository_owner }}
+ repository: ${{ github.event.repository.name }}
+ pages-branch: gh-pages
diff --git a/.github/workflows/enable-auto-merge.yml b/.github/workflows/enable-auto-merge.yml
index 6b3a13af..74fbf988 100644
--- a/.github/workflows/enable-auto-merge.yml
+++ b/.github/workflows/enable-auto-merge.yml
@@ -1,6 +1,8 @@
name: Auto-merge for Dependabot PRs
-on: pull_request
+on:
+ pull_request:
+ branches: [ main ]
permissions:
contents: write
diff --git a/.github/workflows/swift-test.yml b/.github/workflows/swift-test.yml
index 11151d30..cceeaaeb 100644
--- a/.github/workflows/swift-test.yml
+++ b/.github/workflows/swift-test.yml
@@ -6,67 +6,37 @@ on:
pull_request:
branches: [ main ]
+permissions:
+ contents: read
+
jobs:
+ variables:
+ outputs:
+ max-supported-swift-version: '5.9'
+ xcode-scheme: color-components-Package
+ xcode-platform-version: latest
+ fail-if-codecov-fails: true
+ runs-on: ubuntu-latest
+ steps:
+ - run: exit 0
+
test-spm:
+ needs: variables
strategy:
matrix:
- os: [ macos-12 ]
- swift-version: [ '' ]
- xcode-version: [ '^13.4' ]
- include:
- - os: macos-12
- swift-version: ''
- xcode-version: '^14.1'
- - os: ubuntu-20.04
- swift-version: 5.6
- xcode-version: ''
- - os: ubuntu-20.04
- swift-version: 5.7
- xcode-version: ''
- - os: ubuntu-22.04
- swift-version: 5.7
- xcode-version: ''
-
- runs-on: ${{ matrix.os }}
-
- steps:
- - if: ${{ runner.os == 'macOS' }}
- uses: maxim-lobanov/setup-xcode@v1
- with:
- xcode-version: ${{ matrix.xcode-version }}
- - name: Install Swift
- if: ${{ runner.os == 'Linux' }}
- uses: sersoft-gmbh/swifty-linux-action@v3
- with:
- release-version: ${{ matrix.swift-version }}
- platform: ${{ matrix.os }}
- github-token: ${{ secrets.GITHUB_TOKEN }}
- - name: Read OS Version
- uses: sersoft-gmbh/os-version-action@v3
- id: os-version
- - name: Read Swift Version
- uses: sersoft-gmbh/swift-version-action@v3
- id: swift-version
- - uses: actions/checkout@v4
- - uses: actions/cache@v3
- with:
- path: .build
- key: ${{ runner.os }}-${{ steps.os-version.outputs.version }}-spm-${{ steps.swift-version.outputs.version }}-${{ hashFiles('**/Package.resolved') }}
- restore-keys: |
- ${{ runner.os }}-${{ steps.os-version.outputs.version }}-spm-${{ steps.swift-version.outputs.version }}-
- - name: Build & Test
- run: swift test -v --parallel --enable-code-coverage
- - name: Generate Coverage Files
- uses: sersoft-gmbh/swift-coverage-action@v4
- id: coverage-files
- - uses: codecov/codecov-action@v3
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }}
- fail_ci_if_error: true
+ os: [ macOS, ubuntu ]
+ swift-version-offset: [ 0 ]
+ uses: sersoft-gmbh/oss-common-actions/.github/workflows/swift-test-spm.yml@main
+ with:
+ os: ${{ matrix.os }}
+ max-swift-version: ${{ needs.variables.outputs.max-supported-swift-version }}
+ swift-version-offset: ${{ matrix.swift-version-offset }}
+ fail-if-codecov-fails: ${{ fromJson(needs.variables.outputs.fail-if-codecov-fails) }}
+ secrets:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test-xcode:
- runs-on: macos-12
+ needs: variables
strategy:
matrix:
platform:
@@ -75,76 +45,14 @@ jobs:
- iPadOS
- tvOS
- watchOS
- env:
- XCODE_SCHEME: color-components-Package
- steps:
- - uses: maxim-lobanov/setup-xcode@v1
- with:
- xcode-version: ^14.1
- - name: Read OS Version
- uses: sersoft-gmbh/os-version-action@v3
- id: os-version
- - name: Read Swift Version
- uses: sersoft-gmbh/swift-version-action@v3
- id: swift-version
- - name: Select destination
- id: destination
- env:
- PLATFORM: ${{ matrix.platform }}
- run: |
- DESTINATION=''
- case "${PLATFORM}" in
- 'macOS') DESTINATION='platform=macOS';;
- 'iOS') DESTINATION='platform=iOS Simulator,OS=latest,name=iPhone 13 Pro';;
- 'iPadOS') DESTINATION='platform=iOS Simulator,OS=latest,name=iPad Pro (11-inch) (3rd generation)';;
- 'tvOS') DESTINATION='platform=tvOS Simulator,OS=latest,name=Apple TV 4K (2nd generation)';;
- 'watchOS') DESTINATION='platform=watchOS Simulator,OS=latest,name=Apple Watch Series 7 (45mm)';;
- *) echo "::error title=Unknown platform!::Unknown platform: ${PLATFORM}" && exit 1;;
- esac
- echo "xcode=${DESTINATION}" >> "${GITHUB_OUTPUT}"
- - uses: actions/checkout@v4
- # PIF ISSUES: https://github.com/apple/swift-package-manager/issues/5767
- - uses: actions/cache@v3
- with:
- path: .build
- key: ${{ runner.os }}-${{ steps.os-version.outputs.version }}-spm-${{ steps.swift-version.outputs.version }}-${{ hashFiles('**/Package.resolved') }}
- restore-keys: |
- ${{ runner.os }}-${{ steps.os-version.outputs.version }}-spm-${{ steps.swift-version.outputs.version }}-
- - name: Work around PIF issues
- env:
- DESTINATION: ${{ steps.destination.outputs.xcode }}
- run: |
- swift package dump-pif > /dev/null
- ATTEMPT=0
- while [ -z "${SUCCESS}" ] && [ "${ATTEMPT}" -le 5 ]; do
- xcodebuild clean -scheme "${XCODE_SCHEME}" -destination "${DESTINATION}" | grep -q "CLEAN SUCCEEDED" && SUCCESS=true
- ATTEMPT=$((ATTEMPT + 1))
- done
- # END PIF ISSUES
- - uses: actions/cache@v3
- with:
- path: .derived-data
- key: ${{ runner.os }}-${{ steps.os-version.outputs.version }}-xcode-${{ steps.swift-version.outputs.version }}-${{ matrix.platform }}-${{ hashFiles('**/Package.resolved') }}
- restore-keys: |
- ${{ runner.os }}-${{ steps.os-version.outputs.version }}-xcode-${{ steps.swift-version.outputs.version }}-${{ matrix.platform }}-
- - uses: sersoft-gmbh/xcodebuild-action@v3
- with:
- spm-package: './'
- scheme: ${{ env.XCODE_SCHEME }}
- destination: ${{ steps.destination.outputs.xcode }}
- action: test
- parallel-testing-enabled: ${{ matrix.platform != 'watchOS' }}
- enable-code-coverage: true
- derived-data-path: .derived-data
- - uses: sersoft-gmbh/swift-coverage-action@v4
- id: coverage-files
- with:
- search-paths: |
- ./.build
- ./.derived-data
- $HOME/Library/Developer/Xcode/DerivedData
- - uses: codecov/codecov-action@v3
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }}
- fail_ci_if_error: true
+ swift-version-offset: [ 0 ]
+ uses: sersoft-gmbh/oss-common-actions/.github/workflows/swift-test-xcode.yml@main
+ with:
+ xcode-scheme: ${{ needs.variables.outputs.xcode-scheme }}
+ max-swift-version: ${{ needs.variables.outputs.max-supported-swift-version }}
+ swift-version-offset: ${{ matrix.swift-version-offset }}
+ platform: ${{ matrix.platform }}
+ platform-version: ${{ needs.variables.outputs.xcode-platform-version }}
+ fail-if-codecov-fails: ${{ fromJson(needs.variables.outputs.fail-if-codecov-fails) }}
+ secrets:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 95c43209..13bc1d56 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,23 @@
.DS_Store
+
/.build
/Packages
-/*.xcodeproj
xcuserdata/
+DerivedData/
+.swiftpm/configuration/registries.json
+.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
+.netrc
+
+# VS Code
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+!.vscode/*.code-snippets
+
+# Local History for Visual Studio Code
+.history/
+
+# Built Visual Studio Code Extensions
+*.vsix
diff --git a/Package.resolved b/Package.resolved
new file mode 100644
index 00000000..e65252d0
--- /dev/null
+++ b/Package.resolved
@@ -0,0 +1,23 @@
+{
+ "pins" : [
+ {
+ "identity" : "swift-docc-plugin",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/apple/swift-docc-plugin",
+ "state" : {
+ "revision" : "26ac5758409154cc448d7ab82389c520fa8a8247",
+ "version" : "1.3.0"
+ }
+ },
+ {
+ "identity" : "swift-docc-symbolkit",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/apple/swift-docc-symbolkit",
+ "state" : {
+ "revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
+ "version" : "1.0.0"
+ }
+ }
+ ],
+ "version" : 2
+}
diff --git a/Package.swift b/Package.swift
index 64913d8a..34a740aa 100644
--- a/Package.swift
+++ b/Package.swift
@@ -1,8 +1,17 @@
-// swift-tools-version:5.8
+// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
-import Foundation
+
+let swiftSettings: Array = [
+ .enableUpcomingFeature("ConciseMagicFile"),
+ .enableUpcomingFeature("ExistentialAny"),
+ .enableUpcomingFeature("BareSlashRegexLiterals"),
+ .enableUpcomingFeature("DisableOutwardActorInference"),
+// .enableExperimentalFeature("AccessLevelOnImport"),
+// .enableExperimentalFeature("VariadicGenerics"),
+// .unsafeFlags(["-warn-concurrency"], .when(configuration: .debug)),
+]
let package = Package(
name: "color-components",
@@ -15,15 +24,22 @@ let package = Package(
name: "ColorCalculations",
targets: ["ColorCalculations"]),
],
+ dependencies: [
+ .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
+ ],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
- .target(name: "ColorComponents"),
+ .target(
+ name: "ColorComponents",
+ swiftSettings: swiftSettings),
.target(
name: "ColorCalculations",
- dependencies: ["ColorComponents"]),
+ dependencies: ["ColorComponents"],
+ swiftSettings: swiftSettings),
.target(
name: "XCHelpers",
+ swiftSettings: swiftSettings,
linkerSettings: [
.linkedFramework("XCTest", .when(platforms: [.iOS, .macOS, .macCatalyst, .tvOS, .watchOS])),
]),
@@ -32,7 +48,8 @@ let package = Package(
dependencies: [
"ColorComponents",
"XCHelpers",
- ]),
+ ],
+ swiftSettings: swiftSettings),
.testTarget(
name: "ColorCalculationsTests",
dependencies: [
@@ -41,10 +58,7 @@ let package = Package(
],
resources: [
.copy("TestImages"),
- ]),
+ ],
+ swiftSettings: swiftSettings),
]
)
-
-if ProcessInfo.processInfo.environment["ENABLE_DOCC_SUPPORT"] == "1" {
- package.dependencies.append(.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"))
-}
diff --git a/Package@swift-5.6.swift b/Package@swift-5.6.swift
deleted file mode 100644
index 5d0dbd49..00000000
--- a/Package@swift-5.6.swift
+++ /dev/null
@@ -1,50 +0,0 @@
-// swift-tools-version:5.6
-// The swift-tools-version declares the minimum version of Swift required to build this package.
-
-import PackageDescription
-import Foundation
-
-let package = Package(
- name: "color-components",
- products: [
- // Products define the executables and libraries a package produces, and make them visible to other packages.
- .library(
- name: "ColorComponents",
- targets: ["ColorComponents"]),
- .library(
- name: "ColorCalculations",
- targets: ["ColorCalculations"]),
- ],
- targets: [
- // Targets are the basic building blocks of a package. A target can define a module or a test suite.
- // Targets can depend on other targets in this package, and on products in packages this package depends on.
- .target(name: "ColorComponents"),
- .target(
- name: "ColorCalculations",
- dependencies: ["ColorComponents"]),
- .target(
- name: "XCHelpers",
- linkerSettings: [
- .linkedFramework("XCTest", .when(platforms: [.iOS, .macOS, .macCatalyst, .tvOS, .watchOS])),
- ]),
- .testTarget(
- name: "ColorComponentsTests",
- dependencies: [
- "ColorComponents",
- "XCHelpers",
- ]),
- .testTarget(
- name: "ColorCalculationsTests",
- dependencies: [
- "ColorCalculations",
- "XCHelpers",
- ],
- resources: [
- .copy("TestImages"),
- ]),
- ]
-)
-
-if ProcessInfo.processInfo.environment["ENABLE_DOCC_SUPPORT"] == "1" {
- package.dependencies.append(.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"))
-}
diff --git a/Package@swift-5.7.swift b/Package@swift-5.7.swift
deleted file mode 100644
index 4a3f8438..00000000
--- a/Package@swift-5.7.swift
+++ /dev/null
@@ -1,50 +0,0 @@
-// swift-tools-version:5.7
-// The swift-tools-version declares the minimum version of Swift required to build this package.
-
-import PackageDescription
-import Foundation
-
-let package = Package(
- name: "color-components",
- products: [
- // Products define the executables and libraries a package produces, and make them visible to other packages.
- .library(
- name: "ColorComponents",
- targets: ["ColorComponents"]),
- .library(
- name: "ColorCalculations",
- targets: ["ColorCalculations"]),
- ],
- targets: [
- // Targets are the basic building blocks of a package. A target can define a module or a test suite.
- // Targets can depend on other targets in this package, and on products in packages this package depends on.
- .target(name: "ColorComponents"),
- .target(
- name: "ColorCalculations",
- dependencies: ["ColorComponents"]),
- .target(
- name: "XCHelpers",
- linkerSettings: [
- .linkedFramework("XCTest", .when(platforms: [.iOS, .macOS, .macCatalyst, .tvOS, .watchOS])),
- ]),
- .testTarget(
- name: "ColorComponentsTests",
- dependencies: [
- "ColorComponents",
- "XCHelpers",
- ]),
- .testTarget(
- name: "ColorCalculationsTests",
- dependencies: [
- "ColorCalculations",
- "XCHelpers",
- ],
- resources: [
- .copy("TestImages"),
- ]),
- ]
-)
-
-if ProcessInfo.processInfo.environment["ENABLE_DOCC_SUPPORT"] == "1" {
- package.dependencies.append(.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"))
-}
diff --git a/Sources/ColorCalculations/ImageColorsCalculator+ProminentColors.swift b/Sources/ColorCalculations/ImageColorsCalculator+ProminentColors.swift
index d5241135..0b048bb0 100644
--- a/Sources/ColorCalculations/ImageColorsCalculator+ProminentColors.swift
+++ b/Sources/ColorCalculations/ImageColorsCalculator+ProminentColors.swift
@@ -159,12 +159,10 @@ where Index: FixedWidthInteger, Element: SIMD, Element.Scalar: BinaryFloatingPoi
// - We have an iteration limit of 1024 iterations
// - We stop after the first iteration that didn't have any errors (thus saving us the treshold).
// - We dynamically lower `k` if the count is less than the desired `k`.
- func kMeansClustered(atMost maxK: Int,
- using randomNumberGenerator: inout G,
- distance: (Element, Element) -> D) -> Array>
- where D: Comparable, G: RandomNumberGenerator
- {
- guard !isEmpty else { return [] }
+ func kMeansClustered(atMost maxK: Int,
+ using randomNumberGenerator: inout some RandomNumberGenerator,
+ distance: (Element, Element) -> some Comparable) -> Array> {
+ guard !isEmpty else { return .init() }
var clusters = randomElements(count: Swift.min(maxK, count), using: &randomNumberGenerator)
.map { Cluster(centroid: $0, size: .zero) }
@@ -201,8 +199,8 @@ where Index: FixedWidthInteger, Element: SIMD, Element.Scalar: BinaryFloatingPoi
}
fileprivate extension RandomAccessCollection {
- func nearestClusterIndex(for point: Vec, distance: (Vec, Vec) -> D) -> Index
- where Element == Cluster, D: Comparable
+ func nearestClusterIndex(for point: Vec, distance: (Vec, Vec) -> some Comparable) -> Index
+ where Element == Cluster
{
withoutActuallyEscaping(distance) { distance in
indices
@@ -215,9 +213,8 @@ fileprivate extension RandomAccessCollection {
}
fileprivate extension RandomAccessCollection where Index: FixedWidthInteger {
- func randomElements(count elemCount: Int, using randomGenerator: inout G) -> Array
- where G: RandomNumberGenerator
- {
+ func randomElements(count elemCount: Int,
+ using randomGenerator: inout some RandomNumberGenerator) -> Array {
guard !isEmpty else { return .init() }
guard count > elemCount else { return Array(self) }
diff --git a/Sources/ColorCalculations/ImageColorsCalculator.swift b/Sources/ColorCalculations/ImageColorsCalculator.swift
index 9fb24000..3919f683 100644
--- a/Sources/ColorCalculations/ImageColorsCalculator.swift
+++ b/Sources/ColorCalculations/ImageColorsCalculator.swift
@@ -16,7 +16,7 @@ public struct ImageColorsCalculator {
self.image = image
}
- private func rgba(for filter: CIFilter & CIAreaReductionFilter, in area: CGRect?) -> RGBA {
+ private func rgba(for filter: some CIFilter & CIAreaReductionFilter, in area: CGRect?) -> RGBA {
filter.setDefaults()
filter.inputImage = image
filter.extent = area ?? image.extent
diff --git a/Sources/ColorComponents/BWA/BWA.swift b/Sources/ColorComponents/BWA/BWA.swift
index 99614f64..adad7719 100644
--- a/Sources/ColorComponents/BWA/BWA.swift
+++ b/Sources/ColorComponents/BWA/BWA.swift
@@ -20,7 +20,7 @@ public struct BWA: AlphaColorComponents {
public var alpha: Value
/// The white component.
- /// - SeeAlso: `BW.white`
+ /// - SeeAlso: ``BW/white`
@inlinable
public var white: Value {
get { bw.white }
@@ -48,7 +48,7 @@ public struct BWA: AlphaColorComponents {
extension BW where Value: BinaryInteger {
/// Creates new black/white components from another b/w color components object with integer values.
/// - Parameter other: The other black/white color components.
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: BW) {
self.init(white: .init(other.white))
@@ -57,7 +57,7 @@ extension BW where Value: BinaryInteger {
/// Tries to create new black/white components that exactly match the values
/// from another b/w color components object with integer values.
/// - Parameter other: The other black/white color components.
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(exactly:)``
@inlinable
public init?(exactly other: BW) {
guard let white = Value(exactly: other.white) else { return nil }
@@ -67,7 +67,7 @@ extension BW where Value: BinaryInteger {
/// Creates new black/white components from another b/w color components object with floating point values.
/// - Parameter other: The other black/white color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255).
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: BW) {
self.init(white: .init(colorConverting: other.white))
@@ -77,7 +77,7 @@ extension BW where Value: BinaryInteger {
/// from another b/w color components object with floating point values.
/// - Parameter other: The other black/white color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255).
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(exactly:)``
@inlinable
public init?(exactly other: BW) {
guard let white = Value(colorConvertingExactly: other.white) else { return nil }
@@ -89,7 +89,7 @@ extension BW where Value: BinaryFloatingPoint {
/// Creates new black/white components from another b/w color components object with integer values.
/// - Parameter other: The other black/white color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0).
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: BW) {
self.init(white: .init(colorConverting: other.white))
@@ -99,7 +99,7 @@ extension BW where Value: BinaryFloatingPoint {
/// from another b/w color components object with integer values.
/// - Parameter other: The other black/white color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0).
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(exactly:)``
@inlinable
public init?(exactly other: BW) {
guard let white = Value(colorConvertingExactly: other.white) else { return nil }
@@ -108,7 +108,7 @@ extension BW where Value: BinaryFloatingPoint {
/// Creates new black/white components from another b/w color components object with floating point values.
/// - Parameter other: The other black/white color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: BW) {
self.init(white: .init(other.white))
@@ -117,7 +117,7 @@ extension BW where Value: BinaryFloatingPoint {
/// Tries to create new black/white components that exactly match the values
/// from another b/w color components object with floating point values.
/// - Parameter other: The other black/white color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(exactly:)``
@inlinable
public init?(exactly other: BW) {
guard let white = Value(exactly: other.white) else { return nil }
@@ -128,7 +128,7 @@ extension BW where Value: BinaryFloatingPoint {
extension BWA where Value: BinaryInteger {
/// Creates new black/white components with alpha channel from another b/w color components object with integer values.
/// - Parameter other: The other black/white color components with alpha channel.
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: BWA) {
self.init(bw: .init(other.bw), alpha: .init(other.alpha))
@@ -137,7 +137,7 @@ extension BWA where Value: BinaryInteger {
/// Tries to create new black/white components with alpha channel that exactly match the values
/// from another b/w color components object with integer values.
/// - Parameter other: The other black/white color components with alpha channel.
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: BWA) {
guard let bw = BW(exactly: other.bw),
@@ -149,7 +149,7 @@ extension BWA where Value: BinaryInteger {
/// Creates new black/white components with alpha channel from another b/w color components object with floating point values.
/// - Parameter other: The other black/white color components with alpha channle.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255).
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: BWA) {
self.init(bw: .init(other.bw), alpha: .init(colorConverting: other.alpha))
@@ -159,7 +159,7 @@ extension BWA where Value: BinaryInteger {
/// from another b/w color components object with floating point values.
/// - Parameter other: The other black/white color components with alpha channel.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255).
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: BWA) {
guard let bw = BW(exactly: other.bw),
@@ -173,7 +173,7 @@ extension BWA where Value: BinaryFloatingPoint {
/// Creates new black/white components with alpha channel from another b/w color components object with integer values.
/// - Parameter other: The other black/white color components with alpha channel.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0).
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: BWA) {
self.init(bw: .init(other.bw), alpha: .init(colorConverting: other.alpha))
@@ -183,7 +183,7 @@ extension BWA where Value: BinaryFloatingPoint {
/// from another b/w color components object with integer values.
/// - Parameter other: The other black/white color components with alpha channel.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0).
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: BWA) {
guard let bw = BW(exactly: other.bw),
@@ -194,7 +194,7 @@ extension BWA where Value: BinaryFloatingPoint {
/// Creates new black/white components with alpha channel from another b/w color components object with floating point values.
/// - Parameter other: The other black/white color components with alpha channel.
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: BWA) {
self.init(bw: .init(other.bw), alpha: .init(other.alpha))
@@ -203,7 +203,7 @@ extension BWA where Value: BinaryFloatingPoint {
/// Tries to create new black/white components with alpha channel that exactly match the values
/// from another b/w color components object with floating point values.
/// - Parameter other: The other black/white color components with alpha channel.
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: BWA) {
guard let bw = BW(exactly: other.bw),
diff --git a/Sources/ColorComponents/BWA/Platforms/BWA+AppKit.swift b/Sources/ColorComponents/BWA/Platforms/BWA+AppKit.swift
index e248311b..688036bf 100644
--- a/Sources/ColorComponents/BWA/Platforms/BWA+AppKit.swift
+++ b/Sources/ColorComponents/BWA/Platforms/BWA+AppKit.swift
@@ -5,7 +5,7 @@ import AppKit
@available(tvOS, unavailable)
@available(watchOS, unavailable)
extension NSColorSpace {
- /// The default color space used by `BW` and `BWA` to create `NSColor`s when no color space was specified.
+ /// The default color space used by ``BW`` and ``BWA`` to create `NSColor`s when no color space was specified.
/// This is currently equivalent to `NSColorSpace.deviceGray`.
public static var colorComponentsDefaultGray: NSColorSpace { .deviceGray }
}
@@ -22,7 +22,7 @@ extension NSColor {
/// Creates a new color using the given black/white components and color space.
/// - Parameters:
/// - bw: The black/white components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultGray`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultGray``.
@inlinable
public convenience init(_ bw: BW, colorSpace: NSColorSpace = .colorComponentsDefaultGray) {
self.init(bw, alpha: 1, colorSpace: colorSpace)
@@ -31,7 +31,7 @@ extension NSColor {
/// Creates a new color using the given black/white components with alpha channel and color space.
/// - Parameters:
/// - bwa: The black/white components with alpha channel.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultGray`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultGray``.
@inlinable
public convenience init(_ bwa: BWA, colorSpace: NSColorSpace = .colorComponentsDefaultGray) {
self.init(bwa.bw, alpha: bwa.alpha, colorSpace: colorSpace)
@@ -40,7 +40,7 @@ extension NSColor {
/// Creates a new color using the given black/white components and color space.
/// - Parameters:
/// - bw: The black/white components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultGray`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultGray``.
@inlinable
public convenience init(_ bw: BW, colorSpace: NSColorSpace = .colorComponentsDefaultGray) {
self.init(BW(bw), colorSpace: colorSpace)
@@ -49,7 +49,7 @@ extension NSColor {
/// Creates a new color using the given black/white components with alpha channel and color space.
/// - Parameters:
/// - bwa: The black/white components with alpha channel.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultGray`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultGray``.
@inlinable
public convenience init(_ bwa: BWA, colorSpace: NSColorSpace = .colorComponentsDefaultGray) {
self.init(BWA(bwa), colorSpace: colorSpace)
@@ -74,7 +74,7 @@ extension NSColor {
extension BW where Value: BinaryFloatingPoint {
/// Creates new black/white components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultGray`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultGray``
/// if it is not in a known gray color space.
@inlinable
public init(_ nsColor: NSColor) {
@@ -84,9 +84,9 @@ extension BW where Value: BinaryFloatingPoint {
/// Tries to create new black/white components that exactly
/// match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultGray`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultGray``
/// if it is not in a known gray color space.
- /// - SeeAlso: `BW.init(exactly:)`
+ /// - SeeAlso: ``BW/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractBWA().bw)
@@ -99,7 +99,7 @@ extension BW where Value: BinaryFloatingPoint {
extension BW where Value: BinaryInteger {
/// Creates new black/white components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultGray`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultGray``
/// if it is not in a known gray color space.
@inlinable
public init(_ nsColor: NSColor) {
@@ -109,9 +109,9 @@ extension BW where Value: BinaryInteger {
/// Tries to create new black/white components that exactly
/// match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultGray`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultGray``
/// if it is not in a known gray color space.
- /// - SeeAlso: `BW.init(exactly:)`
+ /// - SeeAlso: ``BW/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractBWA().bw)
@@ -124,7 +124,7 @@ extension BW where Value: BinaryInteger {
extension BWA where Value: BinaryFloatingPoint {
/// Creates new black/white components with alpha channel from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultGray`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultGray``
/// if it is not in a known gray color space.
@inlinable
public init(_ nsColor: NSColor) {
@@ -134,9 +134,9 @@ extension BWA where Value: BinaryFloatingPoint {
/// Tries to create new black/white components with alpha channel
/// that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultGray`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultGray``
/// if it is not in a known gray color space.
- /// - SeeAlso: `BWA.init(exactly:)`
+ /// - SeeAlso: ``BWA/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractBWA())
@@ -149,7 +149,7 @@ extension BWA where Value: BinaryFloatingPoint {
extension BWA where Value: BinaryInteger {
/// Creates new black/white components with alpha channel from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultGray`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultGray``
/// if it is not in a known gray color space.
@inlinable
public init(_ nsColor: NSColor) {
@@ -159,9 +159,9 @@ extension BWA where Value: BinaryInteger {
/// Tries to create new black/white components with alpha channel
/// that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultGray`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultGray``
/// if it is not in a known gray color space.
- /// - SeeAlso: `BWA.init(exactly:)`
+ /// - SeeAlso: ``BWA/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractBWA())
diff --git a/Sources/ColorComponents/BWA/Platforms/BWA+CoreGraphics.swift b/Sources/ColorComponents/BWA/Platforms/BWA+CoreGraphics.swift
index e2baa7d7..dd532fc3 100644
--- a/Sources/ColorComponents/BWA/Platforms/BWA+CoreGraphics.swift
+++ b/Sources/ColorComponents/BWA/Platforms/BWA+CoreGraphics.swift
@@ -43,7 +43,7 @@ extension BW where Value: BinaryFloatingPoint {
/// match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericGray` color space if necessary.
- /// - SeeAlso: `BW.init(exactly:)`
+ /// - SeeAlso: ``BW/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -72,7 +72,7 @@ extension BW where Value: BinaryInteger {
/// match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericGray` color space if necessary.
- /// - SeeAlso: `BW.init(exactly:)`
+ /// - SeeAlso: ``BW/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -101,7 +101,7 @@ extension BWA where Value: BinaryFloatingPoint {
/// match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericGray` color space if necessary.
- /// - SeeAlso: `BWA.init(exactly:)`
+ /// - SeeAlso: ``BWA/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -130,7 +130,7 @@ extension BWA where Value: BinaryInteger {
/// match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericGray` color space if necessary.
- /// - SeeAlso: `BWA.init(exactly:)`
+ /// - SeeAlso: ``BWA/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
diff --git a/Sources/ColorComponents/BWA/Platforms/BWA+SwiftUI.swift b/Sources/ColorComponents/BWA/Platforms/BWA+SwiftUI.swift
index e1091350..7850638a 100644
--- a/Sources/ColorComponents/BWA/Platforms/BWA+SwiftUI.swift
+++ b/Sources/ColorComponents/BWA/Platforms/BWA+SwiftUI.swift
@@ -40,14 +40,12 @@ extension Color {
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension BW: View where Value: BinaryFloatingPoint {
- /// See `View.body`.
@inlinable
public var body: some View { Color(self) }
}
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
extension BWA: View where Value: BinaryFloatingPoint {
- /// See `View.body`.
@inlinable
public var body: some View { Color(self) }
}
@@ -69,7 +67,7 @@ extension BW where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `BW.init(exactly:)`
+ /// - SeeAlso: ``BW/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -92,7 +90,7 @@ extension BW where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `BW.init(exactly:)`
+ /// - SeeAlso: ``BW/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -115,7 +113,7 @@ extension BWA where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `BWA.init(exactly:)`
+ /// - SeeAlso: ``BWA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -138,7 +136,7 @@ extension BWA where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `BWA.init(exactly:)`
+ /// - SeeAlso: ``BWA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -164,7 +162,7 @@ extension BW where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `BW.init(exactly:)`
+ /// - SeeAlso: ``BW/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -189,7 +187,7 @@ extension BW where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `BW.init(exactly:)`
+ /// - SeeAlso: ``BW/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -214,7 +212,7 @@ extension BWA where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `BWA.init(exactly:)`
+ /// - SeeAlso: ``BWA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -239,7 +237,7 @@ extension BWA where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `BWA.init(exactly:)`
+ /// - SeeAlso: ``BWA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
diff --git a/Sources/ColorComponents/BWA/Platforms/BWA+UIKit.swift b/Sources/ColorComponents/BWA/Platforms/BWA+UIKit.swift
index 3e0baf55..ee46959f 100644
--- a/Sources/ColorComponents/BWA/Platforms/BWA+UIKit.swift
+++ b/Sources/ColorComponents/BWA/Platforms/BWA+UIKit.swift
@@ -56,7 +56,7 @@ extension BW where Value: BinaryFloatingPoint {
/// Tries to create new black/white components that exactly
/// match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `BW.init(exactly:)`
+ /// - SeeAlso: ``BW/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (bwa, isExact) = uiColor._extractBWA()
@@ -77,7 +77,7 @@ extension BW where Value: BinaryInteger {
/// Tries to create new black/white components that exactly
/// match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `BW.init(exactly:)`
+ /// - SeeAlso: ``BW/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (bwa, isExact) = uiColor._extractBWA()
@@ -98,7 +98,7 @@ extension BWA where Value: BinaryFloatingPoint {
/// Tries to create new black/white components with alpha channel
/// that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `BWA.init(exactly:)`
+ /// - SeeAlso: ``BWA/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (bwa, isExact) = uiColor._extractBWA()
@@ -119,7 +119,7 @@ extension BWA where Value: BinaryInteger {
/// Tries to create new black/white components with alpha channel
/// that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `BWA.init(exactly:)`
+ /// - SeeAlso: ``BWA/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (bwa, isExact) = uiColor._extractBWA()
diff --git a/Sources/ColorComponents/CIE/CIE.swift b/Sources/ColorComponents/CIE/CIE.swift
index 105496a4..8afaf130 100644
--- a/Sources/ColorComponents/CIE/CIE.swift
+++ b/Sources/ColorComponents/CIE/CIE.swift
@@ -1,3 +1,3 @@
/// Namespace for all CIE components.
@frozen
-public enum CIE {}
+public enum CIE: Sendable {}
diff --git a/Sources/ColorComponents/CIE/XYZ/CIEXYZA.swift b/Sources/ColorComponents/CIE/XYZ/CIEXYZA.swift
index 20b4e9a7..e4128e88 100644
--- a/Sources/ColorComponents/CIE/XYZ/CIEXYZA.swift
+++ b/Sources/ColorComponents/CIE/XYZ/CIEXYZA.swift
@@ -28,7 +28,7 @@ extension CIE {
public var alpha: Value
/// The x component.
- /// - SeeAlso: `XYZ.x`
+ /// - SeeAlso: ``XYZ/x``
@inlinable
public var x: Value {
get { xyz.x }
@@ -36,7 +36,7 @@ extension CIE {
}
/// The y component.
- /// - SeeAlso: `XYZ.y`
+ /// - SeeAlso: ``XYZ/y``
@inlinable
public var y: Value {
get { xyz.y }
@@ -44,7 +44,7 @@ extension CIE {
}
/// The y component.
- /// - SeeAlso: `XYZ.y`
+ /// - SeeAlso: ``XYZ/y``
@inlinable
public var z: Value {
get { xyz.z }
@@ -75,7 +75,7 @@ extension CIE {
extension CIE.XYZ where Value: BinaryInteger {
/// Creates new XYZ components from another XYZ color components object with integer values.
/// - Parameter other: The other XYZ color components.
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: CIE.XYZ) {
self.init(x: .init(other.x), y: .init(other.y), z: .init(other.z))
@@ -84,7 +84,7 @@ extension CIE.XYZ where Value: BinaryInteger {
/// Tries to create new XYZ components that exactly match the values
/// from another XYZ color components object with integer values.
/// - Parameter other: The other XYZ color components.
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: CIE.XYZ) {
guard let x = Value(exactly: other.x),
@@ -97,7 +97,7 @@ extension CIE.XYZ where Value: BinaryInteger {
/// Creates new XYZ components from another XYZ color components object with floating point values.
/// - Parameter other: The other XYZ color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255).
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: CIE.XYZ) {
self.init(x: .init(colorConverting: other.x),
@@ -109,7 +109,7 @@ extension CIE.XYZ where Value: BinaryInteger {
/// from another XYZ color components object with floating point values.
/// - Parameter other: The other XYZ color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255).
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: CIE.XYZ) {
guard let x = Value(colorConvertingExactly: other.x),
@@ -124,7 +124,7 @@ extension CIE.XYZ where Value: BinaryFloatingPoint {
/// Creates new XYZ components from another XYZ color components object with integer values.
/// - Parameter other: The other XYZ color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0).
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: CIE.XYZ) {
self.init(x: .init(colorConverting: other.x),
@@ -136,7 +136,7 @@ extension CIE.XYZ where Value: BinaryFloatingPoint {
/// from another XYZ color components object with integer values.
/// - Parameter other: The other XYZ color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0).
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: CIE.XYZ) {
guard let x = Value(colorConvertingExactly: other.x),
@@ -148,7 +148,7 @@ extension CIE.XYZ where Value: BinaryFloatingPoint {
/// Creates new XYZ components from another XYZ color components object with floating point values.
/// - Parameter other: The other XYZ color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: CIE.XYZ) {
self.init(x: .init(other.x), y: .init(other.y), z: .init(other.z))
@@ -157,7 +157,7 @@ extension CIE.XYZ where Value: BinaryFloatingPoint {
/// Tries to create new XYZ components that exactly match the values
/// from another XYZ color components object with floating point values.
/// - Parameter other: The other XYZ color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: CIE.XYZ) {
guard let x = Value(exactly: other.x),
@@ -171,7 +171,7 @@ extension CIE.XYZ where Value: BinaryFloatingPoint {
extension CIE.XYZA where Value: BinaryInteger {
/// Creates new XYZA components from another XYZA color components object with integer values.
/// - Parameter other: The other XYZA color components.
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: CIE.XYZA) {
self.init(xyz: .init(other.xyz), alpha: .init(other.alpha))
@@ -180,7 +180,7 @@ extension CIE.XYZA where Value: BinaryInteger {
/// Tries to create new XYZA components that exactly match the values
/// from another XYZA color components object with integer values.
/// - Parameter other: The other XYZA color components.
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: CIE.XYZA) {
guard let xyz = CIE.XYZ(exactly: other.xyz),
@@ -192,7 +192,7 @@ extension CIE.XYZA where Value: BinaryInteger {
/// Creates new XYZA components from another XYZA color components object with floating point values.
/// - Parameter other: The other XYZA color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255).
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: CIE.XYZA) {
self.init(xyz: .init(other.xyz), alpha: .init(colorConverting: other.alpha))
@@ -202,7 +202,7 @@ extension CIE.XYZA where Value: BinaryInteger {
/// from another XYZA color components object with floating point values.
/// - Parameter other: The other XYZA color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255).
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: CIE.XYZA) {
guard let xyz = CIE.XYZ(exactly: other.xyz),
@@ -216,7 +216,7 @@ extension CIE.XYZA where Value: BinaryFloatingPoint {
/// Creates new XYZA components from another XYZA color components object with integer values.
/// - Parameter other: The other XYZA color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0).
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: CIE.XYZA) {
self.init(xyz: .init(other.xyz), alpha: .init(colorConverting: other.alpha))
@@ -226,7 +226,7 @@ extension CIE.XYZA where Value: BinaryFloatingPoint {
/// from another XYZA color components object with integer values.
/// - Parameter other: The other XYZA color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0).
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: CIE.XYZA) {
guard let xyz = CIE.XYZ(exactly: other.xyz),
@@ -237,7 +237,7 @@ extension CIE.XYZA where Value: BinaryFloatingPoint {
/// Creates new XYZA components from another XYZA color components object with floating point values.
/// - Parameter other: The other XYZA color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: CIE.XYZA) {
self.init(xyz: .init(other.xyz), alpha: .init(other.alpha))
@@ -246,7 +246,7 @@ extension CIE.XYZA where Value: BinaryFloatingPoint {
/// Tries to create new XYZA components that exactly match the values
/// from another XYZA color components object with floating point values.
/// - Parameter other: The other XYZA color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: CIE.XYZA) {
guard let xyz = CIE.XYZ(exactly: other.xyz),
diff --git a/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+AppKit.swift b/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+AppKit.swift
index 26562de4..c0d1f961 100644
--- a/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+AppKit.swift
+++ b/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+AppKit.swift
@@ -5,8 +5,8 @@ import AppKit
@available(tvOS, unavailable)
@available(watchOS, unavailable)
extension NSColorSpace {
- /// The default color space used by `CIE.XYZ` and `CIE.XYZA` to create `NSColor`s when no color space was specified.
- /// This is currently equivalent to `NSColorSpace.colorComponentsDefaultRGB`.
+ /// The default color space used by ``CIE/XYZ`` and ``CIE/XYZA`` to create `NSColor`s when no color space was specified.
+ /// This is currently equivalent to ``NSColorSpace/colorComponentsDefaultRGB``.
public static var colorComponentsDefaultCIEXYZ: NSColorSpace { .colorComponentsDefaultRGB }
}
@@ -22,7 +22,7 @@ extension NSColor {
/// Creates a new color using the given CIE.XYZ components and color space.
/// - Parameters:
/// - cieXYZ: The CIE.XYZ components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultCIEXYZ`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultCIEXYZ``.
@inlinable
public convenience init(_ cieXYZ: CIE.XYZ,
colorSpace: NSColorSpace = .colorComponentsDefaultCIEXYZ) {
@@ -32,7 +32,7 @@ extension NSColor {
/// Creates a new color using the given CIE.XYZA components and color space.
/// - Parameters:
/// - cieXYZA: The CIE.XYZA components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultCIEXYZ`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultCIEXYZ``.
@inlinable
public convenience init(_ cieXYZA: CIE.XYZA,
colorSpace: NSColorSpace = .colorComponentsDefaultCIEXYZ) {
@@ -42,7 +42,7 @@ extension NSColor {
/// Creates a new color using the given CIE.XYZ components and color space.
/// - Parameters:
/// - cieXYZ: The CIE.XYZ components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultCIEXYZ`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultCIEXYZ``.
@inlinable
public convenience init(_ cieXYZ: CIE.XYZ,
colorSpace: NSColorSpace = .colorComponentsDefaultCIEXYZ) {
@@ -52,7 +52,7 @@ extension NSColor {
/// Creates a new color using the given CIE.XYZA components and color space.
/// - Parameters:
/// - cieXYZA: The CIE.XYZA components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultCIEXYZ`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultCIEXYZ``.
@inlinable
public convenience init(_ cieXYZA: CIE.XYZA,
colorSpace: NSColorSpace = .colorComponentsDefaultCIEXYZ) {
@@ -71,7 +71,7 @@ extension NSColor {
extension CIE.XYZ where Value: BinaryFloatingPoint {
/// Creates new CIE.XYZ components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultCIEXYZ`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultCIEXYZ``
/// if it is not in a known CIE.XYZ color space.
@inlinable
public init(_ nsColor: NSColor) {
@@ -80,9 +80,9 @@ extension CIE.XYZ where Value: BinaryFloatingPoint {
/// Tries to create new CIE.XYZ components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultCIEXYZ`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultCIEXYZ``
/// if it is not in a known CIE.XYZ color space.
- /// - SeeAlso: `CIE.XYZ.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZ/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractCIEXYZA().xyz)
@@ -95,7 +95,7 @@ extension CIE.XYZ where Value: BinaryFloatingPoint {
extension CIE.XYZ where Value: BinaryInteger {
/// Creates new CIE.XYZ components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultCIEXYZ`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultCIEXYZ``
/// if it is not in a known CIE.XYZ color space.
@inlinable
public init(_ nsColor: NSColor) {
@@ -104,9 +104,9 @@ extension CIE.XYZ where Value: BinaryInteger {
/// Tries to create new CIE.XYZ components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultCIEXYZ`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultCIEXYZ``
/// if it is not in a known CIE.XYZ color space.
- /// - SeeAlso: `RGB.init(exactly:)`
+ /// - SeeAlso: ``RGB/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractCIEXYZA().xyz)
@@ -119,7 +119,7 @@ extension CIE.XYZ where Value: BinaryInteger {
extension CIE.XYZA where Value: BinaryFloatingPoint {
/// Creates new CIE.XYZA components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultCIEXYZ`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultCIEXYZ``
/// if it is not in a known CIE.XYZA color space.
@inlinable
public init(_ nsColor: NSColor) {
@@ -128,9 +128,9 @@ extension CIE.XYZA where Value: BinaryFloatingPoint {
/// Tries to create new CIE.XYZA components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultCIEXYZ`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultCIEXYZ``
/// if it is not in a known CIE.XYZ color space.
- /// - SeeAlso: `CIE.XYZA.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZA/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractCIEXYZA())
@@ -143,7 +143,7 @@ extension CIE.XYZA where Value: BinaryFloatingPoint {
extension CIE.XYZA where Value: BinaryInteger {
/// Creates new CIE.XYZA components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultCIEXYZ`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultCIEXYZ``
/// if it is not in a known CIE.XYZ color space.
@inlinable
public init(_ nsColor: NSColor) {
@@ -152,9 +152,9 @@ extension CIE.XYZA where Value: BinaryInteger {
/// Tries to create new CIE.XYZA components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultCIEXYZ`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultCIEXYZ``
/// if it is not in a known CIE.XYZ color space.
- /// - SeeAlso: `CIE.XYZA.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZA/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractCIEXYZA())
diff --git a/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+CoreGraphics.swift b/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+CoreGraphics.swift
index fd80b41e..3b50b874 100644
--- a/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+CoreGraphics.swift
+++ b/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+CoreGraphics.swift
@@ -54,7 +54,7 @@ extension CIE.XYZ where Value: BinaryFloatingPoint {
/// match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericXYZ` color space if necessary.
- /// - SeeAlso: `CIE.XYZ.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZ/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -83,7 +83,7 @@ extension CIE.XYZ where Value: BinaryInteger {
/// match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericXYZ` color space if necessary.
- /// - SeeAlso: `CIE.XYZ.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZ/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -111,7 +111,7 @@ extension CIE.XYZA where Value: BinaryFloatingPoint {
/// Tries to create new CIE.XYZA components that exactly match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericXYZ` color space if necessary.
- /// - SeeAlso: `RGBA.init(exactly:)`
+ /// - SeeAlso: ``RGBA/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -139,7 +139,7 @@ extension CIE.XYZA where Value: BinaryInteger {
/// Tries to create new CIE.XYZA components that exactly match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericXYZ` color space if necessary.
- /// - SeeAlso: `CIE.XYZA.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZA/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
diff --git a/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+SwiftUI.swift b/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+SwiftUI.swift
index b5fe850f..600bfbc0 100644
--- a/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+SwiftUI.swift
+++ b/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+SwiftUI.swift
@@ -68,7 +68,7 @@ extension CIE.XYZ where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `CIE.XYZ.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZ/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -90,7 +90,7 @@ extension CIE.XYZ where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `CIE.XYZ.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZ/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -112,7 +112,7 @@ extension CIE.XYZA where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `CIE.XYZA.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -134,7 +134,7 @@ extension CIE.XYZA where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `CIE.XYZA.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -159,7 +159,7 @@ extension CIE.XYZ where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `CIE.XYZ.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZ/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -183,7 +183,7 @@ extension CIE.XYZ where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `CIE.XYZ.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZ/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -207,7 +207,7 @@ extension CIE.XYZA where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `CIE.XYZA.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -231,7 +231,7 @@ extension CIE.XYZA where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `CIE.XYZA.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
diff --git a/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+UIKit.swift b/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+UIKit.swift
index a5e36d8c..c5f08460 100644
--- a/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+UIKit.swift
+++ b/Sources/ColorComponents/CIE/XYZ/Platforms/CIEXYZA+UIKit.swift
@@ -54,7 +54,7 @@ extension CIE.XYZ where Value: BinaryFloatingPoint {
/// Tries to create new CIE.XYZ components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `CIE.XYZ.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZ/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (cieXYZA, isExact) = uiColor._extractCIEXYZA()
@@ -74,7 +74,7 @@ extension CIE.XYZ where Value: BinaryInteger {
/// Tries to create new CIE.XYZ components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `CIE.XYZ.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZ/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (cieXYZA, isExact) = uiColor._extractCIEXYZA()
@@ -94,7 +94,7 @@ extension CIE.XYZA where Value: BinaryFloatingPoint {
/// Tries to create new CIE.XYZA components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `CIE.XYZA.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZA/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (cieXYZA, isExact) = uiColor._extractCIEXYZA()
@@ -114,7 +114,7 @@ extension CIE.XYZA where Value: BinaryInteger {
/// Tries to create new CIE.XYZA components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `CIE.XYZA.init(exactly:)`
+ /// - SeeAlso: ``CIE/XYZA/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (cieXYZA, isExact) = uiColor._extractCIEXYZA()
diff --git a/Sources/ColorComponents/ColorComponents.swift b/Sources/ColorComponents/ColorComponents.swift
index 3eb5d30c..6846dc34 100644
--- a/Sources/ColorComponents/ColorComponents.swift
+++ b/Sources/ColorComponents/ColorComponents.swift
@@ -1,7 +1,6 @@
/// The type of values that can be used with color components.
public typealias ColorCompontentValue = Hashable & Comparable & Numeric
-#if compiler(>=5.7)
/// Describes a type that represents (opaque) color components without an alpha channel.
public protocol ColorComponents: Hashable {
/// The value type of these color components.
@@ -15,7 +14,7 @@ public protocol AlphaColorComponents: ColorComponents {
}
/// Describes a type that represents (opaque) color components whose value is a floating point type.
-/// - SeeAlso: `ColorComponents`
+/// - SeeAlso: ``ColorComponents``
public protocol FloatingPointColorComponents: ColorComponents where Value: FloatingPoint {
/// The brightness of these color components.
var brightness: Value { get }
@@ -28,38 +27,8 @@ public protocol FloatingPointColorComponents: ColorComponents where Value
}
/// Describes a type that represents color components whose value is a floating point type.
-/// - SeeAlso: `AlphaColorComponents`
+/// - SeeAlso: ``AlphaColorComponents`` and ``FloatingPointColorComponents``
public typealias AlphaFloatingPointColorComponents = FloatingPointColorComponents & AlphaColorComponents
-#else
-/// Describes a type that represents (opaque) color components without an alpha channel.
-public protocol ColorComponents: Hashable {
- /// The value type of these color components.
- associatedtype Value: ColorCompontentValue
-}
-
-/// Describes a type that represents color components with an alpha channel.
-public protocol AlphaColorComponents: ColorComponents {
- /// The alpha component.
- var alpha: Value { get }
-}
-
-/// Describes a type that represents (opaque) color components whose value is a floating point type.
-/// - SeeAlso: `ColorComponents`
-public protocol FloatingPointColorComponents: ColorComponents where Value: FloatingPoint {
- /// The brightness of these color components.
- var brightness: Value { get }
-
- /// Changes the brightness by the given percent value.
- /// Pass 0.1 to increase brightness by 10%.
- /// Pass -0.1 to decrease brightness by 10%.
- /// - Parameter percent: The percentage amount to change the brightness.
- mutating func changeBrightness(by percent: Value)
-}
-
-/// Describes a type that represents color components whose value is a floating point type.
-/// - SeeAlso: `AlphaColorComponents`
-public typealias AlphaFloatingPointColorComponents = FloatingPointColorComponents & AlphaColorComponents
-#endif
extension AlphaColorComponents {
/// Returns whether these color components represent a clear color (`alpha` is zero).
@@ -68,24 +37,24 @@ extension AlphaColorComponents {
}
extension FloatingPointColorComponents where Value: ExpressibleByFloatLiteral {
- /// Returns whether these color components represent a dark color (`brightness` less than 0.5).
+ /// Returns whether these color components represent a dark color (``FloatingPointColorComponents/brightness`` less than 0.5).
@inlinable
public var isDarkColor: Bool { brightness < 0.5 }
- /// Returns whether these color components represent a light color (`brightness` greater than or equal to 0.5).
+ /// Returns whether these color components represent a light color (``FloatingPointColorComponents/brightness`` greater than or equal to 0.5).
@inlinable
public var isBrightColor: Bool { brightness >= 0.5 }
}
fileprivate extension ColorComponents {
- var _floatingPointPlaygroundSupport: _FloatingPointColorComponentsPlaygroundSupport? {
- self as? _FloatingPointColorComponentsPlaygroundSupport
+ var _floatingPointPlaygroundSupport: (any _FloatingPointColorComponentsPlaygroundSupport)? {
+ self as? any _FloatingPointColorComponentsPlaygroundSupport
}
}
fileprivate extension ColorComponents {
- var _binaryIntegerPlaygroundSupport: _BinaryIntegerColorComponentsPlaygroundSupport? {
- self as? _BinaryIntegerColorComponentsPlaygroundSupport
+ var _binaryIntegerPlaygroundSupport: (any _BinaryIntegerColorComponentsPlaygroundSupport)? {
+ self as? any _BinaryIntegerColorComponentsPlaygroundSupport
}
}
@@ -119,24 +88,24 @@ extension FloatingPointColorComponents {
extension BinaryInteger {
@inlinable
- init(colorConverting other: F) {
+ init(colorConverting other: some BinaryFloatingPoint) {
self.init(other * 0xFF)
}
@inlinable
- init?(colorConvertingExactly other: F) {
+ init?(colorConvertingExactly other: some BinaryFloatingPoint) {
self.init(exactly: other * 0xFF)
}
}
extension BinaryFloatingPoint {
@inlinable
- init(colorConverting other: I) {
+ init(colorConverting other: some BinaryInteger) {
self = Self(other) / 0xFF
}
@inlinable
- init?(colorConvertingExactly other: I) {
+ init?(colorConvertingExactly other: some BinaryInteger) {
guard let base = Self(exactly: other) else { return nil }
self = base / 0xFF
}
diff --git a/Sources/ColorComponents/HSBA/HSBA+HSLA.swift b/Sources/ColorComponents/HSBA/HSBA+HSLA.swift
index f97c2e80..fb2de9b5 100644
--- a/Sources/ColorComponents/HSBA/HSBA+HSLA.swift
+++ b/Sources/ColorComponents/HSBA/HSBA+HSLA.swift
@@ -12,7 +12,7 @@ extension HSB where Value: BinaryFloatingPoint {
extension HSBA where Value: BinaryFloatingPoint {
/// Creates new HSBA components using the given HSLA components.
/// - Parameter hsla: The HSLA components to convert to HSBA.
- /// - SeeAlso: `HSB.init(hsl:)`
+ /// - SeeAlso: ``HSB/init(hsl:)``
@inlinable
public init(hsla: HSLA) {
self.init(hsb: HSB(hsl: hsla.hsl), alpha: hsla.alpha)
@@ -31,7 +31,7 @@ extension HSB where Value: BinaryInteger {
extension HSBA where Value: BinaryInteger {
/// Creates new HSBA components using the given HSLA components.
/// - Parameter hsla: The HSLA components to convert to HSBA.
- /// - SeeAlso: `HSB.init(hsl:)`
+ /// - SeeAlso: ``HSB/init(hsl:)``
@inlinable
public init(hsla: HSLA) {
self.init(hsb: HSB(hsl: hsla.hsl), alpha: hsla.alpha)
diff --git a/Sources/ColorComponents/HSBA/HSBA+RGBA.swift b/Sources/ColorComponents/HSBA/HSBA+RGBA.swift
index 1cd92b5c..a5b6c851 100644
--- a/Sources/ColorComponents/HSBA/HSBA+RGBA.swift
+++ b/Sources/ColorComponents/HSBA/HSBA+RGBA.swift
@@ -12,7 +12,7 @@ extension HSB where Value: BinaryFloatingPoint {
extension HSBA where Value: BinaryFloatingPoint {
/// Creates new HSBA components using the given RGBA components.
/// - Parameter rgba: The RGBA components to convert to HSBA.
- /// - SeeAlso: `HSB.init(rgb:)`
+ /// - SeeAlso: ``HSB/init(rgb:)``
@inlinable
public init(rgba: RGBA) {
self.init(hsb: HSB(rgb: rgba.rgb), alpha: rgba.alpha)
@@ -31,7 +31,7 @@ extension HSB where Value: BinaryInteger {
extension HSBA where Value: BinaryInteger {
/// Creates new HSBA components using the given RGBA components.
/// - Parameter rgba: The RGBA components to convert to HSBA.
- /// - SeeAlso: `HSB.init(rgb:)`
+ /// - SeeAlso: ``HSB/init(rgb:)``
@inlinable
public init(rgba: RGBA) {
self.init(hsb: HSB(rgb: rgba.rgb), alpha: rgba.alpha)
diff --git a/Sources/ColorComponents/HSBA/HSBA.swift b/Sources/ColorComponents/HSBA/HSBA.swift
index 2ceb62eb..9452740d 100644
--- a/Sources/ColorComponents/HSBA/HSBA.swift
+++ b/Sources/ColorComponents/HSBA/HSBA.swift
@@ -30,7 +30,7 @@ public struct HSBA: AlphaColorComponents {
public var alpha: Value
/// The hue component.
- /// - SeeAlso: `HSB.hue`
+ /// - SeeAlso: ``HSB/hue``
@inlinable
public var hue: Value {
get { hsb.hue }
@@ -38,7 +38,7 @@ public struct HSBA: AlphaColorComponents {
}
/// The saturation component.
- /// - SeeAlso: `HSB.saturation`
+ /// - SeeAlso: ``HSB/saturation``
@inlinable
public var saturation: Value {
get { hsb.saturation }
@@ -46,7 +46,7 @@ public struct HSBA: AlphaColorComponents {
}
/// The brightness component.
- /// - SeeAlso: `HSB.brightness`
+ /// - SeeAlso: ``HSB/brightness``
@inlinable
public var brightness: Value {
get { hsb.brightness }
@@ -79,7 +79,7 @@ public typealias HSVA = HSBA
extension HSB where Value: BinaryInteger {
/// Creates new HSB components from another HSB color components object with integer values.
/// - Parameter other: The other HSB color components.
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: HSB) {
self.init(hue: .init(other.hue),
@@ -90,7 +90,7 @@ extension HSB where Value: BinaryInteger {
/// Tries to create new HSB components that exactly match the values
/// from another HSB color components object with integer values.
/// - Parameter other: The other HSB color components.
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: HSB) {
guard let hue = Value(exactly: other.hue),
@@ -103,7 +103,7 @@ extension HSB where Value: BinaryInteger {
/// Creates new HSB components from another HSB color components object with floating point values.
/// - Parameter other: The other HSB color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255) - including `hue`!
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: HSB) {
self.init(hue: .init(colorConverting: other.hue),
@@ -115,7 +115,7 @@ extension HSB where Value: BinaryInteger {
/// from another HSB color components object with floating point values.
/// - Parameter other: The other HSB color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255) - including `hue`!
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: HSB) {
guard let hue = Value(colorConvertingExactly: other.hue),
@@ -130,7 +130,7 @@ extension HSB where Value: BinaryFloatingPoint {
/// Creates new HSB components from another HSB color components object with integer values.
/// - Parameter other: The other HSB color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0) - including `hue`!.
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: HSB) {
self.init(hue: .init(colorConverting: other.hue),
@@ -142,7 +142,7 @@ extension HSB where Value: BinaryFloatingPoint {
/// from another HSB color components object with integer values.
/// - Parameter other: The other HSB color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0) - including `hue`!.
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: HSB) {
guard let hue = Value(colorConvertingExactly: other.hue),
@@ -154,7 +154,7 @@ extension HSB where Value: BinaryFloatingPoint {
/// Creates new HSB components from another HSB color components object with floating point values.
/// - Parameter other: The other HSB color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: HSB) {
self.init(hue: .init(other.hue),
@@ -165,7 +165,7 @@ extension HSB where Value: BinaryFloatingPoint {
/// Tries to create new HSB components that exactly match the values
/// from another HSB color components object with floating point values.
/// - Parameter other: The other HSB color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: HSB) {
guard let hue = Value(exactly: other.hue),
@@ -179,7 +179,7 @@ extension HSB where Value: BinaryFloatingPoint {
extension HSBA where Value: BinaryInteger {
/// Creates new HSBA components from another HSBA color components object with integer values.
/// - Parameter other: The other HSBA color components.
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: HSBA) {
self.init(hsb: .init(other.hsb), alpha: .init(other.alpha))
@@ -188,7 +188,7 @@ extension HSBA where Value: BinaryInteger {
/// Tries to create new HSBA components that exactly match the values
/// from another HSBA color components object with integer values.
/// - Parameter other: The other HSBA color components.
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: HSBA) {
guard let hsb = HSB(exactly: other.hsb),
@@ -200,7 +200,7 @@ extension HSBA where Value: BinaryInteger {
/// Creates new HSBA components from another HSBA color components object with floating point values.
/// - Parameter other: The other HSBA color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255) - including `hue`!
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: HSBA) {
self.init(hsb: .init(other.hsb), alpha: .init(colorConverting: other.alpha))
@@ -210,7 +210,7 @@ extension HSBA where Value: BinaryInteger {
/// from another HSBA color components object with floating point values.
/// - Parameter other: The other HSBA color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255) - including `hue`!
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: HSBA) {
guard let hsb = HSB(exactly: other.hsb),
@@ -224,7 +224,7 @@ extension HSBA where Value: BinaryFloatingPoint {
/// Creates new HSBA components from another HSBA color components object with integer values.
/// - Parameter other: The other HSBA color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0) - including `hue`!
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: HSBA) {
self.init(hsb: .init(other.hsb), alpha: .init(colorConverting: other.alpha))
@@ -234,7 +234,7 @@ extension HSBA where Value: BinaryFloatingPoint {
/// from another HSBA color components object with integer values.
/// - Parameter other: The other HSBA color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0) - including `hue`!
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: HSBA) {
guard let hsb = HSB(exactly: other.hsb),
@@ -245,7 +245,7 @@ extension HSBA where Value: BinaryFloatingPoint {
/// Creates new HSBA components from another HSBA color components object with floating point values.
/// - Parameter other: The other HSBA color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: HSBA) {
self.init(hsb: .init(other.hsb), alpha: .init(other.alpha))
@@ -254,7 +254,7 @@ extension HSBA where Value: BinaryFloatingPoint {
/// Tries to create new HSBA components that exactly match the values
/// from another HSBA color components object with floating point values.
/// - Parameter other: The other HSBA color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: HSBA) {
guard let hsb = HSB(exactly: other.hsb),
diff --git a/Sources/ColorComponents/HSBA/Platforms/HSBA+AppKit.swift b/Sources/ColorComponents/HSBA/Platforms/HSBA+AppKit.swift
index 4ab49704..ab08e89f 100644
--- a/Sources/ColorComponents/HSBA/Platforms/HSBA+AppKit.swift
+++ b/Sources/ColorComponents/HSBA/Platforms/HSBA+AppKit.swift
@@ -5,8 +5,8 @@ import AppKit
@available(tvOS, unavailable)
@available(watchOS, unavailable)
extension NSColorSpace {
- /// The default color space used by `HSB` and `HSBA` to create `NSColor`s when no color space was specified.
- /// This is currently equivalent to `NSColorSpace.colorComponentsDefaultRGB`.
+ /// The default color space used by ``HSB`` and ``HSBA`` to create `NSColor`s when no color space was specified.
+ /// This is currently equivalent to ``NSColorSpace/colorComponentsDefaultRGB``.
public static var colorComponentsDefaultHSB: NSColorSpace { .colorComponentsDefaultRGB }
}
@@ -30,7 +30,7 @@ extension NSColor {
/// Creates a new color using the given HSB components and color space.
/// - Parameters:
/// - hsb: The HSB components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultHSB`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultHSB``.
@inlinable
public convenience init(_ hsb: HSB,
colorSpace: NSColorSpace = .colorComponentsDefaultHSB) {
@@ -40,7 +40,7 @@ extension NSColor {
/// Creates a new color using the given HSBA components and color space.
/// - Parameters:
/// - hsba: The HSBA components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultHSB`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultHSB``.
@inlinable
public convenience init(_ hsba: HSBA,
colorSpace: NSColorSpace = .colorComponentsDefaultHSB) {
@@ -50,7 +50,7 @@ extension NSColor {
/// Creates a new color using the given HSB components and color space.
/// - Parameters:
/// - hsb: The HSB components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultHSB`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultHSB``.
@inlinable
public convenience init(_ hsb: HSB,
colorSpace: NSColorSpace = .colorComponentsDefaultHSB) {
@@ -60,7 +60,7 @@ extension NSColor {
/// Creates a new color using the given HSBA components and color space.
/// - Parameters:
/// - hsba: The HSBA components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultHSB`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultHSB``.
@inlinable
public convenience init(_ hsba: HSBA,
colorSpace: NSColorSpace = .colorComponentsDefaultHSB) {
@@ -84,7 +84,7 @@ extension NSColor {
extension HSB where Value: BinaryFloatingPoint {
/// Creates new HSB components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSB``
/// if it is not in a known HSB color space (which is the same as for RGB).
@inlinable
public init(_ nsColor: NSColor) {
@@ -93,9 +93,9 @@ extension HSB where Value: BinaryFloatingPoint {
/// Tries to create new HSB components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSB``
/// if it is not in a known HSB color space (which is the same as for RGB).
- /// - SeeAlso: `HSB.init(exactly:)`
+ /// - SeeAlso: ``HSB/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractHSBA().hsb)
@@ -108,7 +108,7 @@ extension HSB where Value: BinaryFloatingPoint {
extension HSB where Value: BinaryInteger {
/// Creates new HSB components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSB``
/// if it is not in a known HSB color space (which is the same as for RGB).
@inlinable
public init(_ nsColor: NSColor) {
@@ -117,9 +117,9 @@ extension HSB where Value: BinaryInteger {
/// Tries to create new HSB components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSB``
/// if it is not in a known HSB color space (which is the same as for RGB).
- /// - SeeAlso: `HSB.init(exactly:)`
+ /// - SeeAlso: ``HSB/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractHSBA().hsb)
@@ -132,7 +132,7 @@ extension HSB where Value: BinaryInteger {
extension HSBA where Value: BinaryFloatingPoint {
/// Creates new HSBA components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSB``
/// if it is not in a known HSB color space (which is the same as for RGB).
@inlinable
public init(_ nsColor: NSColor) {
@@ -141,9 +141,9 @@ extension HSBA where Value: BinaryFloatingPoint {
/// Tries to create new HSBA components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSB``
/// if it is not in a known HSB color space (which is the same as for RGB).
- /// - SeeAlso: `HSBA.init(exactly:)`
+ /// - SeeAlso: ``HSBA/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractHSBA())
@@ -156,7 +156,7 @@ extension HSBA where Value: BinaryFloatingPoint {
extension HSBA where Value: BinaryInteger {
/// Creates new HSBA components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSB``
/// if it is not in a known HSB color space (which is the same as for RGB).
@inlinable
public init(_ nsColor: NSColor) {
@@ -165,9 +165,9 @@ extension HSBA where Value: BinaryInteger {
/// Tries to create new HSBA components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSB``
/// if it is not in a known HSB color space (which is the same as for RGB).
- /// - SeeAlso: `HSBA.init(exactly:)`
+ /// - SeeAlso: ``HSBA/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractHSBA())
diff --git a/Sources/ColorComponents/HSBA/Platforms/HSBA+CoreGraphics.swift b/Sources/ColorComponents/HSBA/Platforms/HSBA+CoreGraphics.swift
index 7bd034fa..8d9631a9 100644
--- a/Sources/ColorComponents/HSBA/Platforms/HSBA+CoreGraphics.swift
+++ b/Sources/ColorComponents/HSBA/Platforms/HSBA+CoreGraphics.swift
@@ -20,7 +20,7 @@ extension HSB where Value: BinaryFloatingPoint {
/// match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericRGB` color space if necessary.
- /// - SeeAlso: `HSB.init(exactly:)`
+ /// - SeeAlso: ``HSB/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -48,7 +48,7 @@ extension HSB where Value: BinaryInteger {
/// match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericRGB` color space if necessary.
- /// - SeeAlso: `HSB.init(exactly:)`
+ /// - SeeAlso: ``HSB/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -75,7 +75,7 @@ extension HSBA where Value: BinaryFloatingPoint {
/// Tries to create new HSB components that exactly match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericRGB` color space if necessary.
- /// - SeeAlso: `HSBA.init(exactly:)`
+ /// - SeeAlso: ``HSBA/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -102,7 +102,7 @@ extension HSBA where Value: BinaryInteger {
/// Tries to create new HSB components that exactly match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericRGB` color space if necessary.
- /// - SeeAlso: `HSBA.init(exactly:)`
+ /// - SeeAlso: ``HSBA/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
diff --git a/Sources/ColorComponents/HSBA/Platforms/HSBA+SwiftUI.swift b/Sources/ColorComponents/HSBA/Platforms/HSBA+SwiftUI.swift
index b50c97c4..ec86aa91 100644
--- a/Sources/ColorComponents/HSBA/Platforms/HSBA+SwiftUI.swift
+++ b/Sources/ColorComponents/HSBA/Platforms/HSBA+SwiftUI.swift
@@ -71,7 +71,7 @@ extension HSB where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `HSB.init(exactly:)`
+ /// - SeeAlso: ``HSB/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -93,7 +93,7 @@ extension HSB where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `HSB.init(exactly:)`
+ /// - SeeAlso: ``HSB/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -115,7 +115,7 @@ extension HSBA where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `HSBA.init(exactly:)`
+ /// - SeeAlso: ``HSBA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -137,7 +137,7 @@ extension HSBA where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `HSBA.init(exactly:)`
+ /// - SeeAlso: ``HSBA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -162,7 +162,7 @@ extension HSB where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `HSB.init(exactly:)`
+ /// - SeeAlso: ``HSB/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -186,7 +186,7 @@ extension HSB where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `HSB.init(exactly:)`
+ /// - SeeAlso: ``HSB/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -210,7 +210,7 @@ extension HSBA where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `HSBA.init(exactly:)`
+ /// - SeeAlso: ``HSBA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -234,7 +234,7 @@ extension HSBA where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `HSBA.init(exactly:)`
+ /// - SeeAlso: ``HSBA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
diff --git a/Sources/ColorComponents/HSBA/Platforms/HSBA+UIKit.swift b/Sources/ColorComponents/HSBA/Platforms/HSBA+UIKit.swift
index 025d1402..74abd8c4 100644
--- a/Sources/ColorComponents/HSBA/Platforms/HSBA+UIKit.swift
+++ b/Sources/ColorComponents/HSBA/Platforms/HSBA+UIKit.swift
@@ -61,7 +61,7 @@ extension HSB where Value: BinaryFloatingPoint {
/// Tries to create new HSB components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `HSB.init(exactly:)`
+ /// - SeeAlso: ``HSB/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (hsba, isExact) = uiColor._extractHSBA()
@@ -81,7 +81,7 @@ extension HSB where Value: BinaryInteger {
/// Tries to create new HSB components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `HSB.init(exactly:)`
+ /// - SeeAlso: ``HSB/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (hsba, isExact) = uiColor._extractHSBA()
@@ -101,7 +101,7 @@ extension HSBA where Value: BinaryFloatingPoint {
/// Tries to create new HSBA components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `HSBA.init(exactly:)`
+ /// - SeeAlso: ``HSBA/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (hsba, isExact) = uiColor._extractHSBA()
@@ -121,7 +121,7 @@ extension HSBA where Value: BinaryInteger {
/// Tries to create new HSBA components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `HSBA.init(exactly:)`
+ /// - SeeAlso: ``HSBA/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (hsba, isExact) = uiColor._extractHSBA()
diff --git a/Sources/ColorComponents/HSLA/HSLA+HSBA.swift b/Sources/ColorComponents/HSLA/HSLA+HSBA.swift
index 24bead25..cacacc84 100644
--- a/Sources/ColorComponents/HSLA/HSLA+HSBA.swift
+++ b/Sources/ColorComponents/HSLA/HSLA+HSBA.swift
@@ -12,7 +12,7 @@ extension HSL where Value: BinaryFloatingPoint {
extension HSLA where Value: BinaryFloatingPoint {
/// Creates new HSLA components using the given HSBA components.
/// - Parameter hsba: The HSBA components to convert to HSLA.
- /// - SeeAlso: `HSL.init(hsb:)`
+ /// - SeeAlso: ``HSL/init(hsb:)``
@inlinable
public init(hsba: HSBA) {
self.init(hsl: HSL(hsb: hsba.hsb), alpha: hsba.alpha)
@@ -31,7 +31,7 @@ extension HSL where Value: BinaryInteger {
extension HSLA where Value: BinaryInteger {
/// Creates new HSLA components using the given HSBA components.
/// - Parameter hsba: The HSBA components to convert to HSLA.
- /// - SeeAlso: `HSL.init(hsb:)`
+ /// - SeeAlso: ``HSL/init(hsb:)``
@inlinable
public init(hsba: HSBA) {
self.init(hsl: HSL(hsb: hsba.hsb), alpha: hsba.alpha)
diff --git a/Sources/ColorComponents/HSLA/HSLA+RGBA.swift b/Sources/ColorComponents/HSLA/HSLA+RGBA.swift
index 5d01b903..2173516e 100644
--- a/Sources/ColorComponents/HSLA/HSLA+RGBA.swift
+++ b/Sources/ColorComponents/HSLA/HSLA+RGBA.swift
@@ -13,7 +13,7 @@ extension HSL where Value: BinaryFloatingPoint {
extension HSLA where Value: BinaryFloatingPoint {
/// Creates new HSLA components using the given RGBA components.
/// - Parameter rgba: The RGBA components to convert to HSLA.
- /// - SeeAlso: `HSL.init(rgb:)`
+ /// - SeeAlso: ``HSL/init(rgb:)``
@inlinable
public init(rgba: RGBA) {
self.init(hsl: HSL(rgb: rgba.rgb), alpha: rgba.alpha)
@@ -32,7 +32,7 @@ extension HSL where Value: BinaryInteger {
extension HSLA where Value: BinaryInteger {
/// Creates new HSLA components using the given RGBA components.
/// - Parameter rgba: The RGBA components to convert to HSLA.
- /// - SeeAlso: `HSL.init(rgb:)`
+ /// - SeeAlso: ``HSL/init(rgb:)``
@inlinable
public init(rgba: RGBA) {
self.init(hsl: HSL(rgb: rgba.rgb), alpha: rgba.alpha)
diff --git a/Sources/ColorComponents/HSLA/HSLA.swift b/Sources/ColorComponents/HSLA/HSLA.swift
index 7409a8fe..13299310 100644
--- a/Sources/ColorComponents/HSLA/HSLA.swift
+++ b/Sources/ColorComponents/HSLA/HSLA.swift
@@ -27,7 +27,7 @@ public struct HSLA: AlphaColorComponents {
public var alpha: Value
/// The hue component.
- /// - SeeAlso: `HSL.hue`
+ /// - SeeAlso: ``HSL/hue``
@inlinable
public var hue: Value {
get { hsl.hue }
@@ -35,7 +35,7 @@ public struct HSLA: AlphaColorComponents {
}
/// The saturation component.
- /// - SeeAlso: `HSL.saturation`
+ /// - SeeAlso: ``HSL/saturation``
@inlinable
public var saturation: Value {
get { hsl.saturation }
@@ -43,7 +43,7 @@ public struct HSLA: AlphaColorComponents {
}
/// The luminance component.
- /// - SeeAlso: `HSL.luminance`
+ /// - SeeAlso: ``HSL/luminance``
@inlinable
public var luminance: Value {
get { hsl.luminance }
@@ -73,7 +73,7 @@ public struct HSLA: AlphaColorComponents {
extension HSL where Value: BinaryInteger {
/// Creates new HSL components from another HSL color components object with integer values.
/// - Parameter other: The other HSL color components.
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: HSL) {
self.init(hue: .init(other.hue),
@@ -84,7 +84,7 @@ extension HSL where Value: BinaryInteger {
/// Tries to create new HSL components that exactly match the values
/// from another HSL color components object with integer values.
/// - Parameter other: The other HSL color components.
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: HSL) {
guard let hue = Value(exactly: other.hue),
@@ -97,7 +97,7 @@ extension HSL where Value: BinaryInteger {
/// Creates new HSL components from another HSL color components object with floating point values.
/// - Parameter other: The other HSL color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255) - including `hue`!
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: HSL) {
self.init(hue: .init(colorConverting: other.hue),
@@ -109,7 +109,7 @@ extension HSL where Value: BinaryInteger {
/// from another HSL color components object with floating point values.
/// - Parameter other: The other HSL color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255) - including `hue`!
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: HSL) {
guard let hue = Value(colorConvertingExactly: other.hue),
@@ -124,7 +124,7 @@ extension HSL where Value: BinaryFloatingPoint {
/// Creates new HSL components from another HSL color components object with integer values.
/// - Parameter other: The other HSL color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0) - including `hue`!.
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: HSL) {
self.init(hue: .init(colorConverting: other.hue),
@@ -136,7 +136,7 @@ extension HSL where Value: BinaryFloatingPoint {
/// from another HSB color components object with integer values.
/// - Parameter other: The other HSB color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0) - including `hue`!.
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: HSL) {
guard let hue = Value(colorConvertingExactly: other.hue),
@@ -148,7 +148,7 @@ extension HSL where Value: BinaryFloatingPoint {
/// Creates new HSL components from another HSL color components object with floating point values.
/// - Parameter other: The other HSL color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: HSL) {
self.init(hue: .init(other.hue),
@@ -159,7 +159,7 @@ extension HSL where Value: BinaryFloatingPoint {
/// Tries to create new HSL components that exactly match the values
/// from another HSL color components object with floating point values.
/// - Parameter other: The other HSB color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: HSL) {
guard let hue = Value(exactly: other.hue),
@@ -173,7 +173,7 @@ extension HSL where Value: BinaryFloatingPoint {
extension HSLA where Value: BinaryInteger {
/// Creates new HSLA components from another HSLA color components object with integer values.
/// - Parameter other: The other HSLA color components.
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: HSLA) {
self.init(hsl: .init(other.hsl), alpha: .init(other.alpha))
@@ -182,7 +182,7 @@ extension HSLA where Value: BinaryInteger {
/// Tries to create new HSLA components that exactly match the values
/// from another HSLA color components object with integer values.
/// - Parameter other: The other HSLA color components.
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: HSLA) {
guard let hsl = HSL(exactly: other.hsl),
@@ -194,7 +194,7 @@ extension HSLA where Value: BinaryInteger {
/// Creates new HSLA components from another HSLA color components object with floating point values.
/// - Parameter other: The other HSLA color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255) - including `hue`!
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: HSLA) {
self.init(hsl: .init(other.hsl), alpha: .init(colorConverting: other.alpha))
@@ -204,7 +204,7 @@ extension HSLA where Value: BinaryInteger {
/// from another HSLA color components object with floating point values.
/// - Parameter other: The other HSLA color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255) - including `hue`!
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: HSLA) {
guard let hsl = HSL(exactly: other.hsl),
@@ -218,7 +218,7 @@ extension HSLA where Value: BinaryFloatingPoint {
/// Creates new HSLA components from another HSLA color components object with integer values.
/// - Parameter other: The other HSLA color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0) - including `hue`!
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: HSLA) {
self.init(hsl: .init(other.hsl), alpha: .init(colorConverting: other.alpha))
@@ -228,7 +228,7 @@ extension HSLA where Value: BinaryFloatingPoint {
/// from another HSLA color components object with integer values.
/// - Parameter other: The other HSLA color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0) - including `hue`!
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: HSLA) {
guard let hsl = HSL(exactly: other.hsl),
@@ -239,7 +239,7 @@ extension HSLA where Value: BinaryFloatingPoint {
/// Creates new HSLA components from another HSLA color components object with floating point values.
/// - Parameter other: The other HSLA color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: HSLA) {
self.init(hsl: .init(other.hsl), alpha: .init(other.alpha))
@@ -248,7 +248,7 @@ extension HSLA where Value: BinaryFloatingPoint {
/// Tries to create new HSLA components that exactly match the values
/// from another HSLA color components object with floating point values.
/// - Parameter other: The other HSLA color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: HSLA) {
guard let hsl = HSL(exactly: other.hsl),
diff --git a/Sources/ColorComponents/HSLA/Platforms/HSLA+AppKit.swift b/Sources/ColorComponents/HSLA/Platforms/HSLA+AppKit.swift
index ba16fb33..701bd699 100644
--- a/Sources/ColorComponents/HSLA/Platforms/HSLA+AppKit.swift
+++ b/Sources/ColorComponents/HSLA/Platforms/HSLA+AppKit.swift
@@ -5,8 +5,8 @@ import AppKit
@available(tvOS, unavailable)
@available(watchOS, unavailable)
extension NSColorSpace {
- /// The default color space used by `HSL` and `HSLA` to create `NSColor`s when no color space was specified.
- /// This is currently equivalent to `NSColorSpace.colorComponentsDefaultRGB`.
+ /// The default color space used by ``HSL`` and ``HSLA`` to create `NSColor`s when no color space was specified.
+ /// This is currently equivalent to ``NSColorSpace/colorComponentsDefaultRGB``.
public static var colorComponentsDefaultHSL: NSColorSpace { .colorComponentsDefaultRGB }
}
@@ -17,7 +17,7 @@ extension NSColor {
/// Creates a new color using the given HSL components and color space.
/// - Parameters:
/// - hsl: The HSL components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultHSL`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultHSL``.
@inlinable
public convenience init(_ hsl: HSL,
colorSpace: NSColorSpace = .colorComponentsDefaultHSL) {
@@ -27,7 +27,7 @@ extension NSColor {
/// Creates a new color using the given HSLA components and color space.
/// - Parameters:
/// - hsla: The HSLA components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultHSL`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultHSL``.
@inlinable
public convenience init(_ hsla: HSLA,
colorSpace: NSColorSpace = .colorComponentsDefaultHSL) {
@@ -37,7 +37,7 @@ extension NSColor {
/// Creates a new color using the given HSL components and color space.
/// - Parameters:
/// - hsb: The HSL components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultHSL`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultHSL``.
@inlinable
public convenience init(_ hsl: HSL,
colorSpace: NSColorSpace = .colorComponentsDefaultHSL) {
@@ -47,7 +47,7 @@ extension NSColor {
/// Creates a new color using the given HSLA components and color space.
/// - Parameters:
/// - hsla: The HSLA components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultHSL`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultHSL``.
@inlinable
public convenience init(_ hsla: HSLA,
colorSpace: NSColorSpace = .colorComponentsDefaultHSL) {
@@ -66,7 +66,7 @@ extension NSColor {
extension HSL where Value: BinaryFloatingPoint {
/// Creates new HSL components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSL`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSL``
/// if it is not in a known HSL color space (which is the same as for RGB).
@inlinable
public init(_ nsColor: NSColor) {
@@ -75,9 +75,9 @@ extension HSL where Value: BinaryFloatingPoint {
/// Tries to create new HSL components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSL`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSL``
/// if it is not in a known HSL color space (which is the same as for RGB).
- /// - SeeAlso: `HSL.init(exactly:)`
+ /// - SeeAlso: ``HSL/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractHSLA().hsl)
@@ -90,7 +90,7 @@ extension HSL where Value: BinaryFloatingPoint {
extension HSL where Value: BinaryInteger {
/// Creates new HSL components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSL`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSL``
/// if it is not in a known HSL color space (which is the same as for RGB).
@inlinable
public init(_ nsColor: NSColor) {
@@ -99,9 +99,9 @@ extension HSL where Value: BinaryInteger {
/// Tries to create new HSL components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSL`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSL``
/// if it is not in a known HSL color space (which is the same as for RGB).
- /// - SeeAlso: `HSB.init(exactly:)`
+ /// - SeeAlso: ``HSB/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractHSLA().hsl)
@@ -114,7 +114,7 @@ extension HSL where Value: BinaryInteger {
extension HSLA where Value: BinaryFloatingPoint {
/// Creates new HSLA components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSL`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSL``
/// if it is not in a known HSL color space (which is the same as for RGB).
@inlinable
public init(_ nsColor: NSColor) {
@@ -123,9 +123,9 @@ extension HSLA where Value: BinaryFloatingPoint {
/// Tries to create new HSLA components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSL`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSL``
/// if it is not in a known HSL color space (which is the same as for RGB).
- /// - SeeAlso: `HSLA.init(exactly:)`
+ /// - SeeAlso: ``HSLA/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractHSLA())
@@ -138,7 +138,7 @@ extension HSLA where Value: BinaryFloatingPoint {
extension HSLA where Value: BinaryInteger {
/// Creates new HSLA components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSL`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSL``
/// if it is not in a known HSL color space (which is the same as for RGB).
@inlinable
public init(_ nsColor: NSColor) {
@@ -147,9 +147,9 @@ extension HSLA where Value: BinaryInteger {
/// Tries to create new HSLA components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultHSL`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultHSL``
/// if it is not in a known HSL color space (which is the same as for RGB).
- /// - SeeAlso: `HSLA.init(exactly:)`
+ /// - SeeAlso: ``HSLA/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractHSLA())
diff --git a/Sources/ColorComponents/HSLA/Platforms/HSLA+CoreGraphics.swift b/Sources/ColorComponents/HSLA/Platforms/HSLA+CoreGraphics.swift
index 3172beb6..39ccf19f 100644
--- a/Sources/ColorComponents/HSLA/Platforms/HSLA+CoreGraphics.swift
+++ b/Sources/ColorComponents/HSLA/Platforms/HSLA+CoreGraphics.swift
@@ -20,7 +20,7 @@ extension HSL where Value: BinaryFloatingPoint {
/// match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericRGB` color space if necessary.
- /// - SeeAlso: `HSL.init(exactly:)`
+ /// - SeeAlso: ``HSL/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -48,7 +48,7 @@ extension HSL where Value: BinaryInteger {
/// match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericRGB` color space if necessary.
- /// - SeeAlso: `HSL.init(exactly:)`
+ /// - SeeAlso: ``HSL/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -75,7 +75,7 @@ extension HSLA where Value: BinaryFloatingPoint {
/// Tries to create new HSL components that exactly match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericRGB` color space if necessary.
- /// - SeeAlso: `HSLA.init(exactly:)`
+ /// - SeeAlso: ``HSLA/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -102,7 +102,7 @@ extension HSLA where Value: BinaryInteger {
/// Tries to create new HSL components that exactly match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericRGB` color space if necessary.
- /// - SeeAlso: `HSLA.init(exactly:)`
+ /// - SeeAlso: ``HSLA/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
diff --git a/Sources/ColorComponents/HSLA/Platforms/HSLA+SwiftUI.swift b/Sources/ColorComponents/HSLA/Platforms/HSLA+SwiftUI.swift
index 12e388b2..99556c22 100644
--- a/Sources/ColorComponents/HSLA/Platforms/HSLA+SwiftUI.swift
+++ b/Sources/ColorComponents/HSLA/Platforms/HSLA+SwiftUI.swift
@@ -62,7 +62,7 @@ extension HSL where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `HSL.init(exactly:)`
+ /// - SeeAlso: ``HSL/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -84,7 +84,7 @@ extension HSL where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `HSL.init(exactly:)`
+ /// - SeeAlso: ``HSL/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -106,7 +106,7 @@ extension HSLA where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `HSLA.init(exactly:)`
+ /// - SeeAlso: ``HSLA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -128,7 +128,7 @@ extension HSLA where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `HSLA.init(exactly:)`
+ /// - SeeAlso: ``HSLA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -153,7 +153,7 @@ extension HSL where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `HSL.init(exactly:)`
+ /// - SeeAlso: ``HSL/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -177,7 +177,7 @@ extension HSL where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `HSL.init(exactly:)`
+ /// - SeeAlso: ``HSL/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -201,7 +201,7 @@ extension HSLA where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `HSLA.init(exactly:)`
+ /// - SeeAlso: ``HSLA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -225,7 +225,7 @@ extension HSLA where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `HSLA.init(exactly:)`
+ /// - SeeAlso: ``HSLA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
diff --git a/Sources/ColorComponents/HSLA/Platforms/HSLA+UIKit.swift b/Sources/ColorComponents/HSLA/Platforms/HSLA+UIKit.swift
index 834c1ebd..f7b99cfe 100644
--- a/Sources/ColorComponents/HSLA/Platforms/HSLA+UIKit.swift
+++ b/Sources/ColorComponents/HSLA/Platforms/HSLA+UIKit.swift
@@ -49,7 +49,7 @@ extension HSL where Value: BinaryFloatingPoint {
/// Tries to create new HSL components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `HSL.init(exactly:)`
+ /// - SeeAlso: ``HSL/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (hsla, isExact) = uiColor._extractHSLA()
@@ -69,7 +69,7 @@ extension HSL where Value: BinaryInteger {
/// Tries to create new HSL components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `HSL.init(exactly:)`
+ /// - SeeAlso: ``HSL/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (hsla, isExact) = uiColor._extractHSLA()
@@ -89,7 +89,7 @@ extension HSLA where Value: BinaryFloatingPoint {
/// Tries to create new HSLA components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `HSLA.init(exactly:)`
+ /// - SeeAlso: ``HSLA/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (hsla, isExact) = uiColor._extractHSLA()
@@ -109,7 +109,7 @@ extension HSLA where Value: BinaryInteger {
/// Tries to create new HSLA components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `HSLA.init(exactly:)`
+ /// - SeeAlso: ``HSLA/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (hsla, isExact) = uiColor._extractHSLA()
diff --git a/Sources/ColorComponents/Helpers/CGColor+RequireColorSpace.swift b/Sources/ColorComponents/Helpers/CGColor+RequireColorSpace.swift
index 49f9fa64..3154aa89 100644
--- a/Sources/ColorComponents/Helpers/CGColor+RequireColorSpace.swift
+++ b/Sources/ColorComponents/Helpers/CGColor+RequireColorSpace.swift
@@ -26,9 +26,9 @@ extension CGColor {
}
@usableFromInline
- func _requireCompontens(in range: R, file: StaticString = #file, line: UInt = #line) -> Array
- where R.Bound == Int
- {
+ func _requireCompontens(in range: some RangeExpression,
+ file: StaticString = #file,
+ line: UInt = #line) -> Array {
guard range.contains(numberOfComponents), let components = components
else { fatalError("CGColor has no or an invalid number of components: \(self)", file: file, line: line) }
return components
diff --git a/Sources/ColorComponents/RGBA/Platforms/RGBA+AppKit.swift b/Sources/ColorComponents/RGBA/Platforms/RGBA+AppKit.swift
index c66e2e8e..152b5905 100644
--- a/Sources/ColorComponents/RGBA/Platforms/RGBA+AppKit.swift
+++ b/Sources/ColorComponents/RGBA/Platforms/RGBA+AppKit.swift
@@ -5,7 +5,7 @@ import AppKit
@available(tvOS, unavailable)
@available(watchOS, unavailable)
extension NSColorSpace {
- /// The default color space used by `RGB` and `RGBA` to create `NSColor`s when no color space was specified.
+ /// The default color space used by ``RGB`` and ``RGBA`` to create `NSColor`s when no color space was specified.
/// This is currently equivalent to `NSColorSpace.deviceRGB`.
public static var colorComponentsDefaultRGB: NSColorSpace { .deviceRGB }
}
@@ -27,7 +27,7 @@ extension NSColor {
/// Creates a new color using the given RGB components and color space.
/// - Parameters:
/// - rgb: The RGB components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultRGB`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultRGB``.
@inlinable
public convenience init(_ rgb: RGB,
colorSpace: NSColorSpace = .colorComponentsDefaultRGB) {
@@ -37,7 +37,7 @@ extension NSColor {
/// Creates a new color using the given RGBA components and color space.
/// - Parameters:
/// - rgba: The RGBA components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultRGB`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultRGB``.
@inlinable
public convenience init(_ rgba: RGBA,
colorSpace: NSColorSpace = .colorComponentsDefaultRGB) {
@@ -47,7 +47,7 @@ extension NSColor {
/// Creates a new color using the given RGB components and color space.
/// - Parameters:
/// - rgb: The RGB components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultRGB`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultRGB``.
@inlinable
public convenience init(_ rgb: RGB,
colorSpace: NSColorSpace = .colorComponentsDefaultRGB) {
@@ -57,7 +57,7 @@ extension NSColor {
/// Creates a new color using the given RGBA components and color space.
/// - Parameters:
/// - rgba: The RGBA components.
- /// - colorSpace: The color space to use. Defaults to `NSColorSpace.colorComponentsDefaultRGB`.
+ /// - colorSpace: The color space to use. Defaults to ``NSColorSpace/colorComponentsDefaultRGB``.
@inlinable
public convenience init(_ rgba: RGBA,
colorSpace: NSColorSpace = .colorComponentsDefaultRGB) {
@@ -89,7 +89,7 @@ extension NSColor {
extension RGB where Value: BinaryFloatingPoint {
/// Creates new RGB components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultRGB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultRGB``
/// if it is not in a known RGB color space.
@inlinable
public init(_ nsColor: NSColor) {
@@ -98,9 +98,9 @@ extension RGB where Value: BinaryFloatingPoint {
/// Tries to create new RGB components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultRGB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultRGB``
/// if it is not in a known RGB color space.
- /// - SeeAlso: `RGB.init(exactly:)`
+ /// - SeeAlso: ``RGB/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractRGBA().rgb)
@@ -113,7 +113,7 @@ extension RGB where Value: BinaryFloatingPoint {
extension RGB where Value: BinaryInteger {
/// Creates new RGB components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultRGB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultRGB``
/// if it is not in a known RGB color space.
@inlinable
public init(_ nsColor: NSColor) {
@@ -122,9 +122,9 @@ extension RGB where Value: BinaryInteger {
/// Tries to create new RGB components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultRGB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultRGB``
/// if it is not in a known RGB color space.
- /// - SeeAlso: `RGB.init(exactly:)`
+ /// - SeeAlso: ``RGB/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractRGBA().rgb)
@@ -137,7 +137,7 @@ extension RGB where Value: BinaryInteger {
extension RGBA where Value: BinaryFloatingPoint {
/// Creates new RGBA components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultRGB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultRGB``
/// if it is not in a known RGB color space.
@inlinable
public init(_ nsColor: NSColor) {
@@ -146,9 +146,9 @@ extension RGBA where Value: BinaryFloatingPoint {
/// Tries to create new RGBA components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultRGB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultRGB``
/// if it is not in a known RGB color space.
- /// - SeeAlso: `RGBA.init(exactly:)`
+ /// - SeeAlso: ``RGBA/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractRGBA())
@@ -161,7 +161,7 @@ extension RGBA where Value: BinaryFloatingPoint {
extension RGBA where Value: BinaryInteger {
/// Creates new RGBA components from the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultRGB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultRGB``
/// if it is not in a known RGB color space.
@inlinable
public init(_ nsColor: NSColor) {
@@ -170,9 +170,9 @@ extension RGBA where Value: BinaryInteger {
/// Tries to create new RGBA components that exactly match the components of the given color.
/// - Parameter nsColor: The color to read the components from.
- /// - Note: This will convert the color to `NSColorSpace.colorComponentsDefaultRGB`
+ /// - Note: This will convert the color to ``NSColorSpace/colorComponentsDefaultRGB``
/// if it is not in a known RGB color space.
- /// - SeeAlso: `RGBA.init(exactly:)`
+ /// - SeeAlso: ``RGBA/init(exactly:)``
@inlinable
public init?(exactly nsColor: NSColor) {
self.init(exactly: nsColor._extractRGBA())
diff --git a/Sources/ColorComponents/RGBA/Platforms/RGBA+CoreGraphics.swift b/Sources/ColorComponents/RGBA/Platforms/RGBA+CoreGraphics.swift
index 83f06c38..e87b09e8 100644
--- a/Sources/ColorComponents/RGBA/Platforms/RGBA+CoreGraphics.swift
+++ b/Sources/ColorComponents/RGBA/Platforms/RGBA+CoreGraphics.swift
@@ -42,7 +42,7 @@ extension RGB where Value: BinaryFloatingPoint {
/// match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericRGB` color space if necessary.
- /// - SeeAlso: `RGB.init(exactly:)`
+ /// - SeeAlso: ``RGB/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -71,7 +71,7 @@ extension RGB where Value: BinaryInteger {
/// match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericRGB` color space if necessary.
- /// - SeeAlso: `RGB.init(exactly:)`
+ /// - SeeAlso: ``RGB/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -99,7 +99,7 @@ extension RGBA where Value: BinaryFloatingPoint {
/// Tries to create new RGB components that exactly match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericRGB` color space if necessary.
- /// - SeeAlso: `RGBA.init(exactly:)`
+ /// - SeeAlso: ``RGBA/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
@@ -127,7 +127,7 @@ extension RGBA where Value: BinaryInteger {
/// Tries to create new RGB components that exactly match the components of the given color.
/// - Parameter cgColor: The color to read the components from.
/// - Note: This will convert the color to the `kCGColorSpaceGenericRGB` color space if necessary.
- /// - SeeAlso: `RGBA.init(exactly:)`
+ /// - SeeAlso: ``RGBA/init(exactly:)``
@available(macOS 10.11, iOS 10, tvOS 10, watchOS 3, *)
@inlinable
public init?(exactly cgColor: CGColor) {
diff --git a/Sources/ColorComponents/RGBA/Platforms/RGBA+SwiftUI.swift b/Sources/ColorComponents/RGBA/Platforms/RGBA+SwiftUI.swift
index fd09f3d7..f8957291 100644
--- a/Sources/ColorComponents/RGBA/Platforms/RGBA+SwiftUI.swift
+++ b/Sources/ColorComponents/RGBA/Platforms/RGBA+SwiftUI.swift
@@ -68,7 +68,7 @@ extension RGB where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `RGB.init(exactly:)`
+ /// - SeeAlso: ``RGB/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -90,7 +90,7 @@ extension RGB where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `RGB.init(exactly:)`
+ /// - SeeAlso: ``RGB/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -112,7 +112,7 @@ extension RGBA where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `RGBA.init(exactly:)`
+ /// - SeeAlso: ``RGBA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -134,7 +134,7 @@ extension RGBA where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through the platform native color (`NSColor` or `UIColor`)
/// due to the lack of component accessors on `SwiftUI.Color`.
- /// - SeeAlso: `RGBA.init(exactly:)`
+ /// - SeeAlso: ``RGBA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
self.init(exactly: _PlatformColor(color))
@@ -159,7 +159,7 @@ extension RGB where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `RGB.init(exactly:)`
+ /// - SeeAlso: ``RGB/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -183,7 +183,7 @@ extension RGB where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `RGB.init(exactly:)`
+ /// - SeeAlso: ``RGB/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -207,7 +207,7 @@ extension RGBA where Value: BinaryFloatingPoint {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `RGBA.init(exactly:)`
+ /// - SeeAlso: ``RGBA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
@@ -231,7 +231,7 @@ extension RGBA where Value: BinaryInteger {
/// - Parameter color: The color to read the components from.
/// - Note: This currently goes through `CGColor` due to the lack of component accessors on `SwiftUI.Color`.
/// - Note: This returns `nil` if `cgColor` on `color` is `nil`, or if the exact conversion fails.
- /// - SeeAlso: `RGBA.init(exactly:)`
+ /// - SeeAlso: ``RGBA/init(exactly:)``
@inlinable
public init?(exactly color: Color) {
guard let cgColor = color.cgColor else { return nil }
diff --git a/Sources/ColorComponents/RGBA/Platforms/RGBA+UIKit.swift b/Sources/ColorComponents/RGBA/Platforms/RGBA+UIKit.swift
index 414cd9f5..b500f4f0 100644
--- a/Sources/ColorComponents/RGBA/Platforms/RGBA+UIKit.swift
+++ b/Sources/ColorComponents/RGBA/Platforms/RGBA+UIKit.swift
@@ -58,7 +58,7 @@ extension RGB where Value: BinaryFloatingPoint {
/// Tries to create new RGB components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `RGB.init(exactly:)`
+ /// - SeeAlso: ``RGB/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (rgba, isExact) = uiColor._extractRGBA()
@@ -78,7 +78,7 @@ extension RGB where Value: BinaryInteger {
/// Tries to create new RGB components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `RGB.init(exactly:)`
+ /// - SeeAlso: ``RGB/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (rgba, isExact) = uiColor._extractRGBA()
@@ -98,7 +98,7 @@ extension RGBA where Value: BinaryFloatingPoint {
/// Tries to create new RGBA components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `RGBA.init(exactly:)`
+ /// - SeeAlso: ``RGBA/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (rgba, isExact) = uiColor._extractRGBA()
@@ -118,7 +118,7 @@ extension RGBA where Value: BinaryInteger {
/// Tries to create new RGBA components that exactly match the components of the given color.
/// - Parameter uiColor: The color to read the components from.
- /// - SeeAlso: `RGBA.init(exactly:)`
+ /// - SeeAlso: ``RGBA/init(exactly:)``
@inlinable
public init?(exactly uiColor: UIColor) {
let (rgba, isExact) = uiColor._extractRGBA()
diff --git a/Sources/ColorComponents/RGBA/RGBA+HSLA.swift b/Sources/ColorComponents/RGBA/RGBA+HSLA.swift
index b5e7dd95..ae8850e5 100644
--- a/Sources/ColorComponents/RGBA/RGBA+HSLA.swift
+++ b/Sources/ColorComponents/RGBA/RGBA+HSLA.swift
@@ -10,7 +10,7 @@ extension RGB where Value: BinaryFloatingPoint {
extension RGBA where Value: BinaryFloatingPoint {
/// Creates new RGBA components using the given HSLA components.
/// - Parameter hsla: The HSLA components to convert to RGBA.
- /// - SeeAlso: `RGB.init(hsl:)`
+ /// - SeeAlso: ``RGB/init(hsl:)``
@inlinable
public init(hsla: HSLA) {
self.init(rgb: RGB(hsl: hsla.hsl), alpha: hsla.alpha)
@@ -29,7 +29,7 @@ extension RGB where Value: BinaryInteger {
extension RGBA where Value: BinaryInteger {
/// Creates new RGBA components using the given HSLA components.
/// - Parameter hsla: The HSLA components to convert to RGBA.
- /// - SeeAlso: `RGB.init(hsl:)`
+ /// - SeeAlso: ``RGB/init(hsl:)``
@inlinable
public init(hsla: HSLA) {
self.init(rgb: RGB(hsl: hsla.hsl), alpha: hsla.alpha)
diff --git a/Sources/ColorComponents/RGBA/RGBA.swift b/Sources/ColorComponents/RGBA/RGBA.swift
index 73b0d583..d37a0df3 100644
--- a/Sources/ColorComponents/RGBA/RGBA.swift
+++ b/Sources/ColorComponents/RGBA/RGBA.swift
@@ -27,7 +27,7 @@ public struct RGBA: AlphaColorComponents {
public var alpha: Value
/// The red component.
- /// - SeeAlso: `RGB.red`
+ /// - SeeAlso: ``RGB/red``
@inlinable
public var red: Value {
get { rgb.red }
@@ -35,7 +35,7 @@ public struct RGBA: AlphaColorComponents {
}
/// The green component.
- /// - SeeAlso: `RGB.green`
+ /// - SeeAlso: ``RGB/green``
@inlinable
public var green: Value {
get { rgb.green }
@@ -43,7 +43,7 @@ public struct RGBA: AlphaColorComponents {
}
/// The green component.
- /// - SeeAlso: `RGB.green`
+ /// - SeeAlso: ``RGB/green``
@inlinable
public var blue: Value {
get { rgb.blue }
@@ -73,7 +73,7 @@ public struct RGBA: AlphaColorComponents {
extension RGB where Value: BinaryInteger {
/// Creates new RGB components from another RGB color components object with integer values.
/// - Parameter other: The other RGB color components.
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: RGB) {
self.init(red: .init(other.red), green: .init(other.green), blue: .init(other.blue))
@@ -82,7 +82,7 @@ extension RGB where Value: BinaryInteger {
/// Tries to create new RGB components that exactly match the values
/// from another RGB color components object with integer values.
/// - Parameter other: The other RGB color components.
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: RGB) {
guard let red = Value(exactly: other.red),
@@ -95,7 +95,7 @@ extension RGB where Value: BinaryInteger {
/// Creates new RGB components from another RGB color components object with floating point values.
/// - Parameter other: The other RGB color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255).
- /// - SeeAlso: `BinaryInteger.init(_:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init(_ other: RGB) {
self.init(red: .init(colorConverting: other.red),
@@ -107,7 +107,7 @@ extension RGB where Value: BinaryInteger {
/// from another RGB color components object with floating point values.
/// - Parameter other: The other RGB color components.
/// - Note: This will convert the floating point values (0.0 - 1.0) to integer values (0 - 255).
- /// - SeeAlso: `BinaryInteger.init(exactly:)`
+ /// - SeeAlso: ``BinaryInteger/init(_:)``
@inlinable
public init?(exactly other: RGB) {
guard let red = Value(colorConvertingExactly: other.red),
@@ -122,7 +122,7 @@ extension RGB where Value: BinaryFloatingPoint {
/// Creates new RGB components from another RGB color components object with integer values.
/// - Parameter other: The other RGB color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0).
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: RGB) {
self.init(red: .init(colorConverting: other.red),
@@ -134,7 +134,7 @@ extension RGB where Value: BinaryFloatingPoint {
/// from another RGB color components object with integer values.
/// - Parameter other: The other RGB color components.
/// - Note: This will convert the integer values (0 - 255) to floating point values (0.0 - 1.0).
- /// - SeeAlso: `BinaryFloatingPoint.init(exactly:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init?(exactly other: RGB) {
guard let red = Value(colorConvertingExactly: other.red),
@@ -146,7 +146,7 @@ extension RGB where Value: BinaryFloatingPoint {
/// Creates new RGB components from another RGB color components object with floating point values.
/// - Parameter other: The other RGB color components.
- /// - SeeAlso: `BinaryFloatingPoint.init(_:)`
+ /// - SeeAlso: ``BinaryFloatingPoint/init(_:)``
@inlinable
public init(_ other: RGB