Created attachment 171033 [details]
Basic Editor in Dark Mode
Hi! I would like to discuss the possibility of having Dark Mode support in LO Basic Editor.
I am using LO 188.8.131.52 in KDE and my System Theme is set to Breeze Dark. In LO all UI elements use system colors, except for LO Basic Editor. I have uploaded a screenshot showing that, even on dark mode, the Basic Editor has white background and default font colors.
So, the idea would be to implement it in one of the 2 possible ways:
1) Detect system colors and apply them to the Basic Editor, or:
2) Have a toggle in Tools > Options > LibreOffice > General with something like "Use dark mode in Basic Editor" and then apply a predefined set of colors to the Editor and Syntax Highlighter
Currently the Basic Editor seems to get its color from the "Document Background" setting under Tools > Options > LibreOffice > Application Colors. Hence, to implement dark mode support we would have to dissociate Basic Editor's color from this setting, defining a new Color for "Basic Editor Background Color".
Other text editors in LO such as Math's formula editor respond to dark mode as expected.
Generic dark mode requests are in bug 118320 (Windows) and bug 118017 (macOS).
Linux/KDE/Breeze Dark work fine for me and I don't see what you want to improve. The white canvas, which comes from Writer (blank) or Calc (grid)? That's an option in Tools > Options > Application colors and actually better working than white on black.
Similar request in bug 114147 was rejected. So my take => WF
From using e.g. VS Code, to me it’s obvious that the default editor background should match the environment without having to fiddle with settings.
> Linux/KDE/Breeze Dark work fine for me and I don't see what you want to
> improve. The white canvas, which comes from Writer (blank) or Calc (grid)?
> That's an option in Tools > Options > Application colors and actually better
> working than white on black.
Hi Heiko. I think the main problem is that the color of the Basic Editor is the same as the one used in the Background of Writer documents. I think these colors should be treated separately, because users may want to keep their white background in Writer/Calc documents while programming on a dark background in the Basic Editor.
For example, most Writer documents are created with white-colored background in mind, because later they'll be printed or exported to PDF. So, even on a dark theme, the user may want to keep white background in Writer.
I believe the easiest way to implement this is to create a new color entry named "Basic Editor Background Color" in Tools > Options > LibreOffice > Application Colors. It could be placed near the other Basic color settings that already exist in the dialog.
Later, we could think of implementing more convenient ways for the user to apply a dark theme to the Basic Editor, by defining color presets for syntax highlighting in light and dark modes.
(In reply to Rafael Lima from comment #3)
> ...is the same as the one used in the Background of Writer documents.
Please start Math from Calc (Insert > Object > Formula) and revise your comment.
Created attachment 171189 [details]
Screenshots describing the issue
(In reply to Heiko Tietze from comment #4)
> Please start Math from Calc (Insert > Object > Formula) and revise your
Heiko, I'm not sure what you would like me to revise. As I pointed out in my first message: "Other text editors in LO such as Math's formula editor respond to dark mode as expected". You can see in the first image of the ODG file I've just attached that indeed the Formula Editor in Math follows system colors and gets a dark background and white font color.
As for this part: "is the same as the one used in the Background of Writer documents", what I meant is that Basic's Editor does not respond to dark mode because it gets its color from the "Document Background" color in the Options menu (see the 2nd image in the attached ODG file).
What I'm proposing is to have a separate color setting for the Basic IDE, so that the user can set different colors for "Document Background" and "Basic Editor Background Color".
Created attachment 171190 [details]
Screenshots describing the issue
Consider this ODG file for the message above.
Apologies, you talk about Basic. But still, why should it use a different color than other modules?
Even in dark mode, there are many reasons to stick with a white background in Writer:
1) I write papers in contribution with other authors and they create their documents using white background. This is the default in academic writing, because later the paper will be published as a PDF (with white background) or printed in paper (white too).
2) In Writer, if you chose a dark background and start adding images from other sources (which were created with white background in mind), they will produce a weird looking document (everything is black and all of a sudden there is a white image, which was supposed to blend with the document if the document background were white too - see example in the attached ODG).
3) Font colors are a problem too. If you start setting font colors with dark background in mind (using direct formatting) and then send the file to someone with a white background (which is still a majority), the recipient won't be able to read parts of the text formatted using direct formatting (I know that it's best to use styles, but most people still use direct formatting for basic things as setting font colors).
I created a sample Writer file (using a dark background) and added a few screenshots with it rendered in dark and light background to illustrate my point.
It should be noted that when using the Default character style, LO already switches font colors from black to white to respond to dark mode. However, the problem arises with direct formatting.
On the other hand, users programing in the Basic Editor will probably want to stick with a dark background when system theme is in dark mode, even while maintaining a white background for Writer documents.
Created attachment 171192 [details]
Writer Document created in a Dark Background
Created attachment 171193 [details]
Screenshots of the File in Dark and White document background
Sorry for the confusion with Math. But it's the same for Basic: you get the canvas in application background color. And besides the fact that a dark background as Kate has is bad IMHO, you can configure it and the question is why you need a special handling for Basic.
(In reply to Heiko Tietze from comment #11)
> Sorry for the confusion with Math. But it's the same for Basic: you get the
> canvas in application background color. And besides the fact that a dark
> background as Kate has is bad IMHO, you can configure it and the question is
> why you need a special handling for Basic.
The reason is because users may want, at the same time, to have a dark background in the Basic Editor while maintaining a white background for Writer/Calc documents.
In my previous message I used Writer examples to explain why Writer users might want to keep a white background even on a dark theme.
I myself do a lot of Basic programming and I would love to use dark background in the Basic editor, while keeping the white background in Writer/Calc.
[Automated Action] NeedInfo-To-Unconfirmed
Created attachment 171366 [details]
Screenshot with dark background
Topic was on the agenda for the design meeting but no further input.
Personally, I dislike dark input canvases (running dark system theme myself) and wouldn't add more UI options. But if we follow Adolfo's suggestion to obey the system theme, an option to revert to bright is desirable to me too. However, I'm not convinced that Basic is special just because the entered text has much more structure.
The background color is a simple easy hack in basctl/source/basicide/baside2b.cxx EditorWindow::EditorWindow() -> SetBackground(Wallpaper(GetSettings().GetStyleSettings().GetDialogColor()));
(the additional option makes it a bit more tricky.
The dark background requires brighter font colors. So in addition we need another preset in Tools > Options > Colors like "LibreOffice Dark" (there are many tickets on this) and now something like "LibreOffice Basic Dark" too.
Created attachment 171617 [details]
Basic Editor Colors
Heiko, you'll find in the attached file a suggestion of colors to be used in the Basic Editor in dark mode (screenshot and details in the ODG file)
Reserved Expression: b4c7dc
These suggestions are based in the hardcoded document background color "333333" used the the proposed patch.
Created attachment 171635 [details]
Really these colors?
(In reply to Heiko Tietze from comment #16)
> Really these colors?
Hi Heiko... Yes, these are the colors I suggested. But off course it's still up for debate.
Where do you think changes are necessary? I can come up with a different proposal.
Heiko Tietze committed a patch related to this issue.
It has been pushed to "master":
Resolves tdf#141986, related tdf#141566 - Dark theme
It will be available in 7.2.0.
The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
Affected users are encouraged to test the fix and report feedback.
Verified that the code editor panel in the Basic IDE now can easily be set to use a "dark theme" by changing the LO Application Colors scheme to "LibreOffice Dark". The background uses the "Document background" colour, in the "General" section.
Noting that it is not a fix for automatically following the OS dark theme, but the discussion here made it clear that this is out of scope for the part of the application where the user edits the file.
Also noting that Rafael's concern about changing the Basic IDE's background colour independently from the document background in other applications hasn't been resolved. I agree that, the Basic IDE being a code editor (i.e. not usually printed) and not a "document" editor (i.e. commonly printed), it would make sense to be able to set that colour to something dark (very common in IDEs) while keeping Writer, Calc, Impress and Draw with a white background.
Should an easy hack be opened to expose a new Basic background option in the Application Colors dialog, with the pointers Heiko offered in Comment 14?
Version: 184.108.40.206 / LibreOffice Community
Build ID: 614be4f5c67816389257027dc5e56c801a547089
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US