{"id":16991045,"url":"https://github.com/gin66/scientificcolormaps","last_synced_at":"2025-04-15T15:12:23.658Z","repository":{"id":250739265,"uuid":"835316132","full_name":"gin66/ScientificColorMaps","owner":"gin66","description":"Scientific Colormaps from Fabio Crameri ported to Swift","archived":false,"fork":false,"pushed_at":"2025-03-10T20:55:29.000Z","size":8868,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T15:12:18.559Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gin66.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-29T15:28:10.000Z","updated_at":"2025-03-10T20:55:32.000Z","dependencies_parsed_at":"2025-03-10T21:28:42.984Z","dependency_job_id":"e77e3fe3-5b9d-427f-884f-d595413d9e73","html_url":"https://github.com/gin66/ScientificColorMaps","commit_stats":null,"previous_names":["gin66/scientificcolormaps"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin66%2FScientificColorMaps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin66%2FScientificColorMaps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin66%2FScientificColorMaps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin66%2FScientificColorMaps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gin66","download_url":"https://codeload.github.com/gin66/ScientificColorMaps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249094933,"owners_count":21211837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T03:24:40.019Z","updated_at":"2025-04-15T15:12:23.639Z","avatar_url":"https://github.com/gin66.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Scientific Color Maps\n\nA collection of scientifically accurate color maps for use in data visualization.\n\n## Overview\n\nThis package provides a set of pre-defined color maps that can be used to visualize data. Each color map is designed to accurately represent the underlying data, taking into account human perception and color theory.\n\n## Features\n\n* 32 scientifically accurate color maps, each with its own unique characteristics and uses.\n* Categorized palettes for easy selection and use.\n* Support for discrete color sampling (10, 25, 50, and 100 samples).\n* Easy to use and integrate into your Swift project.\n* Colors are easily convertible to `CGColor`, `NSColor`, `UIColor`, `CIColor`, `SKColor`, `simd_float3`\n\n## Usage\n\nTo use the color maps in this package, simply import it into your Swift project and use the global instance of the desired color map. For example:\n\n```swift\nimport ScientificColorMaps\n\nlet colorMap = ScientificColorMap.batlow\n```\n\n## Color Representation - ScientificColor\n\nEach color is stored as platform agnostic `ScientificColor`. Internally the color components are stored as red, green, blue and represented as Float. Each Float is in the range 0 to 1. The raw values can be obtained by accessing the instances' constants: `red`, `green` and `blue`. ScientificColor is Sendable, Equatable and Hashable.\n\nThis type provides conversions to `UIColor`, `NSColor`, `CIColor`, `SKColor`, `simd_float3` if the respective type is available. Either by a generic:\n```swift\n    public func into\u003cT\u003e() -\u003e T\n```\nOr direct conversions:\n* `asTuple() -\u003e (red: Float, green: Float, blue: Float)`\n* `asArray() -\u003e [Float]`\n* `asCGColor() -\u003e CGColor`\n* `asCIColor() -\u003e CIColor`\n* `asNSColor() -\u003e NSColor`\n* `asUIColor() -\u003e UIColor`\n* `asSimd() -\u003e simd_float3`\n\nEvery ScientificColor comes with an index value, which is not included in hash or equation test.\nIt provides the `index: Int` (0-255) of the related color into the respective palette. If the categorized palette is used, then `categoryIndex: Int?` is not nil and gives the color's index of the category (0-99).\n\n## List of Color palettes\nEvery color palette offers 256 colors\n`ScientificColorMap.palettes() -\u003e [ScientificColorMap]`\n\n## List of Color palettes with categories\nAll color palettes, which offer in addition 100 categories\n`ScientificColorMap.categorizedPalettes() -\u003e [ScientificColorMap]`\n\n## API of ScientificColorMap\n* `name` ... String\n* `rgb_data` ... array of 256 `[ScientificColor]`\n* `categorical` ... array of 100 `[ScientificColor]` if defined, otherwise nil\n* `discrete10() -\u003e [ScientificColor]` ... subset of 10 colors\n* `discrete25() -\u003e [ScientificColor]` ... subset of 25 colors\n* `discrete50() -\u003e [ScientificColor)]` ... subset of 50 colors\n* `discrete100() -\u003e [ScientificColor]` ... subset of 100 colors\n* `mapToColor(value: Float, minValue: Float = 0, maxValue: Float = 1) -\u003e ScientificColor`\n\n# Code generator\n\nJust run `swift run CodeGenerator` in the package directory, which will (re-)create the color palette swift files in folder `Sources/ScientificColorMaps/ColorMaps`\n\n# Color Deficiency Simulation\n\nThe color deficiency simulation is based on:\n[A Physiologically-based Model for Simulation of Color Vision Deficiency](https://www.inf.ufrgs.br/%7Eoliveira/pubs_files/CVD_Simulation/CVD_Simulation.html)\n\nThe functionality is only available, if simd can be imported. The enum `ColorDeficiency` will be provided,\nwhich offers the different anomalies: protanomaly, deuteranomaly and tritanomaly with possibility to\nadjust the severity from 0 - none to 1 - full.\n\nThe enum provides the function `mapRGB(rgb: simd_float3) -\u003e simd_float3` to map the actual rgb value to a simulated rgb value, which is from view under color deficiency.\n\nTo illustrate the inner contrast, there are diagrams generated using `swift run GenerateDiagram` and stored in the folder Diagrams. The simulated delta for the colormap `discrete50()` in the folder `range` and first 10 of `categorical` in the folder `categorical`. The resulting images are squares with the colormaps` color along each axis and the color value represents the difference between the colors. The upper left triangle is the difference between the color along x- and y-axis. The two lower right triangles illustrates the contrast to white and black as background color. For the difference of the color is the WCAG-contrast calculated between the rgb-values. \n\n# Note:\n\nAPI may change\n\n# Colors\n\n![Colormaps](./ScientificColourMaps8/+ScientificColourMaps8-FabioCrameri.png)\n\n# License\n\nThis package is licensed under the MIT License. The color data has its own license. See in the respective file +LICENCE.pdf\n\nThe package WCAG-Colors and its package dependency comes with its own licenses. The package is only used to create the diagrams and not part of the library itself.\n\n## Acknowledgments\n\n* This package was generated using data from Version 8.0.1 of the Scientific Colour Maps, available at \u003chttps://www.fabiocrameri.ch/colourmaps/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgin66%2Fscientificcolormaps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgin66%2Fscientificcolormaps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgin66%2Fscientificcolormaps/lists"}