-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move color space docs to use 11ty rather than Mavo
- Loading branch information
Showing
6 changed files
with
158 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import ColorSpace from "../src/spaces/index.js"; | ||
import {WHITES} from "../src/adapt.js"; | ||
|
||
let whitePoints = Object.entries(WHITES); | ||
|
||
// 11ty chokes on this | ||
// import modules from "./modules.json" with { type: "json" }; | ||
import { readFileSync } from "fs"; | ||
const modules = JSON.parse(readFileSync("data/modules.json")); | ||
|
||
let spaces = {}; | ||
|
||
for (let meta of modules.space) { | ||
let id = meta.id; | ||
let space = ColorSpace.registry[id]; | ||
|
||
spaces[id] = meta; | ||
Object.assign(meta, { | ||
white: whitePoints.find(([name, white]) => white === space.white)?.[0] ?? "D65", | ||
base: space.base, | ||
coords: space.coords, | ||
}); | ||
|
||
if (space.id != id) { | ||
meta.aliasOf = ColorSpace.registry[space.id].name; | ||
} | ||
|
||
for (let id in meta.coords) { | ||
let coord = meta.coords[id]; | ||
let range = coord.range || coord.refRange; | ||
|
||
if (range) { | ||
coord.min = range[0]; | ||
coord.max = range[1]; | ||
} | ||
} | ||
} | ||
|
||
export default spaces; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters