Start loading new theme JSON format instead of TOML

Replaced remaining extends with javascript object extension.
Moved tokens/core.ts to tokens.ts and massaged the types to make it more
obvious when types don't match up.

Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Nathan Sobo
2022-04-04 12:13:59 -07:00
committed by Keith Simmons
parent 371ea7c552
commit 391aed3d66
23 changed files with 3283 additions and 2008 deletions
+7 -7
View File
@@ -1,25 +1,25 @@
import chroma from "chroma-js";
import Theme, { BackgroundColor, Weight } from "../themes/theme";
import core from "../tokens/core";
import Theme, { BackgroundColor } from "../themes/theme";
import { fontFamilies, fontSizes, FontWeight } from "../tokens";
import { Color } from "../utils/color";
export type TextColor = keyof Theme["textColor"];
export function text(
theme: Theme,
fontFamily: keyof typeof core.fontFamily,
fontFamily: keyof typeof fontFamilies,
color: TextColor,
properties?: {
size?: keyof typeof core["fontSize"];
weight?: Weight;
size?: keyof typeof fontSizes;
weight?: FontWeight;
underline?: boolean;
}
) {
const sizeKey = properties?.size || fontFamily === "sans" ? "sm" : "md";
const size = core.fontSize[sizeKey].value;
const size = fontSizes[sizeKey].value;
return {
family: core.fontFamily[fontFamily],
family: fontFamilies[fontFamily].value,
color: theme.textColor[color].value,
...properties,
size,