From 2cdf37191a1d3b48bf95016b76d5054a52424b86 Mon Sep 17 00:00:00 2001 From: Michael Simard Date: Wed, 3 Dec 2025 19:14:37 -0600 Subject: [PATCH] Add colored text for price change in embeds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Price change values now display with ANSI color formatting matching the embed border color: - Red text for negative price changes - Green text for positive price changes - Blue text for no change Improves visual clarity by color-coding the percentage change field. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- bot.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index ebe002b..66fc6ce 100644 --- a/bot.py +++ b/bot.py @@ -138,16 +138,19 @@ class StockBot(commands.Bot): if change_dollar > 0: color = discord.Color.green() change_emoji = "📈" + ansi_color = "\u001b[0;32m" # Green elif change_dollar < 0: color = discord.Color.red() change_emoji = "📉" + ansi_color = "\u001b[0;31m" # Red else: color = discord.Color.blue() change_emoji = "➡️" + ansi_color = "\u001b[0;34m" # Blue - # Format change string + # Format change string with ANSI color change_sign = "+" if change_dollar >= 0 else "" - change_str = f"{change_sign}${change_dollar} ({change_sign}{change_percent}%)" + change_str = f"```ansi\n{ansi_color}{change_sign}${change_dollar} ({change_sign}{change_percent}%)\u001b[0m\n```" # Custom title for PYPL ticker if ticker == "PYPL":