Skip to content

Commit cc58f42

Browse files
committed
monaco editor 커스텀
1 parent ebc40be commit cc58f42

3 files changed

Lines changed: 41 additions & 49 deletions

File tree

src/components/ide/IDE.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,38 @@ body.dark-mode .save-button:hover {
898898
overflow: hidden;
899899
}
900900

901+
.ide-container .monaco-editor,
902+
.ide-container .monaco-editor .overflow-guard,
903+
.ide-container .monaco-editor .monaco-editor-background,
904+
.ide-container .monaco-editor .view-overlays,
905+
.ide-container .monaco-editor .margin-view-overlays {
906+
background-color: var(--ide-editor-bg) !important;
907+
}
908+
909+
.ide-container .monaco-editor .view-lines {
910+
background-color: var(--ide-editor-bg) !important;
911+
}
912+
913+
.ide-container .monaco-editor .margin,
914+
.ide-container .monaco-editor .glyph-margin {
915+
background-color: var(--ide-editor-gutter) !important;
916+
border-right: 1px solid var(--border-subtle);
917+
}
918+
919+
.ide-container .monaco-editor .scroll-decoration {
920+
box-shadow: none;
921+
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.12), transparent);
922+
}
923+
924+
.ide-container .monaco-editor .line-numbers,
925+
.ide-container .monaco-editor .margin .current-line {
926+
color: var(--ide-editor-line-number) !important;
927+
}
928+
929+
.ide-container .monaco-editor .line-numbers.active-line-number {
930+
color: var(--accent-primary) !important;
931+
}
932+
901933
.right-panel {
902934
width: 400px;
903935
min-width: 400px;

src/components/ide/IDE.jsx

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -524,52 +524,7 @@ const IDE = () => {
524524
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, function() {
525525
handleSave();
526526
});
527-
528-
monaco.editor.defineTheme('custom-dark', {
529-
base: 'vs-dark',
530-
inherit: true,
531-
rules: [
532-
{ token: '', foreground: 'D4D4D4', background: '1E1E1E' },
533-
{ token: 'comment', foreground: '6A9955' },
534-
{ token: 'string', foreground: 'CE9178' },
535-
{ token: 'keyword', foreground: '569CD6' },
536-
{ token: 'number', foreground: 'B5CEA8' }
537-
],
538-
colors: {
539-
'editor.background': '#1E1E1E',
540-
'editorLineNumber.foreground': '#858585',
541-
'editorCursor.foreground': '#AEAFAD',
542-
'editor.selectionBackground': '#264F78',
543-
'editor.lineHighlightBackground': '#2A2D2E'
544-
}
545-
});
546-
547-
monaco.editor.defineTheme('custom-light', {
548-
base: 'vs',
549-
inherit: true,
550-
rules: [
551-
{ token: '', foreground: '2D2D2D', background: 'FFFFFF' },
552-
{ token: 'comment', foreground: '008000' },
553-
{ token: 'string', foreground: 'A31515' },
554-
{ token: 'keyword', foreground: '0000FF' },
555-
{ token: 'number', foreground: '098658' }
556-
],
557-
colors: {
558-
'editor.background': '#FFFFFF',
559-
'editorLineNumber.foreground': '#237893',
560-
'editorCursor.foreground': '#000000',
561-
'editor.selectionBackground': '#ADD6FF',
562-
'editor.lineHighlightBackground': '#F5F5F5'
563-
}
564-
});
565-
566-
const updateEditorTheme = (monaco) => {
567-
if (!monaco && !editorRef.current) return;
568-
const m = monaco || window.monaco;
569-
if (m) { m.editor.setTheme(isDarkMode ? 'custom-dark' : 'custom-light'); }
570-
};
571-
572-
updateEditorTheme(monaco);
527+
monaco.editor.setTheme(isDarkMode ? 'vs-dark' : 'vs');
573528

574529
setTimeout(() => {
575530
try { editorRef.current.layout(); } catch (e) { console.warn('에디터 초기 레이아웃 설정 중 오류:', e); }
@@ -881,9 +836,8 @@ const IDE = () => {
881836
if (newIsDarkMode !== isDarkMode) {
882837
setIsDarkMode(newIsDarkMode);
883838

884-
if (editorRef.current && monacoRef.current) {
885-
const newTheme = newIsDarkMode ? 'custom-dark' : 'custom-light';
886-
monacoRef.current.editor.setTheme(newTheme);
839+
if (monacoRef.current) {
840+
monacoRef.current.editor.setTheme(newIsDarkMode ? 'vs-dark' : 'vs');
887841
}
888842
}
889843
}

src/index.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ body {
3434
--text-muted: #5e5980;
3535
--border-subtle: rgba(15, 23, 42, 0.08);
3636
--border-strong: rgba(15, 23, 42, 0.12);
37+
--ide-editor-bg: #ffffff;
38+
--ide-editor-gutter: #f3f4fa;
39+
--ide-editor-line-number: #6c678f;
3740
}
3841

3942
body.dark-mode {
@@ -60,6 +63,9 @@ body.dark-mode {
6063
--text-muted: #9b97c9;
6164
--border-subtle: rgba(124, 104, 220, 0.26);
6265
--border-strong: rgba(124, 104, 220, 0.42);
66+
--ide-editor-bg: #151028;
67+
--ide-editor-gutter: #0d0a19;
68+
--ide-editor-line-number: #9d98df;
6369
background-color: var(--surface-body);
6470
color: var(--text-primary);
6571
}

0 commit comments

Comments
 (0)