Initial commit - Custom theme and logo

main
Charlotte Som 2021-08-04 22:55:47 +01:00
commit d67e7e3017
6 changed files with 71 additions and 0 deletions

9
.editorconfig Normal file
View File

@ -0,0 +1,9 @@
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
/discord.apk
/discord
__pycache__
*.keystore
*.keystore.pw
discord*.apk*

View File

@ -0,0 +1 @@
from .custom_theme import patch_theme

View File

@ -0,0 +1,22 @@
import shutil
import os
def apply_custom_theme(colors_file: str) -> str:
return colors_file \
.replace("36393f", "292841") \
.replace("292b2f", "413f66") \
.replace("2f3136", "242338") \
.replace("202225", "1c1b29") \
.replace("18191c", "1c1b29")
def patch_theme():
with open("discord/res/values/colors.xml") as f:
color_theme = f.read()
color_theme = apply_custom_theme(color_theme)
with open("discord/res/values/colors.xml", "w") as f:
f.write(color_theme)
os.remove("discord/res/drawable-xxxhdpi/img_logo.png")
shutil.copy("lesbibabs.png", "discord/res/drawable-xxxhdpi/img_logo.png")

BIN
lesbibabs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

32
patch.py Normal file
View File

@ -0,0 +1,32 @@
from android_discord_patches import patch_theme
import shutil
import os
def disassemble():
shutil.rmtree("discord", ignore_errors=True)
os.system("apktool d ./discord.apk -o discord")
def patch():
patch_theme()
input("[hit enter]")
def reassemble():
os.system("apktool b discord -o discord-patched.apk")
os.system(
"apksigner sign "
"--ks discord.keystore "
"--ks-pass file:discord.keystore.pw "
"--in discord-patched.apk "
"--out discord-patched-signed.apk "
)
if __name__ == "__main__":
disassemble()
patch()
reassemble()