commit 475326dd48c9e0d080925eab1b8914824d13f6e4
parent 3586a892c3a95fd027293b9ef0920c27e3206f84
Author: Jacob Thomas <41988041+bocajthomas@users.noreply.github.com>
Date:   Sun, 28 Apr 2024 13:33:22 +0100

refactor: colors (#972)

* refactor: colors

* refactor: sent & received
Diffstat:
Mcommon/src/main/assets/lang/en_US.json | 14+++++++-------
Mcommon/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/UserInterfaceTweaks.kt | 12++++++------
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/CustomizeUI.kt | 34+++++++++++++++++-----------------
3 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/common/src/main/assets/lang/en_US.json b/common/src/main/assets/lang/en_US.json @@ -366,27 +366,27 @@ "name": "Colors", "description": "Customize Snapchats Colors", "properties": { - "text_colour": { + "text_color": { "name": "Text Color", "description": "Changes Snapchats text color\nInput hex color code" }, - "chat_colour": { - "name": "Sent & Received Color", + "send_and_received_text_color": { + "name": "Sent & Received Text Color", "description": "Changes Snapchats Sent and Received text color on the friend feed\nInput a hex color code" }, - "background_colour": { + "background_color": { "name": "Background Color", "description": "Changes Snapchats background color\nInput a hex color code" }, - "background_colour_surface": { + "background_color_surface": { "name": "Background Surface Color", "description": "Changes Snapchats background surface color\nInput a hex color code" }, - "action_menu_background_colour": { + "action_menu_background_color": { "name": "Action Menu Background Color", "description": "Changes Snapchats chat action menu background color\nInput a hex color code" }, - "action_menu_round_background_colour": { + "action_menu_round_background_color": { "name": "Action Menu Round Background Color", "description": "Changes Snapchats chat action menu round background color\nInput a hex color code" } diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/UserInterfaceTweaks.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/UserInterfaceTweaks.kt @@ -23,12 +23,12 @@ class UserInterfaceTweaks : ConfigContainer() { private val checkInputColor = { value: String -> value.isEmpty() || runCatching { Color.parseColor(value) }.isSuccess } - val textColour = string("text_colour") { inputCheck = checkInputColor } - val backgroundColour = string("background_colour") { inputCheck = checkInputColor } - val backgroundColourSurface = string("background_colour_surface") { inputCheck = checkInputColor } - val actionMenuBackgroundColour = string("action_menu_background_colour") { inputCheck = checkInputColor } - val actionMenuRoundBackgroundColour = string("action_menu_round_background_colour") { inputCheck = checkInputColor } - val chatColour = string("chat_colour") { inputCheck = checkInputColor } + val textColor = string("text_color") { inputCheck = checkInputColor } + val sendAndReceivedTextColor = string("send_and_received_text_color") { inputCheck = checkInputColor } + val backgroundColor = string("background_color") { inputCheck = checkInputColor } + val backgroundColorSurface = string("background_color_surface") { inputCheck = checkInputColor } + val actionMenuBackgroundColor = string("action_menu_background_color") { inputCheck = checkInputColor } + val actionMenuRoundBackgroundColor = string("action_menu_round_background_color") { inputCheck = checkInputColor } } val friendFeedMenuButtons = multiple( diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/CustomizeUI.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/ui/CustomizeUI.kt @@ -25,13 +25,13 @@ class CustomizeUI: Feature("Customize UI", loadParams = FeatureLoadParams.ACTIVI //TODO: color picker val customizeUIConfig = context.config.userInterface.customizeUi - val effectiveTextColour by lazy { parseColor(customizeUIConfig.textColour.get()) } - val effectiveBackgroundColour by lazy { parseColor(customizeUIConfig.backgroundColour.get()) } - val effectiveBackgroundColourSurface by lazy { parseColor(customizeUIConfig.backgroundColourSurface.get()) } - val effectiveActionMenuBackgroundColour by lazy { parseColor(customizeUIConfig.actionMenuBackgroundColour.get()) } - val effectiveActionMenuRoundBackgroundColour by lazy { parseColor(customizeUIConfig.actionMenuRoundBackgroundColour.get()) } - val effectiveChatColour by lazy { parseColor(customizeUIConfig.chatColour.get()) } - + val effectiveTextColor by lazy { parseColor(customizeUIConfig.textColor.get()) } + val effectivesendAndReceivedTextColor by lazy { parseColor(customizeUIConfig.sendAndReceivedTextColor.get()) } + val effectiveBackgroundColor by lazy { parseColor(customizeUIConfig.backgroundColor.get()) } + val effectiveBackgroundColorSurface by lazy { parseColor(customizeUIConfig.backgroundColorSurface.get()) } + val effectiveActionMenuBackgroundColor by lazy { parseColor(customizeUIConfig.actionMenuBackgroundColor.get()) } + val effectiveActionMenuRoundBackgroundColor by lazy { parseColor(customizeUIConfig.actionMenuRoundBackgroundColor.get()) } + val attributeCache = mutableMapOf<String, Int>() fun getAttribute(name: String): Int { @@ -69,38 +69,38 @@ class CustomizeUI: Feature("Customize UI", loadParams = FeatureLoadParams.ACTIVI if (isCustomizeUI) { when (array[0]) { getAttribute("sigColorTextPrimary") -> { - ephemeralHook("getColor", effectiveTextColour ?: return@hook) + ephemeralHook("getColor", effectiveTextColor ?: return@hook) } getAttribute("sigColorBackgroundMain") -> { - ephemeralHook("getColor", effectiveBackgroundColour ?: return@hook) + ephemeralHook("getColor", effectiveBackgroundColor ?: return@hook) } getAttribute("sigColorBackgroundSurface") -> { - ephemeralHook("getColor", effectiveBackgroundColourSurface ?: return@hook) + ephemeralHook("getColor", effectiveBackgroundColorSurface ?: return@hook) } getAttribute("actionSheetBackgroundDrawable") -> { - ephemeralHook("getDrawable", ColorDrawable(effectiveActionMenuBackgroundColour ?: return@hook)) + ephemeralHook("getDrawable", ColorDrawable(effectiveActionMenuBackgroundColor ?: return@hook)) } getAttribute("actionSheetRoundedBackgroundDrawable") -> { - ephemeralHook("getDrawable", ColorDrawable(effectiveActionMenuRoundBackgroundColour ?: return@hook)) + ephemeralHook("getDrawable", ColorDrawable(effectiveActionMenuRoundBackgroundColor ?: return@hook)) } getAttribute("sigColorChatActivity") -> { - ephemeralHook("getColor", effectiveChatColour ?: return@hook) + ephemeralHook("getColor", effectivesendAndReceivedTextColor ?: return@hook) } getAttribute("sigColorChatChat") -> { - ephemeralHook("getColor", effectiveChatColour ?: return@hook) + ephemeralHook("getColor", effectivesendAndReceivedTextColor ?: return@hook) } getAttribute("sigColorChatPendingSending") -> { - ephemeralHook("getColor", effectiveChatColour ?: return@hook) + ephemeralHook("getColor", effectivesendAndReceivedTextColor ?: return@hook) } getAttribute("sigColorChatSnapWithSound") -> { - ephemeralHook("getColor", effectiveChatColour ?: return@hook) + ephemeralHook("getColor", effectivesendAndReceivedTextColor ?: return@hook) } getAttribute("sigColorChatSnapWithoutSound") -> { - ephemeralHook("getColor", effectiveChatColour ?: return@hook) + ephemeralHook("getColor", effectivesendAndReceivedTextColor ?: return@hook) } } }