Skip to content

Improve dark mode support for editor and preview#1413

Open
TeaTinyTool wants to merge 1 commit into
prasathmani:masterfrom
TeaTinyTool:improve-dark-mode-editor-and-preview
Open

Improve dark mode support for editor and preview#1413
TeaTinyTool wants to merge 1 commit into
prasathmani:masterfrom
TeaTinyTool:improve-dark-mode-editor-and-preview

Conversation

@TeaTinyTool

Copy link
Copy Markdown

Summary

This improves dark mode support for the ACE editor and the file preview.

Problem

The TinyFileManager dark mode is currently not fully reflected in editor and preview views:

  • The ACE editor always starts with its default TextMate theme.
  • The file preview always loads the light Highlight.js style from $highlightjs_style.
  • Plain text previews without Highlight.js do not receive a dark mode style.

Changes

  • Use TextMate as the ACE theme in TinyFileManager light mode.
  • Use Twilight as the ACE theme in TinyFileManager dark mode.
  • Keep the existing manual ACE theme selector usable.
  • Add a new $highlightjs_style_dark setting next to $highlightjs_style.
  • Use $highlightjs_style in light mode.
  • Use $highlightjs_style_dark in dark mode.
  • Set the default dark Highlight.js style to vs2015.
  • Apply a dark background and light text color to plain text previews without Highlight.js.

Expected behavior

  • In light mode, editor and preview keep their current light appearance.
  • In dark mode, ACE and file preview start with a matching dark appearance.
  • Users can still manually change the ACE editor theme.

Make the ACE editor and file preview follow the current TinyFileManager theme.

Dark mode now uses a matching ACE theme and a separate Highlight.js style for previews, while light mode keeps the existing behavior. Plain text previews without Highlight.js also receive dark mode styling.

@prasathmani prasathmani left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

tinyfilemanager.php:4733 — Dead CSS selector: .file-preview-content does not exist, so the plain-text dark preview never applies.

The new rule is:

.theme-dark .file-preview-content pre {
    background-color: #101518;
    color: #CFD8DC;
    padding: 1rem;
}

There is no element with class file-preview-content anywhere in the file (or repo) — the preview content is rendered inside <div class="row"><div class="row mt-3"> (around tinyfilemanager.php:1796 and 1880), and the plain-text branch emits a bare <pre> at tinyfilemanager.php:1934. Since .theme-dark sits on <body> but .file-preview-content matches nothing, this selector is inert.

Failure scenario: With $highlightjs = false (Highlight.js disabled) in dark mode, viewing a plain text/config file — the PR's stated goal of "a dark background and light text color to plain text previews without Highlight.js" — leaves the preview with its default light appearance. The rule silently does nothing. Fix: target the actual wrapper (e.g. add a file-preview-content class to the preview <div>, or change the selector to match .theme-dark .row pre / the existing pre.with-hljs).

--
AI PR review

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants