I'm using breeze dark and noticed that when i view textfiles in dolphins information panel, the text there has the default color (white-ish), but also a white background and is thus not readable. I don't think this is a theming issue as i didn't find any way to set the test color for the preview. Setting the background of the preview to something other than white could lead to new issues with theming, so i think it would be best to simply default to black text on white ground for the preview?
Which frameworks version are you using? You can find out with Dolphin menu > Help > About Dolphin > Libraries
Qt version is also interesting.
Framework is 5.61.0, QT is at 5.13.0. While verifying that the issue still persists i noticed that some "generic" textfiles do come color-coded (.bashrc and .bash_profile for example) - but this doesn't seem to be caused by the file-content, as when i copy .bashrc to .bashrc1, the new file is white again. But going with .(1).bashrc yields colorcoded - so it seems it's dependent on file extension? After all i would assume that the file extension is parsed to view files like .py, .yml, .sh with colorcoded text?
I just noticed that a PKGBUILD file is also colored without any extension, so it's not just that.
I have this bug too and wanted to add some info, but I don't have much of a dev environment nor any experience with patching. I'm just using Dolphin and KDE pretty regularly. (Dolphin 19.08.1, frameworks 5.61.0, Qt 5.13.1 built against 5.13.0) In Dolphin, the font color for text file thumbnails/previews is always this one: [System Settings] -> [Colors] -> [in selection: Edit Color Scheme...] -> [Color Set: "View"] -> "Normal Text" or ... [Edit Color Scheme...] -> Common Colors -> "View Text" In code, I found a light background for the previews/thumbnails of all text files: https://cgit.kde.org/kio-extras.git/tree/thumbnail/textcreator.cpp lines 143 & 144: QColor bgColor = QColor ( 245, 245, 245 ); // light-grey background m_pixmap.fill( bgColor ); Seems this will affect both the preview panel, and the main view's preview-enabled thumbnails. If we change textcreator.cpp to have a explicitly black/dark-colors font, then rebuild, does that fix the problem? Can somebody please try this? More detail of how I was looking for this, tracing up from Dolphin->[kio]->[kio-extras]: • [dolphin]/src/panels/information/informationpanelapplet.cpp connect(m_previewJob.data(), &KIO::PreviewJob::gotPreview, this, &InformationPanelContent::showPreview); • [kio]/src/widgets/previewjob.cpp void PreviewJobPrivate::emitPreview(const QImage &thumb) { [...] pix = QPixmap::fromImage(thumb); } emit q->gotPreview(currentItem.item, pix); } • looking for anything that would affect the pixmap, or QPixmap, that PreviewJob needs by streaming text into it: • [kio-extras]/thumbnail/textcreator.cpp 72 bool TextCreator::create(const QString &path, int width, int height, QImage &img) 73 { ... 113 // create text-preview 114 QFile file( path ); ... 143 QColor bgColor = QColor ( 245, 245, 245 ); // light-grey background 144 m_pixmap.fill( bgColor ); 145 146 QPainter painter( &m_pixmap ); 147 148 QTextDocument textDocument(text); ... 172 textDocument.drawContents(&painter, QRectF(QPointF(0, 0), canvasSize)); ... 176 img = m_pixmap.toImage(); ... 179 file.close(); ... 182 }
*** This bug has been marked as a duplicate of bug 406821 ***