-
Notifications
You must be signed in to change notification settings - Fork 206
Provide Explicit "isDarkTheme" Attribute #2808
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
base: master
Are you sure you want to change the base?
Conversation
My main concern with such "api" is what happens with e.g. gray #808080 are they dark or light? What about some dark(-ish) "blue"? It becomes a very thin line to decide with such boolean. |
I think it's pretty common for themes to be either dark or light. At least all major operating systems also have this kind of primary boolean distinction. |
@sratz I agree that OSes(GTK I know has it for sure) have such boolean distinction and I am not against this addition, just raising some concern about theming in general (not only in Eclipse) for which no one found better solution yet. |
Test Results 1 823 files - 1 1 823 suites - 1 1h 27m 36s ⏱️ - 4m 16s For more details on these failures, see this check. Results for commit 257c857. ± Comparison against base commit 037c5d7. ♻️ This comment has been updated with latest results. |
bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/theme/ITheme.java
Outdated
Show resolved
Hide resolved
97bb557
to
b93d493
Compare
2b8766b
to
3030140
Compare
This pull request changes some projects for the first time in this development cycle.
An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch. Git patch
Further information are available in Common Build Issues - Missing version increments. |
fc95e93
to
ee88dfd
Compare
bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/Theme.java
Outdated
Show resolved
Hide resolved
dce1d99
to
1332d42
Compare
...rg.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/Theme.java
Outdated
Show resolved
Hide resolved
Up to now we had some heuristics to check if a theme is a dark theme. This now makes this explicit. - Add attribute to extension point - Fill this attribute for the platforms dark theme - Remove heuristics and now check this explicit flag - Add tests
I'm still torn about whether "isDark" should be further declarative. Could we instead try to get the default background color from the them, and resolve whether the background color is dark or not; using eg the usual formula to convert RGB to greyscale (0.3 * R + 0.59 * B + 0.11 * G) and evaluating whether this grey is dark (eg < 122) ? |
But that would replace one heuristic with another one. I think it's quite good to make this explicit. And keep in mind we don't have tons of themes in platform (and out there in the community). Adapting them should be easy. |
What should that be? Pls. explain based on the existing themes which color definition would be the "default background color". |
Is this really just an heuristic or is the greyscale value the actual definition of whether a theme is dark or not ? |
Probably something like |
To be honest I find this overcomplicated. For example we have code like this:
Do you really like to create a dummy invisible shell for each of the themes when the alternative is setting a little flag in the plugin.xml? And we don't have that many themes anyway. So I think the the cost / benefit relation is not very good for that. |
I agree with @BeckerWdf. Why implement a guessing algorithm when we can make it explicit? Other IDEs also have an explicit flag, e.g. VS Code: |
Up to now we had some heuristics to check if a theme is a dark theme. This now makes this explicit.
See also #2797 (comment)