Skip to content

Commit 5053678

Browse files
committed
Add more colors
1 parent 28d8ce2 commit 5053678

File tree

7 files changed

+465
-57
lines changed

7 files changed

+465
-57
lines changed

.changeset/yellow-snakes-serve.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@code-hike/lighter": minor
3+
---
4+
5+
Add more theme colors

lib/dist/index.cjs.js

+119-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/dist/index.d.ts

+92-23
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,48 @@ type ThemeSetting = {
1919
background?: string;
2020
};
2121
};
22+
type FinalTheme = {
23+
name: string;
24+
type: "dark" | "light";
25+
settings: ThemeSetting[];
26+
colors: {
27+
[key: string]: string;
28+
};
29+
};
2230
declare const ALL_NAMES: readonly ["dark-plus", "dracula-soft", "dracula", "github-dark", "github-dark-dimmed", "github-light", "light-plus", "material-darker", "material-default", "material-lighter", "material-ocean", "material-palenight", "min-dark", "min-light", "monokai", "nord", "one-dark-pro", "poimandres", "slack-dark", "slack-ochin", "solarized-dark", "solarized-light"];
2331
type NamesTuple = typeof ALL_NAMES;
2432
type StringTheme = NamesTuple[number];
2533
type Theme = StringTheme | RawTheme;
2634

35+
type ThemeColors = ReturnType<typeof getThemeColors>;
36+
declare function getThemeColors(theme: FinalTheme): {
37+
background: string;
38+
foreground: string;
39+
lineNumberForeground: string;
40+
selectionBackground: string;
41+
editorBackground: string;
42+
editorGroupHeaderBackground: string;
43+
activeTabBackground: string;
44+
activeTabForeground: string;
45+
tabBorder: string;
46+
activeTabBorder: string;
47+
inactiveTabBackground: string;
48+
inactiveTabForeground: string;
49+
diffInsertedTextBackground: string;
50+
diffInsertedLineBackground: string;
51+
diffRemovedTextBackground: string;
52+
diffRemovedLineBackground: string;
53+
iconForeground: string;
54+
sideBarBackground: string;
55+
sideBarForeground: string;
56+
sideBarBorder: string;
57+
listSelectionBackground: string;
58+
listSelectionForeground: string;
59+
listHoverBackground: string;
60+
listHoverForeground: string;
61+
colorScheme: "dark" | "light";
62+
};
63+
2764
type LineNumber = number;
2865
type ColumnNumber = number;
2966
type MultiLineRange = {
@@ -79,42 +116,74 @@ declare class UnknownLanguageError extends Error {
79116
}
80117

81118
declare function highlight(code: string, alias: LanguageAlias, themeOrThemeName?: Theme): Promise<{
82-
background: string;
83-
foreground: string;
84-
lineNumberForeground: string;
85-
selectionBackground: string;
86-
editorBackground: string;
87-
editorGroupHeaderBackground: string;
88-
activeTabBackground: string;
89-
activeTabForeground: string;
90-
tabBorder: string;
91-
activeTabBorder: string;
92-
colorScheme: "dark" | "light";
93119
lines: Token[][];
94120
lang: LanguageName;
121+
colors: {
122+
background: string;
123+
foreground: string;
124+
lineNumberForeground: string;
125+
selectionBackground: string;
126+
editorBackground: string;
127+
editorGroupHeaderBackground: string;
128+
activeTabBackground: string;
129+
activeTabForeground: string;
130+
tabBorder: string;
131+
activeTabBorder: string;
132+
inactiveTabBackground: string;
133+
inactiveTabForeground: string;
134+
diffInsertedTextBackground: string;
135+
diffInsertedLineBackground: string;
136+
diffRemovedTextBackground: string;
137+
diffRemovedLineBackground: string;
138+
iconForeground: string;
139+
sideBarBackground: string;
140+
sideBarForeground: string;
141+
sideBarBorder: string;
142+
listSelectionBackground: string;
143+
listSelectionForeground: string;
144+
listHoverBackground: string;
145+
listHoverForeground: string;
146+
colorScheme: "dark" | "light";
147+
};
95148
}>;
96149
declare function extractAnnotations(code: string, alias: LanguageAlias, annotationNames?: string[]): Promise<{
97150
code: string;
98151
annotations: Annotation[];
99152
}>;
100153
declare function annotatedHighlight(code: string, alias: LanguageAlias, themeOrThemeName?: Theme, annotations?: Annotation[]): Promise<{
101-
background: string;
102-
foreground: string;
103-
lineNumberForeground: string;
104-
selectionBackground: string;
105-
editorBackground: string;
106-
editorGroupHeaderBackground: string;
107-
activeTabBackground: string;
108-
activeTabForeground: string;
109-
tabBorder: string;
110-
activeTabBorder: string;
111-
colorScheme: "dark" | "light";
112154
lines: Lines;
113155
lang: LanguageName;
156+
colors: {
157+
background: string;
158+
foreground: string;
159+
lineNumberForeground: string;
160+
selectionBackground: string;
161+
editorBackground: string;
162+
editorGroupHeaderBackground: string;
163+
activeTabBackground: string;
164+
activeTabForeground: string;
165+
tabBorder: string;
166+
activeTabBorder: string;
167+
inactiveTabBackground: string;
168+
inactiveTabForeground: string;
169+
diffInsertedTextBackground: string;
170+
diffInsertedLineBackground: string;
171+
diffRemovedTextBackground: string;
172+
diffRemovedLineBackground: string;
173+
iconForeground: string;
174+
sideBarBackground: string;
175+
sideBarForeground: string;
176+
sideBarBorder: string;
177+
listSelectionBackground: string;
178+
listSelectionForeground: string;
179+
listHoverBackground: string;
180+
listHoverForeground: string;
181+
colorScheme: "dark" | "light";
182+
};
114183
}>;
115184
declare class UnknownThemeError extends Error {
116185
theme: string;
117186
constructor(theme: string);
118187
}
119188

120-
export { Annotation, LanguageAlias, Line, LineGroup, Lines, RawTheme, StringTheme, Theme, Token, TokenGroup, Tokens, UnknownLanguageError, UnknownThemeError, annotatedHighlight, extractAnnotations, highlight };
189+
export { Annotation, LanguageAlias, Line, LineGroup, Lines, RawTheme, StringTheme, Theme, ThemeColors, Token, TokenGroup, Tokens, UnknownLanguageError, UnknownThemeError, annotatedHighlight, extractAnnotations, highlight };

0 commit comments

Comments
 (0)