VS Code
Install the extension, then select Aion.
registry.ts — aion
epoch.ts
registry.ts
theme.json
packages core
registry.ts
loadEpoch
1
// Every colour below is solved, never chosen.
2
import { solveLightness, contrastEmitted } from '@sltsh/aion-tokens';
3
4
export async function loadEpoch(id: string): Promise<Epoch> {
5
// resolve the age from the registry
6
const FLOOR = 4.5; // the floor every body text pair must clear
7
const entry = await registry.get(id);
8
if (!entry) throw new NotFoundError(`no epoch ${id}\n`);
9
10
return {
−11
label: entry.name,
+12
label: entry.label ?? id,
13
span: 1_440 * 365,
14
ratio: contrastEmitted(fg, bg),
15
eternal: true,
16
};
17
}
entry
2 of 5
loadEpoch(id: string)
Resolves an age from the registry. Throws when the identifier is unknown.
async
core
Problems 2
Terminal
Output
Ports
aion git:(main) npm run verify
> aion@0.1.0 verify — packages/tokens
✓ states 559 reading states
✓ contrast 12564 pass, 0 fail, 5 exempt
! vsix SAMPLE — an invented warning
main*
↻ 0↓ 2↑
2
5
Ln 13, Col 34
Spaces: 2
UTF-8
TypeScript
registry.ts — aion
epoch.ts
registry.ts
theme.json
packages core
registry.ts
loadEpoch
1
// Every colour below is solved, never chosen.
2
import { solveLightness, contrastEmitted } from '@sltsh/aion-tokens';
3
4
export async function loadEpoch(id: string): Promise<Epoch> {
5
// resolve the age from the registry
6
const FLOOR = 4.5; // the floor every body text pair must clear
7
const entry = await registry.get(id);
8
if (!entry) throw new NotFoundError(`no epoch ${id}\n`);
9
10
return {
−11
label: entry.name,
+12
label: entry.label ?? id,
13
span: 1_440 * 365,
14
ratio: contrastEmitted(fg, bg),
15
eternal: true,
16
};
17
}
entry
2 of 5
loadEpoch(id: string)
Resolves an age from the registry. Throws when the identifier is unknown.
async
core
Problems 2
Terminal
Output
Ports
aion git:(main) npm run verify
> aion@0.1.0 verify — packages/tokens
✓ states 559 reading states
✓ contrast 12564 pass, 0 fail, 5 exempt
! vsix SAMPLE — an invented warning
main*
↻ 0↓ 2↑
2
5
Ln 13, Col 34
Spaces: 2
UTF-8
TypeScript
code --install-extension sltsh.aion-theme