commit d67e7e3017a0a3d4ce4332542379a91246f8be50 Author: videogame hacker Date: Wed Aug 4 22:55:47 2021 +0100 Initial commit - Custom theme and logo diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..73390a1 --- /dev/null +++ b/.editorconfig @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..67ca72c --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/discord.apk +/discord +__pycache__ + +*.keystore +*.keystore.pw +discord*.apk* diff --git a/android_discord_patches/__init__.py b/android_discord_patches/__init__.py new file mode 100644 index 0000000..81e5c5e --- /dev/null +++ b/android_discord_patches/__init__.py @@ -0,0 +1 @@ +from .custom_theme import patch_theme diff --git a/android_discord_patches/custom_theme.py b/android_discord_patches/custom_theme.py new file mode 100644 index 0000000..15878bc --- /dev/null +++ b/android_discord_patches/custom_theme.py @@ -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") diff --git a/lesbibabs.png b/lesbibabs.png new file mode 100644 index 0000000..e63b5c0 Binary files /dev/null and b/lesbibabs.png differ diff --git a/patch.py b/patch.py new file mode 100644 index 0000000..a9ab5cf --- /dev/null +++ b/patch.py @@ -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()