Skip to content

A Swiss Army knife for developers.

Fixed Command Palette that has a transparent background color (#520)

Etienne Baudoux4abd42ffe54d
diff --git a/src/dev/impl/DevToys.MonacoEditor/CodeEditorControl/CodeEditorCore.html b/src/dev/impl/DevToys.MonacoEditor/CodeEditorControl/CodeEditorCore.html
index 93c9ab235..19f529241 100644
--- a/src/dev/impl/DevToys.MonacoEditor/CodeEditorControl/CodeEditorCore.html
+++ b/src/dev/impl/DevToys.MonacoEditor/CodeEditorControl/CodeEditorCore.html
@@ -13,6 +13,11 @@
height: 100%;
width: 100%;
}
+
+ .monaco-quick-open-widget {
+ /* Mocking. This will be changed by javascript later. */
+ background-color: transparent;
+ }
</style>
<style id="dynamic">
</style>
diff --git a/src/dev/impl/DevToys.MonacoEditor/ts-helpermethods/otherScriptsToBeOrganized.ts b/src/dev/impl/DevToys.MonacoEditor/ts-helpermethods/otherScriptsToBeOrganized.ts
index 365bd6e8a..2677c5043 100644
--- a/src/dev/impl/DevToys.MonacoEditor/ts-helpermethods/otherScriptsToBeOrganized.ts
+++ b/src/dev/impl/DevToys.MonacoEditor/ts-helpermethods/otherScriptsToBeOrganized.ts
@@ -6,7 +6,7 @@ declare var editor: monaco.editor.IStandaloneCodeEditor;
declare var model: monaco.editor.ITextModel;
declare var contexts: { [index: string]: monaco.editor.IContextKey<any> };//{};
declare var decorations: string[];
-declare var modifingSelection:boolean; // Supress updates to selection when making edits.
+declare var modifingSelection: boolean; // Supress updates to selection when making edits.
var registerHoverProvider = function (languageId: string) {
return monaco.languages.registerHoverProvider(languageId, {
@@ -125,11 +125,17 @@ var updateLanguage = function (language) {
};
var changeTheme = function (theme: string, highcontrast) {
+ var commandPaletteCssStyle = getCssRule(".monaco-quick-open-widget");
+
var newTheme = 'vs';
+ commandPaletteCssStyle.style.setProperty("background-color", "#F3F3F3", "important");
+
if (highcontrast == "True" || highcontrast == "true") {
newTheme = 'hc-black';
+ commandPaletteCssStyle.style.setProperty("background-color", "#FF000000", "important");
} else if (theme == "Dark") {
newTheme = 'vs-dark';
+ commandPaletteCssStyle.style.setProperty("background-color", "#252526", "important");
}
monaco.editor.setTheme(newTheme);
@@ -152,6 +158,7 @@ var setTheme = function (accentColor: string) {
'editor.inactiveSelectionBackground': '#00000000',
'editor.selectionForeground': '#FFFFFF',
'editor.selectionBackground': accentColor,
+ 'editorWidget.background': '#252526'
}
});
monaco.editor.defineTheme('vs', {
@@ -168,6 +175,7 @@ var setTheme = function (accentColor: string) {
'editor.inactiveSelectionBackground': '#00000000',
'editor.selectionForeground': '#000000',
'editor.selectionBackground': accentColor,
+ 'editorWidget.background': '#F3F3F3'
}
});
}
@@ -182,4 +190,15 @@ var keyDown = function (event) {
event.stopImmediatePropagation();
return false;
}
-};
\ No newline at end of file
+};
+
+var getCssRule = function (styleName): CSSStyleRule {
+ for (var i = 0; i < document.styleSheets[0].cssRules.length; i++) {
+ var rule = document.styleSheets[0].cssRules[i] as CSSStyleRule;
+ if (rule.selectorText == styleName) {
+ return rule;
+ }
+ }
+
+ throw new Error("Unable to find the style named " + styleName);
+}
\ No newline at end of file