Skip to content

Commit d8da76a

Browse files
author
gvbvdxxalt2
committed
Starting to work on dark theme
1 parent cd0b836 commit d8da76a

File tree

6 files changed

+121
-9
lines changed

6 files changed

+121
-9
lines changed

src/chat/elementjson/chat-styles.css

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@
187187
--soundboard-stop-button-bgcolor: hsl(0, 100%, 43%);
188188
--soundboard-stop-button-border-color: hsl(0, 100%, 23%);
189189
--soundboard-stop-button-hover-bgcolor: hsl(0, 100%, 50%);
190+
--soundboard-stop-button-text-color: hsl(0, 100%, 0%);
190191

191192
--menu-bar-hover-color: hsl(
192193
var(--accent-default-hue),
@@ -289,6 +290,70 @@
289290
--popup-dialog-message-size: 16px;
290291
}
291292

293+
body[data-theme="dark"] {
294+
--bg-color: hsl(
295+
var(--accent-default-hue),
296+
var(--accent-default-saturation),
297+
30%
298+
);
299+
--header-color: hsl(
300+
var(--accent-default-hue),
301+
var(--accent-default-saturation),
302+
30%
303+
);
304+
--main-text-color: hsl(
305+
var(--accent-default-hue),
306+
var(--accent-default-saturation),
307+
80%
308+
);
309+
--input-border-color: hsl(
310+
var(--accent-default-hue),
311+
var(--accent-default-saturation),
312+
80%
313+
);
314+
315+
--button-bg-color: hsl(
316+
var(--accent-default-hue),
317+
var(--accent-default-saturation),
318+
35%
319+
);
320+
--button-text-color: hsl(
321+
var(--accent-default-hue),
322+
var(--accent-default-saturation),
323+
86%
324+
);
325+
--button-hover-bg-color: hsl(
326+
var(--accent-default-hue),
327+
var(--accent-default-saturation),
328+
40%
329+
);
330+
--button-disabled-color: hsl(
331+
var(--accent-default-hue),
332+
var(--accent-default-saturation),
333+
20%
334+
);
335+
--popup-dialog-background: hsl(
336+
var(--accent-default-hue),
337+
var(--accent-default-saturation),
338+
25%
339+
);
340+
--popup-dialog-text-color: hsl(
341+
var(--accent-default-hue),
342+
var(--accent-default-saturation),
343+
90%
344+
);
345+
--popup-box-bg-color: hsl(
346+
var(--accent-default-hue),
347+
var(--accent-default-saturation),
348+
25%
349+
);
350+
--popup-box-text-color: hsl(
351+
var(--accent-default-hue),
352+
var(--accent-default-saturation),
353+
80%
354+
);
355+
}
356+
292357
::-webkit-scrollbar {
293358
width: 24px;
294359
}
@@ -461,11 +526,8 @@ body {
461526
height: fit-content;
462527
}
463528
.whiteBox {
464-
background: hsl(
465-
var(--accent-default-hue),
466-
var(--accent-default-saturation),
467-
100%
468-
);
529+
background: var(--popup-box-bg-color);
530+
color: var(--popup-box-text-color);
469531
padding: 10px;
470532
box-shadow: 0 0px 30px black;
471533
border-radius: 5px;
@@ -652,6 +714,7 @@ body {
652714
var(--button-sat),
653715
75%
654716
);
717+
--soundboard-button-text-color: hsl(0, 100%, 0%);
655718

656719
min-width: 150px;
657720
width: fit-content;
@@ -670,6 +733,7 @@ body {
670733
height: 90px;
671734
border-radius: 10px;
672735
overflow: hidden;
736+
color: var(--soundboard-button-text-color);
673737
}
674738
.soundboardButton:hover {
675739
background: var(--soundboard-button-hover-bgcolor);
@@ -710,6 +774,7 @@ body {
710774
height: 90px;
711775
border-radius: 10px;
712776
overflow: hidden;
777+
color: var(--soundboard-stop-button-text-color);
713778
}
714779
.soundboardButtonStop:hover {
715780
background: var(--soundboard-stop-button-hover-bgcolor);

src/chat/interface/chatinterface.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ var emojiReactions = require("./emojireactions.js");
129129
var clientSettings = require("./clientsettings.js");
130130
var KnownUserList = require("./userlist-menu.js");
131131

132+
require("./darktheme.js");
133+
132134
(async function () {
133135
try {
134136
updateManager.addUpdateListener("interface", () => {

src/chat/interface/clientsettings.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ class ClientSettingsMenu {
1010
JOKE_COMMANDS: true,
1111
BRACKET_CODE_SOUNDS: true,
1212
BELL_NOTIFICATIONS: true,
13+
DARK_THEME: false,
1314
};
1415
this.settings = {};
16+
this.settingFuncs = {};
1517
this.settingsList = [
1618
{
1719
name: "Chat notifcations",
@@ -37,16 +39,32 @@ class ClientSettingsMenu {
3739
name: "Message bracket sounds",
3840
id: "BRACKET_CODE_SOUNDS",
3941
type: "on-off",
42+
},
43+
{
44+
name: "Dark theme (Experimental): ",
45+
id: "DARK_THEME",
46+
type: "on-off",
4047
},
4148
];
4249
this.init();
4350
}
4451

52+
addSettingChangeFunction(id, func) {
53+
this.settingFuncs[id] = func;
54+
}
55+
56+
removeSettingChangeFunction(id) {
57+
delete this.settingFuncs[id];
58+
}
59+
4560
getSetting(id) {
4661
return this.settings[id];
4762
}
4863
setSetting(id, value) {
4964
this.settings[id] = value;
65+
if (this.settingFuncs[id]) {
66+
this.settingFuncs[id](value);
67+
}
5068
}
5169

5270
addClientSettingSwitchButton(id) {

src/chat/interface/darktheme.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var ClientSettings = require("./clientsettings.js");
2+
3+
var themeMain = document.body;
4+
var darkThemeID = "DARK_THEME";
5+
6+
themeMain.setAttribute("data-theme", ClientSettings.getSetting(darkThemeID) ? "dark" : "none");
7+
8+
ClientSettings.addSettingChangeFunction(darkThemeID, (value) => {
9+
themeMain.setAttribute("data-theme", value ? "dark" : "none");
10+
});

src/chat/interface/roomsettings.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ async function updateThemeSetting(index) {
5555
}
5656
}
5757

58+
5859
async function updateAllowGuests(allow) {
5960
try {
6061
var response = await fetch(
@@ -596,9 +597,23 @@ var dom = elements.createElementsFromJSON([
596597
},
597598
],
598599
},
599-
{
600-
element: "br",
601-
},
600+
{
601+
element: "br"
602+
},
603+
{
604+
element: "span",
605+
style: {
606+
color: "#cc0606",
607+
fontWeight: "bold"
608+
},
609+
gid: "guestUsersWarning",
610+
children: [
611+
"Guest users have the ability to bypass the allow list no matter what, turn guest users off if you don't want them in here.",
612+
{
613+
element: "br",
614+
},
615+
]
616+
},
602617
{
603618
element: "div",
604619
style: {
@@ -794,9 +809,11 @@ rs.updatePermission = function (name, value) {
794809
};
795810

796811
var roomSettingAllowGuests = elements.getGPId("roomSettingAllowGuests");
812+
var guestUsersWarning = elements.getGPId("guestUsersWarning");
797813

798814
rs.updateAllowGuests = function (value) {
799815
roomSettingAllowGuests.checked = value;
816+
guestUsersWarning.hidden = !value;
800817
};
801818

802819
var roomSettingTheme = elements.getGPId("roomSettings_theme");

wpstatic/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"timestamp":"1769087267005"}
1+
{"timestamp":"1769089951008"}

0 commit comments

Comments
 (0)