From 3b19a409f8b52bc12b818e6b001beb64592a4129 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Sun, 26 Feb 2023 15:01:18 -0500 Subject: [PATCH] Add some comments --- styles/src/themes/common/syntax.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/styles/src/themes/common/syntax.ts b/styles/src/themes/common/syntax.ts index 6faf48852f..28600c4df4 100644 --- a/styles/src/themes/common/syntax.ts +++ b/styles/src/themes/common/syntax.ts @@ -8,10 +8,13 @@ const defaultSyntaxHighlightStyle: Omit = { } function buildDefaultSyntax(colorScheme: ColorScheme): Syntax { + // Make a temporary object that is allowed to be missing + // the "color" property for each style const syntax: { [key: string]: Omit } = {} + // then spread the default to each style for (const key of Object.keys({} as Syntax)) { syntax[key as keyof Syntax] = { ...defaultSyntaxHighlightStyle @@ -22,6 +25,7 @@ function buildDefaultSyntax(colorScheme: ColorScheme): Syntax { comment: colorScheme.ramps.neutral(0.71).hex() } + // Then assign colors and use Syntax to enforce each style getting it's own color const defaultSyntax: Syntax = { ...syntax, comment: {