Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 34c37ee

Browse files
committed
Merge pull request #8505 from MiguelCastillo/themes-scrollbars
Themes scrollbars
2 parents b7ef23a + 9343f85 commit 34c37ee

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

src/extensions/default/ThorDarkTheme/main.less

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@
167167
border-bottom: 9px solid transparent;
168168
}
169169

170-
.inline-widget {
171-
color: #333;
172-
}
173-
174170
.inline-widget .CodeMirror, .inline-widget .CodeMirror-gutters {
175171
background: transparent;
176172
}

src/styles/brackets_theme_default.less

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,5 +165,14 @@
165165

166166
}
167167

168+
/* Dark theme styling
169+
*
170+
* These are overrides to make the UI look better when the editor theme is dark.
171+
* Eventually, these will likely be replaced by full-featured UI themes.
172+
*/
173+
.dark .inline-widget {
174+
color: #333;
175+
}
176+
168177
/* Variables and Mixins for non-code UI elements that can be styled */
169178

src/view/ThemeManager.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*/
2323

24-
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
24+
/*jslint vars: true, plusplus: true, devel: true, regexp: true, nomen: true, indent: 4, maxerr: 50 */
2525
/*global $, define, require, less */
2626

2727
define(function (require, exports, module) {
@@ -43,7 +43,7 @@ define(function (require, exports, module) {
4343
styleNode = $(ExtensionUtils.addEmbeddedStyleSheet("")),
4444
defaultTheme = "thor-light-theme",
4545
commentRegex = /\/\*([\s\S]*?)\*\//mg,
46-
scrollbarsRegex = /::-webkit-scrollbar(?:[\s\S]*?)\{(?:[\s\S]*?)\}/mg,
46+
scrollbarsRegex = /((?:[^}|,]*)::-webkit-scrollbar(?:[^{]*)[{](?:[^}]*?)[}])/mgi,
4747
stylesPath = FileUtils.getNativeBracketsDirectoryPath() + "/styles/",
4848
validExtensions = ["css", "less"];
4949

@@ -87,7 +87,7 @@ define(function (require, exports, module) {
8787
this.file = file;
8888
this.name = options.name || (options.title || fileName).toLocaleLowerCase().replace(/[\W]/g, '-');
8989
this.displayName = options.title || toDisplayName(fileName);
90-
this.dark = options.theme && options.theme.dark === true;
90+
this.dark = options.theme !== undefined && options.theme.dark === true;
9191
}
9292

9393

@@ -107,7 +107,6 @@ define(function (require, exports, module) {
107107
// Go through and extract out scrollbar customizations so that we can
108108
// enable/disable via settings.
109109
content = content
110-
.replace(commentRegex, "")
111110
.replace(scrollbarsRegex, function (match) {
112111
scrollbar.push(match);
113112
return "";
@@ -231,15 +230,16 @@ define(function (require, exports, module) {
231230
var theme = getCurrentTheme();
232231

233232
var pending = theme && FileUtils.readAsText(theme.file)
233+
.then(function (lessContent) {
234+
return lessifyTheme(lessContent.replace(commentRegex, ""), theme);
235+
})
234236
.then(function (content) {
235237
var result = extractScrollbars(content);
236238
theme.scrollbar = result.scrollbar;
237239
return result.content;
238240
})
239-
.then(function (lessContent) {
240-
return lessifyTheme(lessContent, theme);
241-
})
242241
.then(function (cssContent) {
242+
$("body").toggleClass("dark", theme.dark);
243243
styleNode.text(cssContent);
244244
return theme;
245245
});

0 commit comments

Comments
 (0)