-
Notifications
You must be signed in to change notification settings - Fork 928
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
Dark mode #4244
Dark mode #4244
Changes from 8 commits
ff39760
ea2cd48
692aa98
3263195
8c59a39
ea9a87d
40298ee
f2bc6c5
2be6b8b
5d1614d
907f9d1
abfb57e
3365acc
6c4ba6e
20712ee
e553f94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
.dark-mode .blue { | ||
background-color: #022363 !important; | ||
} | ||
|
||
.dark-mode .blue.darken-1 { | ||
background-color: #01143b !important; | ||
} | ||
|
||
.dark-mode #floatingWindows > .windowFrame { | ||
border: 2px solid #000000; | ||
background-color: #454545; | ||
} | ||
|
||
.dark-mode .wfbtItem { | ||
background-color: #225a91; | ||
} | ||
|
||
.dark-mode #floatingWindows > .windowFrame > .wfTopBar .wftTitle { | ||
color: #e8e8e8; | ||
} | ||
|
||
.dark-mode .popupMsg { | ||
background-color: #084e86; | ||
color: #e8e8e8; | ||
} | ||
|
||
.dark-mode #printText { | ||
border-color: #000000; | ||
} | ||
|
||
.dark-mode #loading-image-container { | ||
background: #1a1a1a !important; | ||
background-color: #1a1a1a !important; | ||
} | ||
|
||
.dark-mode #loadingText { | ||
color: white !important; | ||
} | ||
|
||
.dark-mode .dropdown-content li > a{ | ||
background-color: #1c1c1c; | ||
color: #3fe0d1; | ||
} | ||
|
||
.dark-mode .dropdown-content li > a:hover { | ||
color: #252525 | ||
} | ||
|
||
.dark-mode .dropdown-content{ | ||
background-color: #1c1c1c; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,12 +130,13 @@ class Palettes { | |
td.width = 1.5 * this.cellSize; | ||
td.height = 1.5 * this.cellSize; | ||
td.style.position = "relative"; | ||
td.style.backgroundColor = platformColor.paletteBackground; | ||
td.appendChild( | ||
makePaletteIcons( | ||
PALETTEICONS[MULTIPALETTEICONS[i]] | ||
.replace("background_fill_color", platformColor.selectorBackground) | ||
.replace(/stroke_color/g, platformColor.ruleColor) | ||
.replace(/fill_color/g, platformColor.background), | ||
.replace("background_fill_color", platformColor.paletteLabelBackground) | ||
.replace(/stroke_color/g, "#E2E2E2") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should these values be defined in platformColor? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, irrespective of light or dark mode, the stroke color is same for both. And I also created paletteLabelBackgroung because of its unique dark theme color. |
||
.replace(/fill_color/g, "#F9F9F9"), | ||
1.5 * this.cellSize, | ||
1.5 * this.cellSize | ||
) | ||
|
@@ -146,7 +147,7 @@ class Palettes { | |
cover.style.top = "0"; | ||
cover.style.width = "100%"; | ||
cover.style.height = "1px"; | ||
cover.style.background = platformColor.selectorBackground; | ||
cover.style.background = platformColor.paletteLabelBackground; | ||
td.appendChild(cover); | ||
td.onmouseover = () => { | ||
this.showSelection(i, tr); | ||
|
@@ -161,23 +162,23 @@ class Palettes { | |
if (j === i) { | ||
img = makePaletteIcons( | ||
PALETTEICONS[MULTIPALETTEICONS[j]] | ||
.replace("background_fill_color", platformColor.selectorSelected) | ||
.replace(/stroke_color/g, platformColor.ruleColor) | ||
.replace(/fill_color/g, platformColor.background), | ||
.replace("background_fill_color", platformColor.paletteLabelSelected) | ||
.replace(/stroke_color/g, "#E2E2E2") | ||
walterbender marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.replace(/fill_color/g, "#F9F9F9"), | ||
this.cellSize, | ||
this.cellSize | ||
); | ||
tr.children[j].children[1].style.background = platformColor.selectorSelected; | ||
tr.children[j].children[1].style.background = platformColor.paletteLabelSelected; | ||
} else { | ||
img = makePaletteIcons( | ||
PALETTEICONS[MULTIPALETTEICONS[j]] | ||
.replace("background_fill_color", platformColor.selectorBackground) | ||
.replace(/stroke_color/g, platformColor.ruleColor) | ||
.replace(/fill_color/g, platformColor.background), | ||
.replace("background_fill_color", platformColor.paletteLabelBackground) | ||
.replace(/stroke_color/g, "#E2E2E2") | ||
walterbender marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.replace(/fill_color/g, "#F9F9F9"), | ||
this.cellSize, | ||
this.cellSize | ||
); | ||
tr.children[j].children[1].style.background = platformColor.selectorBackground; | ||
tr.children[j].children[1].style.background = platformColor.paletteLabelBackground; | ||
} | ||
tr.children[j].children[0].src = img.src; | ||
} | ||
|
@@ -283,7 +284,7 @@ class Palettes { | |
); | ||
} | ||
} | ||
|
||
makeSearchButton(name, icon, listBody) { | ||
const row = listBody.insertRow(-1); | ||
const img = row.insertCell(-1); | ||
|
@@ -302,6 +303,7 @@ class Palettes { | |
row.style.flexDirection = "row"; | ||
row.style.alignItems = "center"; | ||
row.style.width = "126px"; | ||
row.style.backgroundColor = platformColor.paletteBackground; | ||
|
||
this._loadPaletteButtonHandler(name, row); | ||
} | ||
|
@@ -323,6 +325,7 @@ class Palettes { | |
row.style.flexDirection = "row"; | ||
row.style.alignItems = "center"; | ||
row.style.width = "126px"; | ||
row.style.backgroundColor = platformColor.paletteBackground; | ||
|
||
this._loadPaletteButtonHandler(name, row); | ||
} | ||
|
@@ -426,7 +429,7 @@ class Palettes { | |
'px"bgcolor="white"><thead><tr><td style= "width:28px"></tr></thead><tbody></tbody></table></div>'; | ||
element.childNodes[0].style.border = `1px solid ${platformColor.selectorSelected}`; | ||
document.body.appendChild(element); | ||
|
||
} catch (e) { | ||
console.error('Error clearing palettes:', e); | ||
} | ||
|
@@ -457,9 +460,9 @@ class Palettes { | |
timeout = setTimeout(() => this.showPalette(name), 400); | ||
} | ||
}; | ||
|
||
row.onmouseout = () => clearTimeout(timeout); | ||
|
||
// eslint-disable-next-line no-unused-vars | ||
row.onclick = (event) => { | ||
if (name == "search") { | ||
|
@@ -881,7 +884,7 @@ class Palette { | |
if (createHeader) { | ||
let header = this.menuContainer.children[0]; | ||
header = header.insertRow(); | ||
header.style.background = platformColor.selectorSelected; | ||
header.style.backgroundColor = platformColor.paletteLabelBackground; | ||
header.innerHTML = | ||
'<td style ="width: 100%; height: 42px; box-sizing: border-box; display: flex; flex-direction: row; align-items: center; justify-content: space-between;"></td>'; | ||
header = header.children[0]; | ||
|
@@ -900,7 +903,7 @@ class Palette { | |
const label = document.createElement("span"); | ||
label.textContent = toTitleCase(_(this.name)); | ||
label.style.fontWeight = "bold"; | ||
label.style.color = platformColor.paletteBackground; | ||
label.style.color = platformColor.textColor; | ||
header.appendChild(label); | ||
|
||
const closeDownImg = document.createElement("span"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,7 @@ class Toolbar { | |
["delPluginIcon", _("Delete plugin")], | ||
["enableHorizScrollIcon", _("Enable horizontal scrolling")], | ||
["disableHorizScrollIcon", _("Disable horizontal scrolling")], | ||
["darkModeIcon", _("Change theme")], | ||
["mergeWithCurrentIcon", _("Merge with current project")], | ||
["chooseKeyIcon", _("Set Pitch Preview")], | ||
["toggleJavaScriptIcon", _("JavaScript Editor")], | ||
|
@@ -128,6 +129,7 @@ class Toolbar { | |
_("Delete plugin"), | ||
_("Enable horizontal scrolling"), | ||
_("Disable horizontal scrolling"), | ||
_("Change theme"), | ||
_("Merge with current project"), | ||
_("Set Pitch Preview"), | ||
_("JavaScript Editor"), | ||
|
@@ -193,6 +195,7 @@ class Toolbar { | |
["delPluginIcon", _("Delete plugin")], | ||
["enableHorizScrollIcon", _("Enable horizontal scrolling")], | ||
["disableHorizScrollIcon", _("Disable horizontal scrolling")], | ||
["darkModeIcon", _("Change theme")], | ||
["mergeWithCurrentIcon", _("Merge with current project")], | ||
["toggleJavaScriptIcon", _("JavaScript Editor")], | ||
["restoreIcon", _("Restore")], | ||
|
@@ -249,6 +252,7 @@ class Toolbar { | |
_("Delete plugin"), | ||
_("Enable horizontal scrolling"), | ||
_("Disable horizontal scrolling"), | ||
_("Change theme"), | ||
_("Merge with current project"), | ||
_("JavaScript Editor"), | ||
_("Restore"), | ||
|
@@ -422,7 +426,7 @@ class Toolbar { | |
|
||
/** | ||
* Renders the load icon with the provided onclick handler. | ||
* | ||
* | ||
* @public | ||
* @param {Function} onclick - The onclick handler for the load icon. | ||
* @returns {void} | ||
|
@@ -435,6 +439,14 @@ class Toolbar { | |
}; | ||
} | ||
|
||
renderDarkModeIcon(onclick) { | ||
const darkModeIcon = docById("darkModeIcon"); | ||
|
||
darkModeIcon.onclick = () => { | ||
onclick(); | ||
} | ||
} | ||
|
||
/** | ||
* Renders the wrap icon. | ||
* | ||
|
@@ -1074,7 +1086,7 @@ function renderNewProjectConfirmation() { | |
const confirmationButton = document.createElement("a"); | ||
confirmationButton.id = "new-project"; | ||
confirmationButton.style.display = "inline-block"; | ||
confirmationButton.style.backgroundColor = "#2196F3"; | ||
confirmationButton.style.backgroundColor = "#0066FF"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be defined in platformColor? |
||
confirmationButton.style.color = "white"; | ||
confirmationButton.style.textDecoration = "none"; | ||
confirmationButton.style.borderRadius = "4px"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still a few hardcoded color values. Any reason not to move these to platformColor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Irrespective of dark or light mode the color will be the same. But now we are talking about multiple themes so it makes sense to not hardcode them.