[Core]: Allow setting embed color to none. #6707

Manually merged
Evanroby merged 0 commits from Evanroby/setcolor into V3/develop 2026-11-21 16:10:05 +01:00
Evanroby commented 2026-03-29 14:04:54 +02:00 (Migrated from github.com)

Description of the changes

Fixes #6618
Rewrite of AI-looking PR #6702

  • [p]set colour converted to a group so missing args now errors instead of silently resetting to red
  • [p]set colour theme sets embed colour to None (Discord's default theme colour)
  • [p]set colour reset explicitly resets to Red's default (Flame Red, 0xE74C3C, or 15158332)
  • get_embed_color and embed_colour return type updated to Optional[discord.Colour]
  • _pre_login guarded against None color value to prevent crash on startup

Have the changes in this PR been tested?

Yes

### Description of the changes Fixes #6618 Rewrite of AI-looking PR #6702 - `[p]set colour` converted to a group so missing args now errors instead of silently resetting to red - `[p]set colour theme` sets embed colour to `None` (Discord's default theme colour) - `[p]set colour reset` explicitly resets to Red's default (Flame Red, `0xE74C3C`, or `15158332`) - `get_embed_color` and `embed_colour` return type updated to `Optional[discord.Colour]` - `_pre_login` guarded against `None` color value to prevent crash on startup ### Have the changes in this PR been tested? <!-- Choose one (remove the line that doesn't apply): --> Yes <!-- If the question doesn't apply (for example, it's not a code change), choose Yes. Please respond to this question truthfully. We do not delay nor reject PRs based on the answer to this question but it allows to better review this PR. -->
Flame442 (Migrated from github.com) reviewed 2026-03-29 14:04:54 +02:00
Flame442 (Migrated from github.com) requested changes 2026-03-29 20:28:41 +02:00
@ -4090,16 +4090,41 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
- `[p]set color #7F8C8D`
Flame442 (Migrated from github.com) commented 2026-03-29 20:28:37 +02:00
        await ctx.bot._config.color.clear()
        default_color = await ctx.bot._config.color()
        ctx.bot._color = default_color

(untested suggestion)

.clear would be better, mostly to avoid inconsistencies if we ever decide to change the default color for some reason. That would require either fetching to know what the default was, or storing the default in some way that it can be imported. I would probably just go with the fetch, since this command does not particularly care about the mild performance hit.
github.com/Cog-Creators/Red-DiscordBot@e2acec0862/redbot/core/bot.py (L121)

```suggestion await ctx.bot._config.color.clear() default_color = await ctx.bot._config.color() ctx.bot._color = default_color ``` (untested suggestion) `.clear` would be better, mostly to avoid inconsistencies if we ever decide to change the default color for some reason. That would require either fetching to know what the default was, or storing the default in some way that it can be imported. I would probably just go with the fetch, since this command does not particularly care about the mild performance hit. https://github.com/Cog-Creators/Red-DiscordBot/blob/e2acec08623c6a31ed8f2c1134db269656e2d847/redbot/core/bot.py#L121
Evanroby (Migrated from github.com) reviewed 2026-03-29 20:38:30 +02:00
@ -4090,16 +4090,41 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
- `[p]set color #7F8C8D`
Evanroby (Migrated from github.com) commented 2026-03-29 20:38:30 +02:00

I'll run testings with this, we'll see if it works. If it works correctly, I'll resolve

I'll run testings with this, we'll see if it works. If it works correctly, I'll resolve
Evanroby (Migrated from github.com) reviewed 2026-03-29 21:05:52 +02:00
@ -4090,16 +4090,41 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
- `[p]set color #7F8C8D`
Evanroby (Migrated from github.com) commented 2026-03-29 21:05:51 +02:00

Works great for me.

Works great for me.
Flame442 (Migrated from github.com) reviewed 2026-03-31 02:33:10 +02:00
@ -4090,16 +4090,41 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
- `[p]set color #7F8C8D`
Flame442 (Migrated from github.com) commented 2026-03-31 02:33:10 +02:00

Looking closer at the rest of the PR, would it be better for this to be discord.Colour(default_color) if default_coloris not None else None?

Looking closer at the rest of the PR, would it be better for this to be `discord.Colour(default_color) if default_coloris not None else None`?
Evanroby (Migrated from github.com) reviewed 2026-03-31 07:52:31 +02:00
@ -4090,16 +4090,41 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
- `[p]set color #7F8C8D`
Evanroby (Migrated from github.com) commented 2026-03-31 07:52:31 +02:00

Great catch fixed it

Great catch fixed it
Mrcoolgamer11 manually merged commit e4a6a05759 into V3/develop 2026-11-21 16:10:05 +01:00
Sign in to join this conversation.
No reviewers
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!6707
No description provided.