I want to use CSS styling for some widgets in only one plugin of my application.
The Plugin's plugin.xml contains:
<extension
point="org.eclipse.e4.ui.css.swt.theme">
<theme
basestylesheeturi="css/default.css"
id="my.app.id.css"
label="Planning Theme">
</theme>
</extension>
The Plugin.xml's extension tab didn't suggest the extension point, but after I entered it in the file, I could see the properties. One of which is "basestylesheeturi" and it allows me to browse for the file. So the file definitely exists.
#charset "ISO-8859-1";
#MYTESTLABEL{
color: blue;
}
Text {
color: COLOR-CYAN;
background-color: COLOR-WIDGET-BACKGROUND;
}
Button {
font: Verdana 24px;
border-color: #EEEE00;
border-width: 2;
}
But it isn't used by Eclipse. When I start my Application, I cannot see any styles from the css file. Setting colors to black or fonts to huge sizes... nothing has an effect. Even Syntax Errors in the css file won't result in an error message.
What can I do to ensure my plugin uses this css file for Texts, Buttons, etc.?
Is my old Eclipse version maybe not supporting the extension point?
Version: Oxygen.3 Release (4.7.3)
EDIT
If I understand greg's answer correctly, I have to use both extension points (org.eclipse.core.runtime.product and org.eclipse.e4.ui.css.swt.theme). Additionally I added the css/default.css to the bin.includes section of the build.properties. The style is still not used.
There is a cssTheme already defined in another plugin.xml for the product by using those two extension points. From my understanding it should be possible to define a second theme only for a certain plugin.
It may be that I need to implement a ThemeSwitchHandler as vogella describes here but it's unclear how to make use of it (how and when to call it).
That extension point just defines a theme, it doesn't tell e4 to use it.
For a pure e4 RCP you specify the theme to be used in the cssTheme property of the org.eclipse.core.runtime.products extension point which defines your product:
<extension
id="product"
point="org.eclipse.core.runtime.products">
<product
name="%product.name"
application="org.eclipse.e4.ui.workbench.swt.E4Application">
<property
name="cssTheme"
value="my.app.id.css">
</property>
... other properties
If there is already a theme defined in the RCP you can contribute an extra stylesheet file to the theme. For example:
<extension
point="org.eclipse.e4.ui.css.swt.theme">
<stylesheet
uri="css/e4-dark_pde_prefstyle.css">
<themeid
refid="org.eclipse.e4.ui.css.theme.e4_dark">
</themeid>
</stylesheet>
</extension>
Which adds an extra file to the standard Eclipse org.eclipse.e4.ui.css.theme.e4_dark dark theme.
Related
Goal:
I have a specific clientlib ready with "critical CSS" that I would like to add to a page template in <style> tags, per Google's performance recommendations on a high-traffic e-Commerce site.
Problem:
We all know how to add a file reference in HTL:
<sly data-sly-use.clientlib="/libs/granite/sightly/templates/clientlib.html" data-sly-call="${clientlib.css # categories='template.noncritical'}"/>
but how would I output plain generated CSS styles on the page via HTL? Is there some other HTL property I could use?
I want this:
<style>
/* contents of AEM clientlib CSS here */
</style>
Tried:
I have Googled, searched StackOverflow, and looked in the AEM docs about clientlibs, but haven't found anything about inlining styles, except to
use a third-party script to inline critical CSS. (don't want to do)
modify HTML Library Manager OSGi configuration to inline all styles by default (don't want to do)
I am looking for something AEM-native that can be turned "on" or "off" in HTL. Thanks for reading and offering any solutions you may have.
You can try https://github.com/dmantsevich/aem-critical-css
It will generate CSS files and "integrate" with AEM. You can use it for extract small component CSS.
Some features:
CSS will be loaded only, if component presents on the page
Supports 2 injection types: <style /> and <link />
Supports less, css, scss.
CSS will be injected only once
Example:
MyComponentTemplate.html
<sly data-sly-use.aemCriticalCSS="${'./_aem-critical-css.js'}"
#aem-critical-css="my-component/my-component.scss">${aemCriticalCSS.inject # context="unsafe"}</sly>
Where my-component/my-component.scss is a path to css (related to ui.frontend/src/ folder). We used it on several projects and it helps to improve rendering performance. (path can be configured)
You can use the Core Components functionality https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/including-clientlibs.html?lang=en#inlining
<style type="text/css"
data-sly-use.clientlibs="${'com.adobe.cq.wcm.core.components.models.ClientLibraries' # categories='wknd.base'}">
${clientlibs.cssInline # context="unsafe"}
</style>
I started using Atom today. It's great, but I have a couple of issues:
Syntax Themes: I installed some syntax themes, but I found one cannot modify editor font colors, just style and size (from the main settings pane). Is there any workaround?
Markdown Preview: I was unable to find out how to change preview style.
I mean, markdown is rendered with arial fonts and a white background.
Is there any way to change this default behaviour?
You should be able to customize both in your user stylesheet. On Mac OS X, you can open this using Atom > Open Your Stylesheet, which will open the ~/.atom/styles.less file.
For the syntax themes: You can customize the colors in your styles.less file, simply take a look at the theme's source LESS file and then override the settings in your custom stylesheet. More details and an example can be found here.
Markdown Preview: The Markdown Preview package has an example on how to do that in your own styles.less file:
.markdown-preview.markdown-preview {
background-color: #444;
}
Take a look at the Markdown LESS files to see some of the styles you could override:
Default style: https://github.com/atom/markdown-preview/blob/master/styles%2Fmarkdown-preview-default.less
GitHub style: https://github.com/atom/markdown-preview/blob/master/styles%2Fmarkdown-preview-github.less
The markdown-preview-plus documentation now gives a different approach to styling the preview (even from the "snippet" provided in their README"):
To target Markdown-Preview-Plus rendering in general, you can do something like this in your stylesheet:
html[data-markdown-preview-plus-context] body {
/* styles that affect mpp preview */
}
Full details (especially on further "contexts") in the MPP docs.
I want to change the standard css style of the beaneditform but can't find the file (default.css) in eclipse or on my local computer?!
any ideas?
this folder assets is not existing in my workspace, where is this file default.css?
The file is located in the Tapestry Core JAR in the org.apache.tapestry5 package. Don't edit it, instead just override the values with your own CSS with a CSS selector that is at least equally specific.
This is also explained nicely in the CSS/Default Stylesheet section of the docs.
I have a top docked toolbar, and I used firebug to inspect the element to find the css class, which was:
.x-toolbar-dark.x-docked-top
{
border-bottom-color: #000000;
}
I changed this to:
.x-toolbar-dark.x-docked-top
{
border-bottom-color: #000000;
background-color: transparent !important;
}
Now I see the toolbar as transparent in Firefox, but in chrome it still has the default background color (blue). Why does this happen? Maybe I don't need to use this technique here, but there are definitely instances where I need to find a very specific css class using firebug. Any help or information?
Note: I tried using the Cls attribute of the toolbar with the same result.
In Chrome the background image (it's a gradient) works meanwhile in Firefox it is ignored.
So all you have to do is set the background-image and the background-color of .x-toolbar-dark like this:
.x-toolbar-dark{
background-image: none;
background-color: transparent;
}
http://jsfiddle.net/awHkT/1/
Sencha is for webkit browser, so it's CSS is made for webkit browsers like Chrome or Safari. So this kind or problem must be because there's a CSS rule with a -webkit prefix that is hence only applied on webkit browsers and ignored in firefox.
But anyway, toolbars have a gradient background, so if you want to override it you will need to do like so :
background-image: none;
background-color: transparent;
Two last thing
It's bad practice to override Sencha's CSS. Use the the cls config on you toolbar to assign it a CSS class and then use this class to style your toolbar.
Don't test you app with Firefox, but with Chrome of Safari.
Hope this helps
Can you creating a custom theme installing SASS and Compass. The instructions for installing SASS and Compass vary slightly for Mac and Windows users. Mac users will need to open the Terminal application and type the following:
i. sudo gem install haml
ii. sudo gem install compass
You will need to authenticate with your username and password to complete the install.
Windows users need to open the command line and type the following:
i. gem install haml
ii. gem install compass
Installing Ruby
Mac users get a break, since Ruby is already installed on OSX by default. Windows users should download the Ruby installer from rubyinstaller.org.
Once the installation is complete, we are ready to set up our folders and begin using SASS and Compass.
Creating your custom theme
The next thing you need to do is create your own theme SCSS file. Locate the sencha-touch.scss file in ../lib/resources/sass, and make a copy of the file. Rename the new copy of the file to myTheme.scss.
Now, you need to tell the index to look for your new theme. Using your previous example files, open your index.html file, and locate the line that says the following:
<link rel="stylesheet" href="lib/resources/css/sencha-touch.css" type="text/css">
Change the sencha-touch.css stylesheet reference in your index.html file to point to myTheme.css:
<link rel="stylesheet" href="lib/resources/css/myTheme.css" type="text/css">
SCSS and CSS
Notice that you are currently including a stylesheet from the css folder, called sencha-touch.css, and you have a matching file in the scss folder, called sencha-touch.scss. When the SCSS files are compiled, it creates a new file in your css folder. This new file will have a suffix of .css instead of .scss.
.scss is the file extension for SASS files. SCSS is short for Sassy CSS.
Now that you have your paths set up, let's take a look at the theme file copy we made. Open your myTheme.scss file. You should see the following:
#import 'sencha-touch/default/all';
#includesencha-panel;
#includesencha-buttons;
#includesencha-sheet;
#includesencha-picker;
#includesencha-tabs;
#includesencha-toolbar;
#includesencha-toolbar-forms;
#includesencha-carousel;
#includesencha-indexbar;
#includesencha-list;
#includesencha-list-paging;
#includesencha-list-pullrefresh;
#includesencha-layout;
#includesencha-form;
#includesencha-msgbox;
#includesencha-loading-spinner;
This code grabs all of the default Sencha Touch theme files and compiles them into a new CSS file located in the css folder. If you open up the sencha-touch.css file in the ../lib/resources/css folder, you will see the compressed CSS file you were previously using. This file is pretty huge, but it's all created from the basic commands.
The best part is that you can now change the entire color scheme of the application with a single line of code.
Base color
One of the key variables in the Sencha Touch theme is $base_color. This colour and its variations are used throughout the entire theme. To see what we mean, you change the colour of your theme adding the following to the top of your myTheme.scss file (above all the other text):
$base_color: #d1d3d4; //for example, color gray
Next, you need to re-compile the SASS file to create your stylesheet. From the command line, you need to change into the sass folder where your myTheme.scss file lives. Once you are in the folder, type the following into the command line and hit Enter:
compass compile
And have fun :), this will update your myTheme.css file with the new $base_color value. Reload the page in Safari or FF or anywhere, and you should see a new gray look to your application.
And look at this in http://www.netmagazine.com/tutorials/styling-user-interface-sencha-touch-application
I hope this helps. :)
How can I make Diazo to use theme's css file?
Whenever I replace something using (for example):
<replace css:theme="#footer" css:content="#portal-footer" />
It doesn't use the #footer style I defined in the theme's css file. Since I didn't enable Plone's css files either, it behaves as if there was no style at all. I found a workaround by renaming the style on my css file to match the one in Plone (i.e: renamed #footer to #portal-footer) but then what is the purpose of the theme's css file?
Thanks in advance.
The replace statement replaces the entire tag found by the theme selector with the tag found by the content selector, attributes too. So if you want to maintain the original class you will have to append/prepend/replace only the children of that tag:
<replace css:theme-children="#footer" css:content-children="#portal-footer" />
More info:
http://diazo.org/advanced.html