[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7018":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":34,"discoverSource":35},7018,"DynamicColor","yannickl\u002FDynamicColor","yannickl","Yet another extension to manipulate colors easily in Swift and SwiftUI","http:\u002F\u002Fcocoadocs.org\u002Fdocsets\u002FDynamicColor",null,"Swift",3085,146,50,15,0,2,58.7,"MIT License",false,"master",true,[24,25,26,27,28,29,30],"color","gradient","hex","hex-strings","nscolor","swiftui","uicolor","2026-06-12 04:00:31","\u003Cp align=\"center\">\n  \u003Cimg src=\"http:\u002F\u002Fyannickloriot.com\u002Fresources\u002Fdynamiccolor-header.png\" alt=\"DynamicColor\">\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"http:\u002F\u002Fcocoadocs.org\u002Fdocsets\u002FDynamicColor\u002F\">\u003Cimg alt=\"Supported Platforms\" src=\"https:\u002F\u002Fcocoapod-badges.herokuapp.com\u002Fp\u002FDynamicColor\u002Fbadge.svg\"\u002F>\u003C\u002Fa>\n  \u003Ca href=\"http:\u002F\u002Fcocoadocs.org\u002Fdocsets\u002FDynamicColor\u002F\">\u003Cimg alt=\"Version\" src=\"https:\u002F\u002Fcocoapod-badges.herokuapp.com\u002Fv\u002FDynamicColor\u002Fbadge.svg\"\u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FCarthage\u002FCarthage\">\u003Cimg alt=\"Carthage compatible\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FCarthage-%E2%9C%93-brightgreen.svg?style=flat\"\u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fapple\u002Fswift-package-manager\">\u003Cimg alt=\"Swift Package Manager compatible\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FSPM-%E2%9C%93-brightgreen.svg?style=flat\"\u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Ftravis-ci.org\u002Fyannickl\u002FDynamicColor\">\u003Cimg alt=\"Build status\" src=\"https:\u002F\u002Ftravis-ci.org\u002Fyannickl\u002FDynamicColor.svg?branch=master\"\u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fcodecov.io\u002Fgh\u002Fyannickl\u002FDynamicColor\">\u003Cimg src=\"https:\u002F\u002Fcodecov.io\u002Fgh\u002Fyannickl\u002FDynamicColor\u002Fbranch\u002Fmaster\u002Fgraph\u002Fbadge.svg\" \u002F>\u003C\u002Fa>\n\u003C\u002Fp>\n\n**DynamicColor** provides powerful methods to manipulate colors in an easy way in Swift and SwiftUI.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"http:\u002F\u002Fyannickloriot.com\u002Fresources\u002Fdynamiccolor-sample-screenshot.png\" alt=\"example screenshot\" width=\"300\" \u002F>\n  \u003Cimg src=\"http:\u002F\u002Fyannickloriot.com\u002Fresources\u002Fdynamicgradient-sample-screenshot.png\" alt=\"example screenshot\" width=\"300\" \u002F>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n    \u003Ca href=\"#requirements\">Requirements\u003C\u002Fa> • \u003Ca href=\"#usage\">Usage\u003C\u002Fa> • \u003Ca href=\"#installation\">Installation\u003C\u002Fa> • \u003Ca href=\"#contribution\">Contribution\u003C\u002Fa> • \u003Ca href=\"#contact\">Contact\u003C\u002Fa> • \u003Ca href=\"#license-mit\">License\u003C\u002Fa>\n\u003C\u002Fp>\n\n## Requirements\n\n- iOS 11.0+ \u002F Mac OS X 10.11+ \u002F tvOS 11.0+ \u002F watchOS 4.0+\n- Xcode 10.2+\n- Swift 5.0+\n\n## Usage\n\n#### Creation (Hex String)\n\nFirstly, DynamicColor provides useful initializers to create colors using hex strings or values:\n\n```swift\nlet color = UIColor(hexString: \"#3498db\")\n\u002F\u002F equivalent to\n\u002F\u002F color = UIColor(hex: 0x3498db)\n```\n\nTo be platform independent, the typealias `DynamicColor` can also be used:\n\n```swift\nlet color = DynamicColor(hex: 0x3498db)\n\u002F\u002F On iOS, WatchOS or tvOS, equivalent to\n\u002F\u002F color = UIColor(hex: 0x3498db)\n\u002F\u002F On OSX, equivalent to\n\u002F\u002F color = NSColor(hex: 0x3498db)\n```\n\nYou can also retrieve the RGBA value and components very easily using multiple methods like `toHexString`, `toHex`, `toRGBA`, etc.\n\n##### SwiftUI\n\nFrom the v5, DynamicColor also support basic methods to create and manipulate colors with SwiftUI.\n\n```swift\nlet color = Color(hex: 0x3498db)\n```\n\n#### Darken & Lighten\n\nThese two create a new color by adjusting the lightness of the receiver. You have to use a value between 0 and 1.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"http:\u002F\u002Fyannickloriot.com\u002Fresources\u002Fdynamiccolor-darkenlighten.png\" alt=\"lighten and darken color\" width=\"280\"\u002F>\n\u003C\u002Fp>\n\n```swift\nlet originalColor = DynamicColor(hexString: \"#c0392b\")\n\nlet lighterColor = originalColor.lighter()\n\u002F\u002F equivalent to\n\u002F\u002F lighterColor = originalColor.lighter(amount: 0.2)\n\nlet darkerColor = originalColor.darkened()\n\u002F\u002F equivalent to\n\u002F\u002F darkerColor = originalColor.darkened(amount: 0.2)\n```\n\n#### Saturate, Desaturate & Grayscale\n\nThese will adjust the saturation of the color object, much like `darkened` and `lighter` adjusted the lightness. Again, you need to use a value between 0 and 1.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"http:\u002F\u002Fyannickloriot.com\u002Fresources\u002Fdynamiccolor-saturateddesaturatedgrayscale.png\" alt=\"saturate, desaturate and grayscale color\" width=\"373\"\u002F>\n\u003C\u002Fp>\n\n```swift\nlet originalColor = DynamicColor(hexString: \"#c0392b\")\n\nlet saturatedColor = originalColor.saturated()\n\u002F\u002F equivalent to\n\u002F\u002F saturatedColor = originalColor.saturated(amount: 0.2)\n\nlet desaturatedColor = originalColor.desaturated()\n\u002F\u002F equivalent to\n\u002F\u002F desaturatedColor = originalColor.desaturated(amount: 0.2)\n\n\u002F\u002F equivalent to\n\u002F\u002F let grayscaledColor = originalColor.grayscaled(mode: .luminance)\nlet grayscaledColor = originalColor.grayscaled()\n\nlet grayscaledColorLuminance = originalColor.grayscaled(mode: .luminance)\nlet grayscaledColorLightness = originalColor.grayscaled(mode: .lightness)\nlet grayscaledColorAverage = originalColor.grayscaled(mode: .average)\nlet grayscaledColorValue = originalColor.grayscaled(mode: .value)\n```\n\n#### Adjust-hue & Complement\n\nThese adjust the hue value of the color in the same way like the others do. Again, it takes a value between 0 and 1 to update the value.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"http:\u002F\u002Fyannickloriot.com\u002Fresources\u002Fdynamiccolor-adjustedhuecomplement.png\" alt=\"ajusted-hue and complement color\" width=\"280\"\u002F>\n\u003C\u002Fp>\n\n```swift\nlet originalColor = DynamicColor(hex: 0xc0392b)\n\n\u002F\u002F Hue values are in degrees\nlet adjustHueColor = originalColor.adjustedHue(amount: 45)\n\nlet complementedColor = originalColor.complemented()\n````\n\n#### Tint & Shade\n\nA tint is the mixture of a color with white and a shade is the mixture of a color with black. Again, it takes a value between 0 and 1 to update the value.\n\n\u003Cp align=\"center\">\n\u003Cimg src=\"http:\u002F\u002Fyannickloriot.com\u002Fresources\u002Fdynamiccolor-tintshadecolor.png\" alt=\"tint and shade color\" width=\"280\"\u002F>\n\u003C\u002Fp>\n\n```swift\nlet originalColor = DynamicColor(hexString: \"#c0392b\")\n\nlet tintedColor = originalColor.tinted()\n\u002F\u002F equivalent to\n\u002F\u002F tintedColor = originalColor.tinted(amount: 0.2)\n\nlet shadedColor = originalColor.shaded()\n\u002F\u002F equivalent to\n\u002F\u002F shadedColor = originalColor.shaded(amount: 0.2)\n```\n\n#### Invert\n\nThis can invert the color object. The red, green, and blue values are inverted, while the opacity is left alone.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"http:\u002F\u002Fyannickloriot.com\u002Fresources\u002Fdynamiccolor-invert.png\" alt=\"invert color\" width=\"187\"\u002F>\n\u003C\u002Fp>\n\n```swift\nlet originalColor = DynamicColor(hexString: \"#c0392b\")\n\nlet invertedColor = originalColor.inverted()\n```\n\n#### Mix\n\nThis can mix a given color with the receiver. It takes the average of each of the RGB components, optionally weighted by the given percentage (value between 0 and 1).\n\n\u003Cp align=\"center\">\n\u003Cimg src=\"http:\u002F\u002Fyannickloriot.com\u002Fresources\u002Fdynamiccolor-mixcolor.png\" alt=\"mix color\" width=\"373\"\u002F>\n\u003C\u002Fp>\n\n```swift\nlet originalColor = DynamicColor(hexString: \"#c0392b\")\n\nlet mixedColor = originalColor.mixed(withColor: .blue)\n\u002F\u002F equivalent to\n\u002F\u002F mixedColor = originalColor.mixed(withColor: .blue, weight: 0.5)\n\u002F\u002F or\n\u002F\u002F mixedColor = originalColor.mixed(withColor: .blue, weight: 0.5, inColorSpace: .rgb)\n```\n\n#### Gradients\n\n**DynamicColor** provides an useful object to work with gradients: **DynamicGradient**. It'll allow you to pick color from gradients, or to build a palette using different color spaces (.e.g.: *RGB*, *HSL*, *HSB*, *Cie L\\*a\\*b\\**).\n\nLet's define our reference colors and the gradient object:\n```swift\nlet blue   = UIColor(hexString: \"#3498db\")\nlet red    = UIColor(hexString: \"#e74c3c\")\nlet yellow = UIColor(hexString: \"#f1c40f\")\n\nlet gradient = DynamicGradient(colors: [blue, red, yellow])\n\u002F\u002F equivalent to\n\u002F\u002F let gradient = [blue, red, yellow].gradient\n```\n\n##### RGB\n\nLet's build the RGB palette (the default color space) with 8 colors:\n\n\u003Cp align=\"center\">\n\u003Cimg src=\"http:\u002F\u002Fyannickloriot.com\u002Fresources\u002Fdynamicgradient-rgb\" alt=\"RGB gradient\"\u002F>\n\u003C\u002Fp>\n\n```swift\nlet rgbPalette = gradient.colorPalette(amount: 8)\n```\n\n##### HSL\n\nNow if you want to change the gradient color space to have a different effect, just write the following lines:\n\n\u003Cp align=\"center\">\n\u003Cimg src=\"http:\u002F\u002Fyannickloriot.com\u002Fresources\u002Fdynamicgradient-hsl\" alt=\"HSL gradient\"\u002F>\n\u003C\u002Fp>\n\n```swift\nlet hslPalette = gradient.colorPalette(amount: 8, inColorSpace: .hsl)\n```\n\n##### Cie L\\*a\\*b\\*\n\nOr if you prefer to work directly with array of colors, you can:\n\n\u003Cp align=\"center\">\n\u003Cimg src=\"http:\u002F\u002Fyannickloriot.com\u002Fresources\u002Fdynamicgradient-lab\" alt=\"Cie L*a*b* gradient\"\u002F>\n\u003C\u002Fp>\n\n```swift\nlet labPalette = [blue, red, yellow].gradient.colorPalette(amount: 8, inColorSpace: .lab)\n```\n\n#### And many more...\n\n`DynamicColor` also provides many another useful methods to manipulate the colors like hex strings, color components, color spaces, etc. To go further, take a look at the example project.\n\n## Installation\n\n#### CocoaPods\n\nInstall CocoaPods if not already available:\n\n``` bash\n$ [sudo] gem install cocoapods\n$ pod setup\n```\nGo to the directory of your Xcode project, and Create and Edit your *Podfile* and add _DynamicColor_:\n\n``` bash\n$ cd \u002Fpath\u002Fto\u002FMyProject\n$ touch Podfile\n$ edit Podfile\nsource 'https:\u002F\u002Fgithub.com\u002FCocoaPods\u002FSpecs.git'\nplatform :ios, '8.0'\n\nuse_frameworks!\npod 'DynamicColor', '~> 5.0.0'\n```\n\nInstall into your project:\n\n``` bash\n$ pod install\n```\n\nOpen your project in Xcode from the .xcworkspace file (not the usual project file):\n\n``` bash\n$ open MyProject.xcworkspace\n```\n\nYou can now `import DynamicColor` framework into your files.\n\n#### Carthage\n\n[Carthage](https:\u002F\u002Fgithub.com\u002FCarthage\u002FCarthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.\n\nYou can install Carthage with [Homebrew](http:\u002F\u002Fbrew.sh\u002F) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate `DynamicColor` into your Xcode project using Carthage, specify it in your `Cartfile` file:\n\n```ogdl\ngithub \"yannickl\u002FDynamicColor\" >= 5.0.0\n```\n\n#### Swift Package Manager\nYou can use [The Swift Package Manager](https:\u002F\u002Fswift.org\u002Fpackage-manager) to install `DynamicColor` by adding the proper description to your `Package.swift` file:\n```swift\nimport PackageDescription\n\nlet package = Package(\n    name: \"YOUR_PROJECT_NAME\",\n    targets: [],\n    dependencies: [\n        .package(url: \"https:\u002F\u002Fgithub.com\u002Fyannickl\u002FDynamicColor.git\", from: \"5.0.0\")\n    ]\n)\n```\n\nNote that the [Swift Package Manager](https:\u002F\u002Fswift.org\u002Fpackage-manager) is still in early design and development, for more information checkout its [GitHub Page](https:\u002F\u002Fgithub.com\u002Fapple\u002Fswift-package-manager).\n\n#### Manually\n\n[Download](https:\u002F\u002Fgithub.com\u002FYannickL\u002FDynamicColor\u002Farchive\u002Fmaster.zip) the project and copy the `DynamicColor` folder into your project to use it in.\n\n## Contribution\n\nContributions are welcomed and encouraged *♡*.\n\n## Contact\n\nYannick Loriot\n - [https:\u002F\u002F21.co\u002Fyannickl\u002F](https:\u002F\u002F21.co\u002Fyannickl\u002F)\n - [https:\u002F\u002Ftwitter.com\u002Fyannickloriot](https:\u002F\u002Ftwitter.com\u002Fyannickloriot)\n\n## License (MIT)\n\nCopyright (c) 2015-present - Yannick Loriot\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and\u002For sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","DynamicColor 是一个用于在 Swift 和 SwiftUI 中轻松操作颜色的扩展库。其核心功能包括通过十六进制字符串创建颜色、支持跨平台的颜色类型（如 iOS 上的 UIColor 和 macOS 上的 NSColor），以及对颜色进行加深或减淡处理等。此外，它还提供了便捷的方法来获取颜色的 RGBA 值和其他属性。该库非常适合需要在 Apple 生态系统中统一处理颜色的应用场景，尤其是当开发者希望简化颜色管理逻辑时。支持从 iOS 11.0+ 到最新的 watchOS 版本，并且兼容 Xcode 10.2+ 和 Swift 5.0+。","2026-06-11 03:10:10","top_language"]