{"id":27624307,"url":"https://github.com/simple-color-palette/spec","last_synced_at":"2025-04-23T11:28:43.543Z","repository":{"id":287336506,"uuid":"964392668","full_name":"simple-color-palette/spec","owner":"simple-color-palette","description":"Specification for the Simple Color Palette format","archived":false,"fork":false,"pushed_at":"2025-04-18T12:30:46.000Z","size":4,"stargazers_count":18,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T01:46:43.130Z","etag":null,"topics":["color-palette","colors","json","simple-color-palette","specification"],"latest_commit_sha":null,"homepage":"https://simplecolorpalette.com","language":null,"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/simple-color-palette.png","metadata":{"files":{"readme":"readme.md","changelog":null,"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,"zenodo":null}},"created_at":"2025-04-11T06:28:03.000Z","updated_at":"2025-04-18T23:55:43.000Z","dependencies_parsed_at":"2025-04-11T09:05:31.782Z","dependency_job_id":"59b1961c-96de-45b4-a2be-a7ce9bdff0dc","html_url":"https://github.com/simple-color-palette/spec","commit_stats":null,"previous_names":["simple-color-palette/spec"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simple-color-palette%2Fspec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simple-color-palette%2Fspec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simple-color-palette%2Fspec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simple-color-palette%2Fspec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simple-color-palette","download_url":"https://codeload.github.com/simple-color-palette/spec/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250424471,"owners_count":21428369,"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":["color-palette","colors","json","simple-color-palette","specification"],"created_at":"2025-04-23T11:28:42.885Z","updated_at":"2025-04-23T11:28:43.537Z","avatar_url":"https://github.com/simple-color-palette.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Color Palette Spec v0.1\n\n\u003e A minimal JSON-based file format for defining color palettes\n\nIt uses [extended linear sRGB](#what-is-extended-linear-srgb) with optional opacity.\n\n[Learn more ›](https://simplecolorpalette.com)\n\n[**Feedback wanted!**](https://github.com/simple-color-palette/spec/issues)\n\n\u003e [!CAUTION]\n\u003e Work in progress.\n\n## Links\n\n- [JSON Schema](schema.json) *(v0.1)*\n\n## JSON Structure\n\n```json\n{\n\t\"name\": \"Favorites\",\n\t\"colors\": [\n\t\t{\n\t\t\t\"name\": \"Hot Pink\",\n\t\t\t\"components\": [1, 0.1274, 0.418]\n\t\t},\n\t\t{\n\t\t\t\"components\": [0.592, 0.278, 0.996, 0.9]\n\t\t}\n\t]\n}\n```\n\n- Palette name is optional.\n- Color name is optional.\n- Opacity is optional.\n\n## Details\n\n### Top-level Object\n\n- `name`: Optional. String. Name of the palette. If omitted, use the filename without extension.\n- `colors`: Required. Array of color entries.\n\n### Color Entry\n\nEach color is an object with the following fields:\n\n- `name`: Optional. String.\n- `components`: Required. Array of 3 or 4 floating-point numbers.\n\t- `[red, green, blue]` or `[red, green, blue, opacity]`\n\t- The color should use extended linear sRGB color space.\n\t- The color components can be negative and more than 1.\n\t- The opacity defaults to 1 if omitted.\n\t- The opacity should be clamped to `0...1` range when reading and writing the palette. It should not throw if outside the range.\n\n### Numeric Precision\n\nAll numeric values in the color components array must be stored with a maximum of 4 decimal places, using banker's rounding (round-half-to-even) when needed. For example, 0.12345 becomes 0.1235, while 0.12350 rounds to 0.1235 (nearest even). This applies to both RGB components and opacity.\n\n#### Why 4 Decimal Places?\n\n- Provides up to 10000 distinct values per component (0 to 10000).\n- Exceeds human color perception capabilities.\n- Matches or exceeds most display technology precision.\n- Sufficient for HDR and professional color work.\n- Enables reliable color deduplication and comparison.\n- Preserves color identity through format conversions and rounding errors.\n\n#### Implementation Considerations\n\n- Use banker's rounding to prevent statistical bias.\n- Perform calculations at full precision.\n- Apply rounding only for final storage or display.\n- Validate that stored values never exceed 4 decimal places.\n\n#### Example (Swift)\n\n```swift\nextension Double {\n\t/**\n\tRounds the number to specified decimal places using banker's rounding.\n\n\t- Parameter places: Number of decimal places (must be \u003e= 0).\n\t- Returns: The rounded number.\n\t*/\n\tfunc rounded(toPlaces places: Int) -\u003e Self {\n\t\tguard places \u003e= 0 else {\n\t\t\treturn self\n\t\t}\n\n\t\tlet multiplier = pow(10.0, Self(places))\n\t\treturn (self * multiplier).rounded(.toNearestOrEven) / multiplier\n\t}\n}\n\nlet number = 3.14159265359\nnumber.rounded(toPlaces: 4)\n//=\u003e 3.1416\n```\n\n## Format\n\n### File Extension\n\n`.color-palette`\n\n### MIME Type\n\n```\napplication/x.sindresorhus.simple-color-palette+json\n```\n\n*(temporary)*\n\n### Uniform Type Identifier\n\n```\ncom.sindresorhus.simple-color-palette\n```\n\n#### Swift example\n\n```swift\nextension UTType {\n\tstatic var simpleColorPalette: Self { .init(importedAs: \"com.sindresorhus.simple-color-palette\", conformingTo: .json) }\n}\n```\n\n#### `Info.plist` example\n\n```xml\n\u003ckey\u003eUTImportedTypeDeclarations\u003c/key\u003e\n\u003carray\u003e\n\t\u003cdict\u003e\n\t\t\u003ckey\u003eUTTypeIdentifier\u003c/key\u003e\n\t\t\u003cstring\u003ecom.sindresorhus.simple-color-palette\u003c/string\u003e\n\t\t\u003ckey\u003eUTTypeDescription\u003c/key\u003e\n\t\t\u003cstring\u003eSimple Color Palette\u003c/string\u003e\n\t\t\u003ckey\u003eUTTypeConformsTo\u003c/key\u003e\n\t\t\u003carray\u003e\n\t\t\t\u003cstring\u003epublic.json\u003c/string\u003e\n\t\t\u003c/array\u003e\n\t\t\u003ckey\u003eUTTypeTagSpecification\u003c/key\u003e\n\t\t\u003cdict\u003e\n\t\t\t\u003ckey\u003epublic.filename-extension\u003c/key\u003e\n\t\t\t\u003carray\u003e\n\t\t\t\t\u003cstring\u003ecolor-palette\u003c/string\u003e\n\t\t\t\u003c/array\u003e\n\t\t\t\u003ckey\u003epublic.mime-type\u003c/key\u003e\n\t\t\t\u003cstring\u003eapplication/x.sindresorhus.simple-color-palette+json\u003c/string\u003e\n\t\t\u003c/dict\u003e\n\t\u003c/dict\u003e\n\u003c/array\u003e\n\u003ckey\u003eCFBundleDocumentTypes\u003c/key\u003e\n\u003carray\u003e\n\t\u003cdict\u003e\n\t\t\u003ckey\u003eCFBundleTypeName\u003c/key\u003e\n\t\t\u003cstring\u003eSimple Color Palette\u003c/string\u003e\n\t\t\u003ckey\u003eLSItemContentTypes\u003c/key\u003e\n\t\t\u003carray\u003e\n\t\t\t\u003cstring\u003ecom.sindresorhus.simple-color-palette\u003c/string\u003e\n\t\t\u003c/array\u003e\n\t\t\u003ckey\u003eCFBundleTypeExtensions\u003c/key\u003e\n\t\t\u003carray\u003e\n\t\t\t\u003cstring\u003ecolor-palette\u003c/string\u003e\n\t\t\u003c/array\u003e\n\t\t\u003ckey\u003eCFBundleTypeRole\u003c/key\u003e\n\t\t\u003cstring\u003eViewer\u003c/string\u003e\n\t\t\u003ckey\u003eLSHandlerRank\u003c/key\u003e\n\t\t\u003cstring\u003eAlternate\u003c/string\u003e\n\t\u003c/dict\u003e\n\u003c/array\u003e\n```\n\n## FAQ\n\n### Why JSON?\n\n- Human-readable.\n- Ubiquitous and supported everywhere.\n- Easy to parse in any language.\n\n### Why is the color space hard-coded?\n\n- Simplicity and clarity - no ambiguity about color interpretation.\n- Avoiding the complexity of color space conversion and management.\n- Color space conversion is better handled at the app level when needed.\n\n### What is “extended linear sRGB”?\n\nThe same color space as [sRGB](https://en.wikipedia.org/wiki/SRGB) but with two differences:\n1. Extended: Values can go beyond 0-1 for HDR colors.\n1. Linear: Raw RGB values without [gamma correction](https://en.wikipedia.org/wiki/Gamma_correction).\n\n### What is gamma correction?\n\nStandard sRGB uses a non-linear encoding to match human perception. This format uses raw linear values instead - better for color computations but requires conversion (gamma correction) for display.\n\n### Why extended sRGB?\n\n- Allows values outside 0-1 range for HDR and wide-gamut colors.\n- Simple extension of familiar sRGB.\n- Easy to clamp to standard sRGB when needed.\n\n### Why linear color?\n\n- Eliminates gamma correction ambiguity.\n- More accurate color blending and interpolation.\n\n### Why not Display P3 or other color spaces?\n\nNo benefit over extended sRGB since both can represent the same range of colors.\n\n### Why no CMYK support?\n\nCMYK is output-dependent and requires device-specific ICC profiles. This format is for authoring and sharing colors, not managing print workflows.\n\n### Does the format support gradients?\n\nNo, only flat colors are supported.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimple-color-palette%2Fspec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimple-color-palette%2Fspec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimple-color-palette%2Fspec/lists"}