Skip to content
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

Make it possible to ColorDefinitions from CSS theme also in preference CSS nodes #93

Open
gayanper opened this issue Jun 5, 2022 · 6 comments

Comments

@gayanper
Copy link
Contributor

gayanper commented Jun 5, 2022

Add support to resolve Color and Font definitions in the following PreferenceHandler

UseCase

When defining new themes, we can define template preferences in a more core theme, which can be extended by importing those theme templates and providing color and font definitions. Today this can only be done at SWT widget styling. Adding this to preference we can improve the support. This will enable us to define more of a predefined theme configuration like in vscode.

@gayanper
Copy link
Contributor Author

gayanper commented Jun 5, 2022

@vogella @mickaelistria WDYT, If you think its good I can start work on it.

@vogella
Copy link
Contributor

vogella commented Jun 13, 2022

@gayanper sorry, I'm not sure what is missing here. You could define colors and fonts via the colors and fonts extension point and style them via CSS. What is the intended change here?

@gayanper
Copy link
Contributor Author

@gayanper sorry, I'm not sure what is missing here. You could define colors and fonts via the colors and fonts extension point and style them via CSS. What is the intended change here?

We can only use color and font definitions in css style blocks. The suggestion is to add support for preferences blocks as well. Today preference blocks are parsed as it is. Allowing it to be parameterize using color and font definitions will enable us to have these sections as templates in their respective plugins and redefine the color and fonts in theme plugins, at least thats my intension here. Got this idea from vscode theming.

@vogella
Copy link
Contributor

vogella commented Jun 14, 2022

@gayanper I still don't fully get your suggestion but feel free to send a PR to support it, I'm happy to help with the review. I may also final understand the proposal after I saw the code. :-)

@gayanper
Copy link
Contributor Author

Let try again. Lets take the vscode theme i shared few weeks back. Now when i defined it, i wanted the javadoc, source view popups to have the same background which is used for views like in vscode.

I used a color definition for this view background and use it for all swt styling. But javadoc seems to use the information background. Now i can of course override it as a preference in my stylesheet. But i have to duplicate the color as rgb value in the preference entry string.

But if we had the support to refer to the color definition then it would be simple to change this color value later so all referenced places will get effected in runtime.

@vogella
Copy link
Contributor

vogella commented Jun 14, 2022

Thanks @gayanper. I still think we already partially support this (at least in the IDE case), see e4-dark_ide_colorextensions.css in org.eclipse.ui.themes which is for example used in e4-dark_tabstyle.css

CTabFolder {
    /* Set the styles for the inner tabs: */
    color: '#org-eclipse-ui-workbench-INACTIVE_TAB_TEXT_COLOR';
    swt-tab-renderer: url('bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.CTabRendering');
    swt-tab-outline: '#org-eclipse-ui-workbench-ACTIVE_TAB_OUTLINE_COLOR'; /* border color for selected tab */
    swt-outer-keyline-color: '#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR'; /* border color for whole tabs container */
    swt-unselected-tabs-color: '#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START' '#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END' 100% 100%; /* title background for unselected tab */
    swt-selected-tab-fill: '#org-eclipse-ui-workbench-ACTIVE_TAB_BG_END'; /* title background for selected tab */
    swt-unselected-hot-tab-color-background: #161616; /* Bug 465711 */
    swt-selected-tab-highlight: none;
}

So what I think is missing and you are suggesting:

  • Make it possible to use these the above color constants also in preference CSS nodes to allow to reuse them

That is a great goal. It would also be great if we would replace all the color constants in our default files with color definitions so that we actually allow the user to change these.

@mickaelistria mickaelistria changed the title Add support for referring Color and Font definitions Make it possible to ColorDefinitions from CSS theme also in preference CSS nodes Jun 14, 2022
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

No branches or pull requests

2 participants