Skip to content

Commit d199942

Browse files
authored
chore: DH-21115: Define diff editor colors (#2592)
- Defined new theme variables for diff editor colors and added them to our Monaco theme
1 parent 4fea2c6 commit d199942

File tree

7 files changed

+66
-0
lines changed

7 files changed

+66
-0
lines changed

packages/components/src/theme/theme-dark/theme-dark-semantic-editor.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,26 @@
8080
/* Links */
8181
--dh-color-editor-link-foreground: var(--dh-color-accent-1000);
8282
--dh-color-editor-link-active-fg: var(--dh-color-accent-1100);
83+
84+
/* Diff */
85+
--dh-color-editor-diff-inserted-text-bg: color-mix(
86+
in srgb,
87+
var(--dh-color-positive) 35%,
88+
transparent
89+
);
90+
--dh-color-editor-diff-removed-text-bg: color-mix(
91+
in srgb,
92+
var(--dh-color-negative) 35%,
93+
transparent
94+
);
95+
--dh-color-editor-diff-inserted-line-bg: color-mix(
96+
in srgb,
97+
var(--dh-color-positive) 20%,
98+
transparent
99+
);
100+
--dh-color-editor-diff-removed-line-bg: color-mix(
101+
in srgb,
102+
var(--dh-color-negative) 20%,
103+
transparent
104+
);
83105
}

packages/components/src/theme/theme-light/theme-light-semantic-editor.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,26 @@
7878
/* Links */
7979
--dh-color-editor-link-foreground: var(--dh-color-accent-1000);
8080
--dh-color-editor-link-active-fg: var(--dh-color-accent-1100);
81+
82+
/* Diff */
83+
--dh-color-editor-diff-inserted-text-bg: color-mix(
84+
in srgb,
85+
var(--dh-color-positive) 35%,
86+
transparent
87+
);
88+
--dh-color-editor-diff-removed-text-bg: color-mix(
89+
in srgb,
90+
var(--dh-color-negative) 35%,
91+
transparent
92+
);
93+
--dh-color-editor-diff-inserted-line-bg: color-mix(
94+
in srgb,
95+
var(--dh-color-positive) 20%,
96+
transparent
97+
);
98+
--dh-color-editor-diff-removed-line-bg: color-mix(
99+
in srgb,
100+
var(--dh-color-negative) 20%,
101+
transparent
102+
);
81103
}

packages/console/src/monaco/MonacoTheme.module.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,18 @@
103103
text-link-foreground: var(--dh-color-editor-link-foreground);
104104
text-link-active-foreground: var(--dh-color-editor-link-active-fg);
105105
editor-link-active-foreground: var(--dh-color-editor-link-active-fg);
106+
107+
// diff editor
108+
diff-editor-inserted-text-background: var(
109+
--dh-color-editor-diff-inserted-text-bg
110+
);
111+
diff-editor-removed-text-background: var(
112+
--dh-color-editor-diff-removed-text-bg
113+
);
114+
diff-editor-inserted-line-background: var(
115+
--dh-color-editor-diff-inserted-line-bg
116+
);
117+
diff-editor-removed-line-background: var(
118+
--dh-color-editor-diff-removed-line-bg
119+
);
106120
}

packages/console/src/monaco/MonacoUtils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,14 @@ class MonacoUtils {
239239
MonacoTheme['editor-bracket-foreground6'],
240240
'editorBracketHighlight.unexpectedBracket.foreground':
241241
MonacoTheme['editor-unexpected-bracket-foreground'],
242+
'diffEditor.insertedTextBackground':
243+
MonacoTheme['diff-editor-inserted-text-background'],
244+
'diffEditor.removedTextBackground':
245+
MonacoTheme['diff-editor-removed-text-background'],
246+
'diffEditor.insertedLineBackground':
247+
MonacoTheme['diff-editor-inserted-line-background'],
248+
'diffEditor.removedLineBackground':
249+
MonacoTheme['diff-editor-removed-line-background'],
242250
};
243251

244252
monaco.editor.defineTheme('dh-dark', {
4.14 KB
Loading
5.58 KB
Loading
1.11 KB
Loading

0 commit comments

Comments
 (0)