Added blacktheme

This commit is contained in:
Akif9748 2022-08-31 19:16:43 +03:00
parent 9e9c7be917
commit 43408f8a90
7 changed files with 34 additions and 14 deletions

View file

@ -1,12 +1,13 @@
:root { :root {
--main: #4d18e6; --main: #ac8fff;
--btn-clr-1: #e8e8e8; --btn-clr-1: #e8e8e8;
--menu-item: #ffffff; --menu-item: #ffffff;
--borders: #d9d9d9; --borders: #d9d9d9;
--input-clr: #414141; --input-clr: #dcdcdc;
--box-shadow: #c3c3c3; --box-shadow: #c3c3c3;
--second: #747474; --second: #9f9f9f;
--reaction-hover: #151515; --reaction-hover: #ebebeb;
--t-username: #555; --t-username: rgb(236 236 236);
background-color: #ffffff; background-color: #000000;
} }

View file

@ -30,12 +30,13 @@
margin-right: 5px; margin-right: 5px;
} }
.message .left .username { .message .left .username a {
color: var(--t-username); color: var(--t-username);
} }
.content { .content {
width: 70%; width: 70%;
color: var(--reaction-hover);
} }
.reactions { .reactions {

View file

@ -15,13 +15,15 @@
} }
.threads-box:hover { .threads-box:hover {
background-color: var(--borders); background-color: var(--box-shadow);
} }
.thread-box-title { .thread-box-title {
padding: 10px; padding: 10px;
font-size: 18px; font-size: 18px;
font-weight: 700; font-weight: 700;
color: var(--reaction-hover);
} }
.thread-box-title>span { .thread-box-title>span {

View file

@ -20,8 +20,12 @@
padding: 10px; padding: 10px;
margin: 8px; margin: 8px;
font-weight: 500; font-weight: 500;
}
}
.user-box-title>a{
color: var(--reaction-hover);
}
.user-box-title>span { .user-box-title>span {
color: var(--important); color: var(--important);
} }

View file

@ -59,8 +59,8 @@ app.patch("/:id/", async (req, res) => {
const { user, member } = req; const { user, member } = req;
if (req.user.id !== member.id && !req.user.admin) return res.error(403, "You have not got permission for this."); if (req.user.id !== member.id && !req.user.admin) return res.error(403, "You have not got permission for this.");
const { avatar, name, about } = req.body; const { avatar, name, about, theme } = req.body;
if (!avatar && !name&& !about) return res.error(400, "Missing member informations in request body."); if (!avatar && !name && !about && !theme) return res.error(400, "Missing member informations in request body.");
if (avatar && /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g.test(avatar)) if (avatar && /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g.test(avatar))
member.avatar = avatar; member.avatar = avatar;
if (name) { if (name) {
@ -69,9 +69,10 @@ app.patch("/:id/", async (req, res) => {
} }
if (about) member.about = about; if (about) member.about = about;
if (theme) member.theme = member.theme === "default" ? "black" : "default";
member.theme = theme;
member.edited = true; member.edited = true;
await member.save(); await member.save();
res.complate(member); res.complate(member);

View file

@ -17,6 +17,7 @@
border: 1px solid #dddddd; border: 1px solid #dddddd;
text-align: left; text-align: left;
padding: 8px; padding: 8px;
color: var(--reaction-hover);
} }
tr:nth-child(even) { tr:nth-child(even) {

View file

@ -18,8 +18,18 @@
</div> </div>
</a> </a>
<a id="logout" href="/login" class="btn-primary">Logout</a> <a id="logout" href="/login" class="btn-primary">Logout</a>
<a onclick="invert()" class="btn-outline-primary"><%=(user.theme === "default" ? "black" : "default" ) + " mode" %></a>
<script>
async function invert() {
await fetch('/api/users/<%= user.id %>',{method:'PATCH',
body:JSON.stringify({theme:"<%=user.theme === `default` ? `black` : `default` %>"}),
headers: {
"Content-Type": "application/json"
}
})
location.reload()
}
</script>
<% } else { %> <% } else { %>
<a id="login" href="/login" class="btn-primary">Login</a> <a id="login" href="/login" class="btn-primary">Login</a>