Add accent color preview and dark mode by default

This commit is contained in:
Melon 2022-03-29 23:12:26 +01:00
parent 4adf0ce931
commit 13c5ea6f02
Signed by: melon
GPG Key ID: B0ADD5395BCDAAB6
2 changed files with 18 additions and 1 deletions

View File

@ -120,12 +120,14 @@ func (m *Module) homepage(rw http.ResponseWriter, req *http.Request, state *util
err = tmp.Execute(rw, struct { err = tmp.Execute(rw, struct {
User *discordgo.User User *discordgo.User
UserAccent string
Avatar template.HTMLAttr Avatar template.HTMLAttr
Guilds []*discordgo.UserGuild Guilds []*discordgo.UserGuild
GuildIcons []template.HTMLAttr GuildIcons []template.HTMLAttr
Connections []*discordgo.UserConnection Connections []*discordgo.UserConnection
}{ }{
User: myUser, User: myUser,
UserAccent: fmt.Sprintf("#%06x", myUser.AccentColor),
Avatar: template.HTMLAttr(fmt.Sprintf("src=\"/discord/user/avatar/%s/%s\"", myUser.ID, myUser.Avatar)), Avatar: template.HTMLAttr(fmt.Sprintf("src=\"/discord/user/avatar/%s/%s\"", myUser.ID, myUser.Avatar)),
Guilds: myGuilds, Guilds: myGuilds,
GuildIcons: guildIcons, GuildIcons: guildIcons,

View File

@ -3,6 +3,15 @@
<head> <head>
<title>Discord | Melon Tools</title> <title>Discord | Melon Tools</title>
<style> <style>
html, body {
background-color: #2a2c2d;
color: #d8d4d0;
}
a {
color: #4699fa;
}
.page-content { .page-content {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -20,6 +29,12 @@
padding: 8px; padding: 8px;
border-radius: 8px; border-radius: 8px;
} }
.colour-block {
display: inline-block;
width: 18px;
height: 18px;
}
</style> </style>
</head> </head>
<body> <body>
@ -38,7 +53,7 @@
<li>Verified: {{.Verified}}</li> <li>Verified: {{.Verified}}</li>
<li>MFA: {{.MFAEnabled}}</li> <li>MFA: {{.MFAEnabled}}</li>
<li>Banner: {{.Banner}}</li> <li>Banner: {{.Banner}}</li>
<li>Accent Color: {{.AccentColor}}</li> <li>Accent Color: {{$.UserAccent}} <span class="colour-block" style="background-color: {{$.UserAccent}}">&nbsp;</span></li>
<li>Bot: {{.Bot}}</li> <li>Bot: {{.Bot}}</li>
<li>Premium: {{.PremiumType}}</li> <li>Premium: {{.PremiumType}}</li>
<li>System: {{.System}}</li> <li>System: {{.System}}</li>