Skip to content

Add custom folder coloring#1304

Open
JoltedJon wants to merge 1 commit into
Redot-Engine:masterfrom
JoltedJon:custom_colors
Open

Add custom folder coloring#1304
JoltedJon wants to merge 1 commit into
Redot-Engine:masterfrom
JoltedJon:custom_colors

Conversation

@JoltedJon

@JoltedJon JoltedJon commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

This adds in an option to set custom folder colors in the filesystem as suggested by @TheAenema

SVG courtesy of @memmoxt

Summary by CodeRabbit

  • New Features

    • Added enhanced folder color assignment in the file browser, including a new Custom option.
    • Folder colors can be applied using both preset names and a Color Picker.
    • Supports applying the same color to multiple selected folders at once.
  • Bug Fixes

    • Improved folder icon/background coloring when switching between saved preset colors and custom selections.
    • Folder color settings are now correctly cleared when no custom folder colors are set.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 90725848-4c34-4eaa-bd4d-1013e619b084

📥 Commits

Reviewing files that changed from the base of the PR and between 28aa78f and 9e2fcc9.

⛔ Files ignored due to path filters (1)
  • editor/icons/FolderQuestion.svg is excluded by !**/*.svg
📒 Files selected for processing (2)
  • editor/docks/filesystem_dock.cpp
  • editor/docks/filesystem_dock.h
🚧 Files skipped from review as they are similar to previous changes (2)
  • editor/docks/filesystem_dock.h
  • editor/docks/filesystem_dock.cpp

Walkthrough

FileSystemDock now supports preset and custom folder colors, persists direct Color variants, and resolves folder colors from either stored names or direct values across the tree, file list, and directory icons.

Changes

Folder Color Support

Layer / File(s) Summary
Folder color state and contracts
editor/docks/filesystem_dock.h, editor/docks/filesystem_dock.cpp
Adds color-picker state, selected-folder tracking, helper method declarations, and required UI and Variant includes.
Folder color selection workflow
editor/docks/filesystem_dock.cpp
Adds the Custom context-menu option, collects selected folders, opens the color picker, applies confirmed colors, and updates project settings.
Variant-aware folder color rendering
editor/docks/filesystem_dock.cpp
Resolves folder colors from named strings or direct Color variants in the tree, file list, and directory icons.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant FileSystemDock
  participant ColorPicker
  participant ProjectSettings

  User->>FileSystemDock: Choose Custom folder color
  FileSystemDock->>ColorPicker: Open picker for selected folders
  User->>ColorPicker: Select and confirm color
  ColorPicker->>FileSystemDock: Return Color value
  FileSystemDock->>ProjectSettings: Persist folder color assignments
  FileSystemDock->>FileSystemDock: Refresh folder color rendering
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding support for custom folder colors in the filesystem.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
editor/docks/filesystem_dock.cpp (2)

3298-3313: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Check for NIL instead of p_color truthiness
Variant::booleanize() treats Color(0, 0, 0, 1) as false, so a user-picked pure black folder color gets erased instead of stored. Use a type check here rather than if (p_color).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@editor/docks/filesystem_dock.cpp` around lines 3298 - 3313, The folder-color
assignment in FileSystemDock::_set_folder_color must distinguish an absent color
from a valid black Color value. Replace the truthiness check on p_color with a
Variant type check for a Color, storing valid colors and erasing the folder
entry only when p_color is NIL.

1074-1118: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Handle direct Color folder assignments here. assigned_folder_colors can hold preset names or Color values, but this lookup still treats every value as a preset key. Direct colors will miss the preset map, render inherited colors incorrectly, and can insert a stray entry into folder_colors. editor/docks/filesystem_dock.cpp:1084

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@editor/docks/filesystem_dock.cpp` around lines 1074 - 1118, The folder color
inheritance lookup in the directory scan must support both preset-name and
direct Color values in assigned_folder_colors. Update the inheritance logic near
the color_scan_dir loop to inspect the stored Variant, resolving string values
through folder_colors while using Color values directly, without indexing
folder_colors for non-string assignments or creating stray entries.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@editor/docks/filesystem_dock.cpp`:
- Around line 3298-3313: The folder-color assignment in
FileSystemDock::_set_folder_color must distinguish an absent color from a valid
black Color value. Replace the truthiness check on p_color with a Variant type
check for a Color, storing valid colors and erasing the folder entry only when
p_color is NIL.
- Around line 1074-1118: The folder color inheritance lookup in the directory
scan must support both preset-name and direct Color values in
assigned_folder_colors. Update the inheritance logic near the color_scan_dir
loop to inspect the stored Variant, resolving string values through
folder_colors while using Color values directly, without indexing folder_colors
for non-string assignments or creating stray entries.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 63fbc569-a3ba-429e-b954-fdd3cd09b763

📥 Commits

Reviewing files that changed from the base of the PR and between aab4134 and 28aa78f.

⛔ Files ignored due to path filters (1)
  • editor/icons/FolderQuestion.svg is excluded by !**/*.svg
📒 Files selected for processing (2)
  • editor/docks/filesystem_dock.cpp
  • editor/docks/filesystem_dock.h

Co-authored-by: memmoxt <109536933+memmoxt@users.noreply.github.com>

@Shakai-Dev Shakai-Dev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR LGTM but I was wondering, would #1297 & #1305 affect this? If so, maybe we shouldn't merge this atm & merge it after those are merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants