Skip to content

Conversation

@mkh-user
Copy link
Member

@mkh-user mkh-user commented Sep 14, 2025

Type of Change

  • New feature

Description

Provides a theme loading system that load themes from user://themes/ by names, also an initializer that sync missing internal themes with this folder (internal themes: res://data/themes/). Users can change mode with Editor UI > Theme Name in settings (supports change without restart). New external themes can be added with paste them in user://themes/.

Testing

Works fine in sync, change, and load.

Impact

Syncs internal themes based on file existent, so will sync one time in most cases. Then loads theme from its file based on settings, this task takes ~5ms in startup.

Additional Information

Nothing

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings
  • Changes were added to CHANGELOG

Summary by CodeRabbit

  • New Features

    • Automatic theme setup on first run with a safe dark fallback and new editor theme preset; added "Supported Extensions" field in Mode Editor.
  • UI/Style

    • Unified theming across buttons, panels, lists, trees, counters and backgrounds; command palette button now labeled "New"; refreshed Problems, Files, Outline, Recent Projects, Settings, About and panels.
  • Documentation

    • Added Themes guide and site navigation entry with install/apply instructions.
  • Performance

    • Reduced scene load steps in multiple views for faster startup.
  • Chores

    • Project theme reference and changelog updated (Theme support).

@mkh-user mkh-user self-assigned this Sep 14, 2025
@mkh-user mkh-user moved this to In progress in Release: Text Forge 1.0 Sep 14, 2025
@coderabbitai coderabbitai bot added the action scripts Official action scripts or action scripts features label Sep 14, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 14, 2025

Walkthrough

Adds a theme system: new theme assets, theme initialization/copying to user data, theme loading with fallback, scene refactors to use theme_type_variation instead of inline StyleBox overrides, UI tweaks, docs, and settings integration for selecting themes.

Changes

Cohort / File(s) Summary
Core theming & runtime
core/main.gd, core/classes/file_database.gd, project.godot
Add theme folder constants and TEMPLATE_THEME; add Core._initialize_themes() and call it from _ready(); load/apply configured theme with fallback to "dark"; update project theme UID.
Main scene / UI root updates
core/main.tscn
Reduce load_steps; rename root BackBackground and change type to Panel with theme_type_variation = "MainBackground"; remove inline style subresources and replace many per-node style overrides with theme_type_variation.
Primary theme resource
data/themes/dark.tres
Major theme overhaul: new UID/load_steps; remap ext_resources; add many StyleBoxFlat/StyleBoxEmpty subresources; declare numerous named theme entries (MainBackground, CommandButton, FileTree, ProblemPanel, ErrorCount, WarningCount, SettingsOptionSpinBox, etc.); update icons/fonts and style mappings.
Scene theming & small UI edits
action_scripts/scenes/command_pallete.tscn, action_scripts/scenes/mode_manager.tscn, action_scripts/scenes/recent_projects.tscn, action_scripts/scenes/setting_option.tscn, action_scripts/scenes/preferences.tscn
Replace explicit theme/style overrides with theme_type_variation on many controls; add/adjust small node properties (Button.text/alignment/text_overrun_behavior, SupportedExtensions LineEdit + connection, SpinBox variation and tab index, Project separator variation, Preferences TabContainer variation).
Scene script styling cleanup
action_scripts/scenes/preferences.gd
Remove explicit ScrollContainer panel style override in _ready() to rely on theme defaults.
Panels: files / outline / problems
data/panels/files/panel.tscn, data/panels/outline/panel.tscn, data/panels/problems/panel.tscn, data/panels/files/panel.tscn
Remove inline StyleBox sub-resources; adopt theme_type_variation for TabContainer/Tree/OutlineTree and other controls; hide Label/Tree by default in files panel; change TabContainer current_tab and reduce load_steps.
Removed legacy resource
data/margin_style_box_empty.tres
Delete legacy StyleBoxEmpty resource (5px margins); references replaced by theme variations.
Panels load_steps & metadata updates
data/panels/*.tscn, core/main.tscn
Reduce scene load_steps across several UI scenes and remove inline style subresources.
Docs, navigation & changelog
docs/themes.md, mkdocs.yml, CHANGELOG.md
Add theming documentation page; add "Themes" entry to mkdocs navigation; add changelog entry for theme support.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Core
  participant FS as FileSystem
  participant RL as ResourceLoader
  participant UI as SceneTree

  User->>Core: Launch app
  activate Core
  Core->>Core: _ready()
  Core->>Core: _initialize_themes()
  Core->>FS: ensure `user://themes/` exists
  Core->>FS: copy `res://data/themes/*.tres` -> `user://themes/` if missing
  Core->>Core: _handle_settings()
  alt theme exists at user://themes/{theme_name}.tres
    Core->>RL: load user://themes/{theme_name}.tres
  else
    Core->>Core: _initialize_themes()
    Core->>RL: load user://themes/dark.tres
  end
  RL-->>Core: Theme resource
  Core->>UI: apply Theme (ui elements use theme_type_variation)
  deactivate Core
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

I hopped through panels, copied night to user lands,
Gave buttons names and trees new strands.
Tabs wear styles, margins took flight,
Dark theme bundled, ready at night.
A rabbit nudged the editor’s bright. 🐇✨

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch theme-support

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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 and usage tips.

Pre-merge checks

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning The PR implements key pieces of the linked issue: it adds runtime theme loading and a sync initializer that copies internal themes into user://themes/, exposes an Editor UI > Theme Name setting, and refactors many scenes to use theme_type_variation so UI elements reflect theme styling and persist across sessions. However, the changeset does not show an importer or handling for packaged .tftheme files nor modifications to the syntax-highlighting/mode subsystem to adapt editor token colors, so two acceptance criteria remain unaddressed. Because those requirements from issue [#39] are unmet or undocumented, the PR does not fully satisfy the linked issue. Implement or document a .tftheme import path (or convert .tftheme into .tres during sync) and add tests proving external themes can be loaded into user://themes/; update the syntax-highlighting/mode system so token colors are driven by the active theme and include a live-switching test demonstrating highlighting changes; finally, update the PR description and docs to clearly state supported theme formats, limitations, and verification steps so reviewers can confirm the remaining acceptance criteria.
Out of Scope Changes Check ⚠️ Warning Most edits are theming-related, but the PR also contains structural or behavioral changes that are not strictly required for theme support and may break downstream consumers: core/main.tscn renames and changes a root node type (Back → Background, ColorRect → Panel), a shared style resource (data/margin_style_box_empty.tres) was deleted, data/panels/files/panel.tscn sets Label and Tree to visible=false, and setting_option.tscn changes a SpinBox metadata/_tab_index. Those modifications alter public scene signatures or default UI behavior and should be separated or justified. Revert or move structural and behavioral changes (node renames/type changes, deletion of shared style resources, visibility and tab_index edits) into separate, focused PRs that include migration notes and tests; if renames or type changes are intentional, add compatibility shims or explicit upgrade documentation and update the CHANGELOG to call out breaking changes; run integration smoke tests on core scenes before merging to ensure no regressions.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Add theme changing support at runtime" is a concise, single-sentence summary that accurately describes the primary intent of the changeset (runtime theme loading/switching and associated UI theming refactors). It maps directly to the core changes (theme initialization, settings option, and scene updates to use theme variations) without noisy file lists or implementation details. This makes it clear and easy for teammates scanning history to understand the main change.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@mkh-user mkh-user mentioned this pull request Sep 15, 2025
coderabbitai[bot]

This comment was marked as resolved.

@mkh-user mkh-user added this to the Text Forge 0.2 milestone Sep 15, 2025
@mkh-user mkh-user removed scope: core action scripts Official action scripts or action scripts features labels Sep 16, 2025
@mkh-user mkh-user merged commit 9307ddd into Main Sep 16, 2025
2 checks passed
@mkh-user mkh-user deleted the theme-support branch September 16, 2025 13:47
@github-project-automation github-project-automation bot moved this from In Progress to Completed in Release: Text Forge 1.0 Sep 16, 2025
@mkh-user mkh-user linked an issue Oct 2, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

Add syntax colors to themes Themes

2 participants