Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added light theme #23

Merged
merged 5 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
333 changes: 333 additions & 0 deletions src/themes/converted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,3 +702,336 @@ export const theme: monaco.editor.IStandaloneThemeData = {
],
encodedTokensColors: [],
};

export const lightTheme: monaco.editor.IStandaloneThemeData = {
"inherit": false,
"base": "vs",
"colors": {
"activityBar.activeBorder": "#f9826c",
"activityBar.background": "#ffffff",
"activityBar.border": "#e1e4e8",
"activityBar.foreground": "#2f363d",
"activityBar.inactiveForeground": "#959da5",
"activityBarBadge.background": "#2188ff",
"activityBarBadge.foreground": "#ffffff",
"badge.background": "#dbedff",
"badge.foreground": "#005cc5",
"breadcrumb.activeSelectionForeground": "#586069",
"breadcrumb.focusForeground": "#2f363d",
"breadcrumb.foreground": "#6a737d",
"breadcrumbPicker.background": "#fafbfc",
"button.background": "#159739",
"button.foreground": "#ffffff",
"button.hoverBackground": "#138934",
"checkbox.background": "#fafbfc",
"checkbox.border": "#d1d5da",
"debugToolBar.background": "#ffffff",
"descriptionForeground": "#6a737d",
"diffEditor.insertedTextBackground": "#34d05822",
"diffEditor.removedTextBackground": "#d73a4922",
"dropdown.background": "#fafbfc",
"dropdown.border": "#e1e4e8",
"dropdown.foreground": "#2f363d",
"dropdown.listBackground": "#ffffff",
"editor.background": "#ffffff",
"editor.findMatchBackground": "#ffdf5d",
"editor.findMatchHighlightBackground": "#ffdf5d66",
"editor.focusedStackFrameHighlightBackground": "#fff5b1",
"editor.foldBackground": "#fafbfc",
"editor.foreground": "#24292e",
"editor.inactiveSelectionBackground": "#0366d611",
"editor.lineHighlightBackground": "#f6f8fa",
"editor.selectionBackground": "#0366d625",
"editor.selectionHighlightBackground": "#34d05840",
"editor.selectionHighlightBorder": "#34d05800",
"editor.stackFrameHighlightBackground": "#fffbdd",
"editor.wordHighlightBackground": "#34d05800",
"editor.wordHighlightBorder": "#24943e99",
"editor.wordHighlightStrongBackground": "#34d05800",
"editor.wordHighlightStrongBorder": "#24943e50",
"editorBracketMatch.background": "#34d05840",
"editorBracketMatch.border": "#34d05800",
"editorCursor.foreground": "#044289",
"editorGroup.border": "#e1e4e8",
"editorGroupHeader.tabsBackground": "#f6f8fa",
"editorGroupHeader.tabsBorder": "#e1e4e8",
"editorGutter.addedBackground": "#28a745",
"editorGutter.deletedBackground": "#d73a49",
"editorGutter.modifiedBackground": "#2188ff",
"editorIndentGuide.activeBackground": "#d7dbe0",
"editorIndentGuide.background": "#eff2f6",
"editorLineNumber.activeForeground": "#24292e",
"editorLineNumber.foreground": "#1b1f234d",
"editorOverviewRuler.border": "#ffffff",
"editorWhitespace.foreground": "#d1d5da",
"editorWidget.background": "#f6f8fa",
"errorForeground": "#cb2431",
"focusBorder": "#2188ff",
"foreground": "#444d56",
"gitDecoration.addedResourceForeground": "#28a745",
"gitDecoration.conflictingResourceForeground": "#e36209",
"gitDecoration.deletedResourceForeground": "#d73a49",
"gitDecoration.ignoredResourceForeground": "#959da5",
"gitDecoration.modifiedResourceForeground": "#005cc5",
"gitDecoration.submoduleResourceForeground": "#959da5",
"gitDecoration.untrackedResourceForeground": "#28a745",
"input.background": "#fafbfc",
"input.border": "#e1e4e8",
"input.foreground": "#2f363d",
"input.placeholderForeground": "#959da5",
"list.activeSelectionBackground": "#e2e5e9",
"list.activeSelectionForeground": "#2f363d",
"list.focusBackground": "#cce5ff",
"list.hoverBackground": "#ebf0f4",
"list.hoverForeground": "#2f363d",
"list.inactiveFocusBackground": "#dbedff",
"list.inactiveSelectionBackground": "#e8eaed",
"list.inactiveSelectionForeground": "#2f363d",
"notificationCenterHeader.background": "#e1e4e8",
"notificationCenterHeader.foreground": "#6a737d",
"notifications.background": "#fafbfc",
"notifications.border": "#e1e4e8",
"notifications.foreground": "#2f363d",
"notificationsErrorIcon.foreground": "#d73a49",
"notificationsInfoIcon.foreground": "#005cc5",
"notificationsWarningIcon.foreground": "#e36209",
"panel.background": "#f6f8fa",
"panel.border": "#e1e4e8",
"panelInput.border": "#e1e4e8",
"panelTitle.activeBorder": "#f9826c",
"panelTitle.activeForeground": "#2f363d",
"panelTitle.inactiveForeground": "#6a737d",
"pickerGroup.border": "#e1e4e8",
"pickerGroup.foreground": "#2f363d",
"progressBar.background": "#2188ff",
"quickInput.background": "#fafbfc",
"quickInput.foreground": "#2f363d",
"scrollbar.shadow": "#6a737d33",
"scrollbarSlider.activeBackground": "#959da588",
"scrollbarSlider.background": "#959da533",
"scrollbarSlider.hoverBackground": "#959da544",
"settings.headerForeground": "#2f363d",
"settings.modifiedItemIndicator": "#2188ff",
"sideBar.background": "#f6f8fa",
"sideBar.border": "#e1e4e8",
"sideBar.foreground": "#586069",
"sideBarSectionHeader.background": "#f6f8fa",
"sideBarSectionHeader.border": "#e1e4e8",
"sideBarSectionHeader.foreground": "#2f363d",
"sideBarTitle.foreground": "#2f363d",
"statusBar.background": "#ffffff",
"statusBar.border": "#e1e4e8",
"statusBar.debuggingBackground": "#f9826c",
"statusBar.debuggingForeground": "#ffffff",
"statusBar.foreground": "#586069",
"statusBar.noFolderBackground": "#ffffff",
"statusBarItem.prominentBackground": "#e8eaed",
"tab.activeBackground": "#ffffff",
"tab.activeBorder": "#ffffff",
"tab.activeBorderTop": "#f9826c",
"tab.activeForeground": "#2f363d",
"tab.border": "#e1e4e8",
"tab.hoverBackground": "#ffffff",
"tab.inactiveBackground": "#f6f8fa",
"tab.inactiveForeground": "#6a737d",
"tab.unfocusedActiveBorder": "#ffffff",
"tab.unfocusedActiveBorderTop": "#e1e4e8",
"tab.unfocusedHoverBackground": "#ffffff",
"terminal.foreground": "#586069",
"textBlockQuote.background": "#fafbfc",
"textBlockQuote.border": "#e1e4e8",
"textCodeBlock.background": "#f6f8fa",
"textLink.activeForeground": "#005cc5",
"textLink.foreground": "#0366d6",
"textPreformat.foreground": "#586069",
"textSeparator.foreground": "#d1d5da",

},
"rules": [
{ "foreground": "#6A737D", "token": "comment" },
{ "foreground": "#6A737D", "token": "punctuation.definition.comment" },
{ "foreground": "#6A737D", "token": "string.comment" },
{ "foreground": "#005CC5", "token": "constant" },
{ "foreground": "#005CC5", "token": "entity.name.constant" },
{ "foreground": "#005CC5", "token": "variable.other.constant" },
{ "foreground": "#005CC5", "token": "variable.language" },
{ "foreground": "#6F42C1", "token": "entity" },
{ "foreground": "#6F42C1", "token": "entity.name" },
{ "foreground": "#24292E", "token": "variable.parameter.function" },
{ "foreground": "#22863A", "token": "entity.name.tag" },
{ "foreground": "#D73A49", "token": "keyword" },
{ "foreground": "#D73A49", "token": "storage" },
{ "foreground": "#D73A49", "token": "storage.type" },
{ "foreground": "#24292E", "token": "storage.modifier.package" },
{ "foreground": "#24292E", "token": "storage.modifier.import" },
{ "foreground": "#24292E", "token": "storage.type.java" },
{ "foreground": "#032F62", "token": "string" },
{ "foreground": "#032F62", "token": "punctuation.definition.string" },
{
"foreground": "#032F62",
"token": "string punctuation.section.embedded source"
},
{ "foreground": "#005CC5", "token": "support" },
{ "foreground": "#005CC5", "token": "meta.property-name" },
{ "foreground": "#E36209", "token": "variable" },
{ "foreground": "#24292E", "token": "variable.other" },
{
"foreground": "#B31D28",
"fontStyle": "italic",
"token": "invalid.broken"
},
{
"foreground": "#B31D28",
"fontStyle": "italic",
"token": "invalid.deprecated"
},
{
"foreground": "#B31D28",
"fontStyle": "italic",
"token": "invalid.illegal"
},
{
"foreground": "#B31D28",
"fontStyle": "italic",
"token": "invalid.unimplemented"
},
{
"foreground": "#FAFBFC",
"background": "#D73A49",
"fontStyle": "italic underline",
"token": "carriage-return"
},
{ "foreground": "#B31D28", "token": "message.error" },
{ "foreground": "#24292E", "token": "string source" },
{ "foreground": "#005CC5", "token": "string variable" },
{ "foreground": "#032F62", "token": "source.regexp" },
{ "foreground": "#032F62", "token": "string.regexp" },
{ "foreground": "#032F62", "token": "string.regexp.character-class" },
{
"foreground": "#032F62",
"token": "string.regexp constant.character.escape"
},
{
"foreground": "#032F62",
"token": "string.regexp source.ruby.embedded"
},
{
"foreground": "#032F62",
"token": "string.regexp string.regexp.arbitrary-repitition"
},
{
"foreground": "#22863A",
"fontStyle": "bold",
"token": "string.regexp constant.character.escape"
},
{ "foreground": "#005CC5", "token": "support.constant" },
{ "foreground": "#005CC5", "token": "support.variable" },
{ "foreground": "#005CC5", "token": "meta.module-reference" },
{
"foreground": "#E36209",
"token": "punctuation.definition.list.begin.markdown"
},
{
"foreground": "#005CC5",
"fontStyle": "bold",
"token": "markup.heading"
},
{
"foreground": "#005CC5",
"fontStyle": "bold",
"token": "markup.heading entity.name"
},
{ "foreground": "#22863A", "token": "markup.quote" },
{
"foreground": "#24292E",
"fontStyle": "italic",
"token": "markup.italic"
},
{ "foreground": "#24292E", "fontStyle": "bold", "token": "markup.bold" },
{ "foreground": "#005CC5", "token": "markup.raw" },
{
"foreground": "#B31D28",
"background": "#FFEEF0",
"token": "markup.deleted"
},
{
"foreground": "#B31D28",
"background": "#FFEEF0",
"token": "meta.diff.header.from-file"
},
{
"foreground": "#B31D28",
"background": "#FFEEF0",
"token": "punctuation.definition.deleted"
},
{
"foreground": "#22863A",
"background": "#F0FFF4",
"token": "markup.inserted"
},
{
"foreground": "#22863A",
"background": "#F0FFF4",
"token": "meta.diff.header.to-file"
},
{
"foreground": "#22863A",
"background": "#F0FFF4",
"token": "punctuation.definition.inserted"
},
{
"foreground": "#E36209",
"background": "#FFEBDA",
"token": "markup.changed"
},
{
"foreground": "#E36209",
"background": "#FFEBDA",
"token": "punctuation.definition.changed"
},
{
"foreground": "#F6F8FA",
"background": "#005CC5",
"token": "markup.ignored"
},
{
"foreground": "#F6F8FA",
"background": "#005CC5",
"token": "markup.untracked"
},
{
"foreground": "#6F42C1",
"fontStyle": "bold",
"token": "meta.diff.range"
},
{ "foreground": "#005CC5", "token": "meta.diff.header" },
{
"foreground": "#005CC5",
"fontStyle": "bold",
"token": "meta.separator"
},
{ "foreground": "#005CC5", "token": "meta.output" },
{ "foreground": "#586069", "token": "brackethighlighter.tag" },
{ "foreground": "#586069", "token": "brackethighlighter.curly" },
{ "foreground": "#586069", "token": "brackethighlighter.round" },
{ "foreground": "#586069", "token": "brackethighlighter.square" },
{ "foreground": "#586069", "token": "brackethighlighter.angle" },
{ "foreground": "#586069", "token": "brackethighlighter.quote" },
{ "foreground": "#B31D28", "token": "brackethighlighter.unmatched" },
{
"foreground": "#032F62",
"fontStyle": "underline",
"token": "constant.other.reference.link"
},
{
"foreground": "#032F62",
"fontStyle": "underline",
"token": "string.other.link"
},
{ "foreground": "#316BCD", "token": "token.info-token" },
{ "foreground": "#CD9731", "token": "token.warn-token" },
{ "foreground": "#CD3131", "token": "token.error-token" },
{ "foreground": "#800080", "token": "token.debug-token" }
],
"encodedTokensColors": []
}
14 changes: 9 additions & 5 deletions src/themes/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { theme } from './converted'
import { theme, lightTheme } from './converted'

export async function loadTheme(editor: typeof import('monaco-editor-core').editor) {
const themeName = 'vs-code-theme-converted';
editor.defineTheme(themeName, theme);
return themeName;
export async function loadTheme(
editor: typeof import('monaco-editor-core').editor,
dark = true) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this param really necessary? How about returning an object
{ dark: 'vs-code-theme-converted-dark', light: 'vs-code-theme-converted-light' }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course can do this, then you need to judge whether to use light or dark when using it in the downstream repo

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Cuz we only need to execute loadTheme once so that we cannot get dark and light for one execution.

const themeNameDark = 'vs-code-theme-converted-dark';
editor.defineTheme(themeNameDark, theme);
const themeNameLight = 'vs-code-theme-converted-light';
editor.defineTheme(themeNameLight, lightTheme);
return dark ? themeNameDark : themeNameLight;
}