-
-
Notifications
You must be signed in to change notification settings - Fork 850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GUI: allow user CSS #2772
GUI: allow user CSS #2772
Conversation
- also move CSS elements for AstroCalc to the main CSS file
- may help under particular cisrcumstances - may also help creating ugly windows.
Great PR! Please pay attention to the following items before merging: Files matching
Files matching
This is an automatically generated QA checklist based on modified files |
What about compatibility guarantees? Is a stylesheet supposed to work correctly on a newer version of Stellarium that the one for which it was created? |
Until changing inner names and labels for UI elements - of course it will works |
That's the point: are tying our hands to provide backwards compatibility in the future? |
Stellarium could include a copy of the currently used CSS in each package. Users will have to take care of changes between versions. Of course, our CSS is evolving really veeery slowly, so chances are high that it remains compatible. But we should not give any guarantee or committment. |
Well, the style can be loaded as additional to the exists one (currently - replacement) and we changes inner names... very rare. So, probability of compatibility is very high, but we can't guarantee it. Obviously and probably on next step it can be 2 well-formed CSS files within Stellarium's resource file and selector of the theme in GUI (some dropdown list, like "Dark" (default), "Light", "Custom") to switch between CSS files. Of course it require restore styleChanged() infrastructure (notification/signal/slot) to apply the theme on-the-fly. |
Sure. It depends on what we want to allow or offer, GUI-wise. We could provide 3 differently toned settings, plus "custom..." with a file chooser. Who wants to do that? |
No, 2 differently toned settings + "custom..." - one settings we had have already. ;) Maybe @martinber can help us here? |
Hello, Sorry, this looks like too much for the time I can dedicate to this. If I'm not wrong, doing a light theme that looks consistent and nice is not easy since there are things that cannot be modified by CSS. One of them is the icons. We should provide a light version of them (and provide a way for the user to change this), or we should export the icons as SVG (but I dont trust that the SVG shadows/glows will work, so we should investigate if CSS/Qt drop shadows can be used instead) The other is there could be small things everywhere, I imagine things like for example text might become the same coloas the background in some cases, and that 'rendered' things will be hard (the world map location chooser, and maybe plots) |
Sure. "Default" is what we have now and prefer. Still, in the chooser, it is 1 of 3 presets.
|
Yes, fully understand.
Never tried that idea, sounds interesting.
There are things not yet defined in the CSS. As said, if users configure their GUI to death, it's not our fault... But surely SB will ask for documentation. Yes, me too. Given that this was developed mostly before 2010, we have none of this luxury. We could start with what I had originally in mind, just one user setting activated in scripting or command-line argument, and if SB provides a well-tuned dark or light theme, we could include that. Another idea is to allow only some changes. As I understand, CSS means you can override styles by just loading another. So, what happens if we fix some elements and just provide main entries for QWidgets and other major elements? OTOH this gets rapidly becomes a management nightmare. Better give one structure and let users do whatever they want. What I admit is that sometimes the bottom buttons are hard to see in the disabled state. The gray button background may have to become brighter, or we need some other means to increase contrast against the background. How could I use CSS to set that? |
But... |
It can become even darker, with mid-gray characters on dark-gray windows. ... But more users asked for a bright mode, yes. |
also - changed style from ancient QByteArray to directly applied QString - followed Qt's recommendation to replace Q_NULLPTR, Q_DECL_OVERRIDE
- also add default CSS to distribution package
Last commit message should have been SUG:... I think it's ready for a test or improvements by your own ideas. |
New daylight css files in the PR description. |
It’s maybe strange, but I think this feature may be added into version 1.1 as “hidden feature” (described in the SUG). Is it really need to copying CSS files? Maybe just add the links to files in the repository in the SUG? |
Hidden feature (like the fonts) is OK for me. The CSS files are small. It may be easier to have them installed, but if you want we can just place links into the SUG. OTOH, how can we guarantee that the CSS fitting to the installed version will be downloaded? |
Why we should guarantee it? If we put the link to files in |
OK, I see it as less user-friendly but we can restrict this for now to getting CSS files for the current version. What are the proper links? |
https://github.com/Stellarium/stellarium/blob/stellarium-stable/data/gui/normalStyle.css and https://github.com/Stellarium/stellarium/blob/stellarium-stable/data/gui/normalHtml.css P.S. In any way after installing the new version of Stellarium we cannot guarantee compatibility custom CSS from previous version. |
@alex-w any further changes, or is it OK for you? |
Hello @gzotti! Please check the fresh version (development snapshot) of Stellarium: |
Hello @gzotti! Please check the latest stable version of Stellarium: |
I tried this and it worked on Stellarium 0.23.2 (see also #3333). User dir: macOS: |
Description
This introduces a way to allow users to set a different CSS (style sheet) for GUI elements.
This can be used to make brighter GUIs for sunlit screens (which we always recommend to avoid), or dark mode/reversed text, or whatever color scheme people may have in mind.
The idea is to copy the defaultStyle.css, rename it and edit whatever users want to change. No, absolutely no guarantee can be given that a user-changed stylesheet will look usable or will work if items are missing/misspelled.
I do not intend to add an interactive CSS editor, color picker or other high-priced stuff. For now, this is to be an advanced feature for users willing to hack into CSS. A chapter in the SUG describes the usage. Another PR could provide light/extra-dark themes or interactive user configuration (CSS file selection in Config dialog etc.).
Fixes #678, #1624, #2763
Screenshots (if appropriate):
Type of change
How Has This Been Tested?
Test Configuration:
Copy either funkyStyle.css.txt or brightStyle.css.txt to your user directory.
Here are refined, finalized files for a "daylight mode":
daylight.css.txt
daylightHtml.css.txt
Remove .txt from the filename. Then in Stellarium, open the script console. Run this script:
core.setGuiStyle("daylight");
Changes will immediately take effect. GUI will appear brighter than usual. With the funkyStyle, you may puke. Sorry, this is a technical test.
This script line can be placed in the user's startup.css to set a customized default.
Alternatively, a command-line option
--gui-css style
can be used to launch with a customizedstyle.css
. This can also point to a file in a subfolder like--gui-css data/myFavorite
pointing todata/myFavorite.css
Checklist: