I want to style the ToolBar of our Eclipse application using CSS:
<extension id="product" point="org.eclipse.core.runtime.products">
<product application="org.acme.application" name="Application">
<!-- other stuff -->
<property name="cssTheme" value="ourtheme" />
</product>
</extension>
<extension point="org.eclipse.e4.ui.css.swt.theme">
<theme basestylesheeturi="branding/theme.css"
id="ourtheme"
label="Our Theme">
</extension>
Everything works (i.e. background-color: COLOR-WHITE makes the toolbar white). However I'm struggeling to find what CSS tags are allowed.
The Eclipse GIT Repo has a couple of CSS files, which have the following keys for the toolbar:
#org-eclipse-ui-main-toolbar {
background-image: url(./winXPOlive.png);
eclipse-perspective-keyline-color: #585858;
background-color: #515658 #515658 100%;
handle-image: none;
color: #EBE8E4;
}
Or that all of them? Is there a comprehensive manual somewhere? Or is CSS styling on a trial and error base?
(In case a specific use case is required: I want to add padding to the tool-items, and / or a border of some sort.)
I don't know of a manual listing everything.
All the CSS properties are defined using the org.eclipse.e4.ui.css.core.propertyHandler extension point so using the Eclipse plugin search will show you all the definitions. The majority of these are in the org.eclipse.e4.ui.css.swt plugin with a few in other plugins.
Definitions look like:
<extension
point="org.eclipse.e4.ui.css.core.propertyHandler">
<handler
adapter="org.eclipse.e4.ui.css.swt.dom.ControlElement"
composite="true"
handler="org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyBackgroundSWTHandler">
<property-name
name="background">
</property-name>
<property-name
name="background-color">
</property-name>
<property-name
name="background-image">
</property-name>
</handler>
adapter is defined by the org.eclipse.e4.ui.css.core.elementProvider extension point, it is generally named to give a good idea of what the property applies to - any Control in this case.
You can also look at the handler class to see exactly how the properties are dealt with.
Related
I have a project with multiple layouts, I have added the CSS globally in nuxt.config.js file like this:
css: [
'#/assets/plugins/fontawesome-free/css/all.min.css',
'#/assets/plugins/ionicons/css/ionicons.min.css',
'#/assets/plugins/feather/feather.css',
'#/assets/css/style.css',
'#/assets/css/custom-style.css',
'#/assets/css/skins.css',
]
but I want for just 1 layout to remove all css imported because the file being served is a static HTML file with all the styles inline.
Is this possible in nuxt and if not, what is the best possible workaround?
You could add the css files in your layout in a normal style block and not in nuxt.config.js.
<style lang="scss">
#import ...;
</style>
Then you can use another layout without these css files.
Remove the scope from your style on the .vue file where you want to override the global style:
<style s̶c̶o̶p̶e̶d̶>
.ProseMirror p {
color: rgb(236, 10, 10);
}
</style>
I wonder too, if you would be better off creating new vue layout files in the layout folder and applying those styles to the pages you want to affect globally, instead of pulling the css through nuxt.config.js file. Then, on the specific page that you want to override the global style, just remove the scope as I mention above. Just a thought.
I am using vue-svg-loader to use my svg files as a component in Vue project. When I am rendering those svgs I am losing default css properties that are inside of the svg file. I can add those css properties inside of my component where I am rendering svg files, but that kind of violates the idea of reusable components since each svg file has its own property. Is there a way to inherit their css?
'''
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
viewBox="0 0 612 792" style="enable-background:new 0 0 612 792;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{fill:none;}
.st2{fill:#FFFFFF;stroke:#000000;stroke-width:2;stroke-miterlimit:10;stroke-dasharray:10;}
.st3{font-family:'ArialMT';}
.st4{font-size:32px;}
</style>
<font horiz-adv-x="2048">
'''
Likely what is happening is that all of your SVG files use the same class names (st0, st1, etc). They are overriding each other. You'll need to:
manually rename the classes in each file, so they use different names, or
That file looks like it came from Illustrator. Assuming they all did, then load the SVGs back into Illustrator, and re-export them. This time change which method AI uses to set the element styles. I don't have AI handy right now, but there will probably be three options (I don't recall exactly what they are called):
Internal CSS - what the file above is using
Style attributes - uses the style="..." attrinbute
Attributes - uses attributes like fill="#ff0000"
If you need to style the SVGs with CSS in your page, you'll probably want to use the last option. That's because style attributes have a higher priority than CSS, so you would need to use the CSS !important flag, which is not generally recommended.
I've found that the vue-svg-loader documentation is pretty thin, mainly because all its configuration is done via the svgo library. There are some clues in this FAQ, which shows you how to customise the svgo configuration in your webpack config.
So maybe you want something like this in your vue.config.js file:
module.exports = {
chainWebpack: (config) => {
const svgRule = config.module.rule('svg');
svgRule.uses.clear();
svgRule
.use('babel-loader')
.loader('babel-loader')
.end()
.use('vue-svg-loader')
.loader('vue-svg-loader')
.options({
svgo: {
plugins: [
addClassesToSVGElement: {
classNames: ["foo", "bar"],
}
],
},
});
},
};
Vue.js documentation for Scoped CSS mentions that
You can include both scoped and non-scoped styles in the same component
I built the example application for vue-router and used two single file components instead of the string templates of the example - the rendering is as expected.
I then tried to apply both scoped and non-scoped styles in the components. In the first one I have
<style scoped>
div {
color: white;
background-color: blue;
}
</style>
<style>
body {
background-color: green;
}
</style>
and the second one
<style scoped>
div {
color: white;
background-color: red;
}
</style>
<style>
body {
background-color: yellow;
}
</style>
The idea is to have the whole body background switch when choosing a specific route.
The scoped styles are OK - they change depending on the route.
The non-scoped ones do not (screenshots are from Chrome Dev Tools):
on initial application load (non routed yet) the background is white (which is OK - this is the default one and there is no route for /).
when choosing a route, the style for the body is applied correctly (say, green from the first component)
when switching routes and loading the second component the background changes to the new color, it looks like from Chrome Dev Tools that the current style for background-color is overwritten. All the other components elements are correctly rendered (content and scoped styling)
further switches keep the same background (and again, other elements of the relevant component are rendered correctly). There are no changes in Chrome Dev Tools (the last view above is unchanged)
In other words, it looks like the style is stacked and previously overwritten properties are not updated Is this expected behaviour?
I opened a bug report for this and it ended up being expected behaviour. The summary from the report comments:
Thorsten Lünborg:
Yes, this is expected. Vue (or rather, webpack) does not insert and
remove these styles, as you seem to think. They are injected into the
head once the component renders, and never removed.
A common pattern is to extarct all CSS into a single .css file in
production, which would have the same result.
My summary in the context of the question:
initially (no route, no component rendered) nothing was injected
the first component is rendered on route switch, its style is injected
the second component is rendered on route switch, its style is injected and overwrites the previous style
further route switches do not inject anything as each component was already rendered once. The last style used therefore stays as the authoritative one.
I will therefore fallback on binding the body class to the current component's data
I have read a couple of tutorials online but most of the talk of iOS or some talk of Android but using old versions of react, everything has changed now.
If I open MainActivity.java there's only one method
#Override
protected String getMainComponentName() {
return "myapp";
}
which means I can't access the rootview and change its background color because it seems even the onCreate method isn't available to anyone nowadays.
I also tried opening res/styles and adding my lines there but I keep getting errors
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">#android:color/black</item>
</style>
I tried that but nothing changes, still the same grayish background appears.
Wish I could just do it in react but adding background there not only adds unnecessary overdraws, when loading there's this lag with one background then later changes to another, its very ugly.
In android/app/src/main/res/values/:
Create (or edit) colors.xml to add your background color, e.g.:
<resources>
<color name="background">#AB47BC</color>
</resources>
In styles.xml, add a theme customization item named android:windowBackground, referencing the chosen color name, e.g.:
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">#color/background</item>
</style>
</resources>
I created a library, it allows you to do it from the level of JavaScript, and also allows you to do dynamic changes.
https://github.com/johniak/react-native-root-view-background
import { setRootViewBackgroundColor } from 'react-native-root-view-background';
export default class Main extends Component {
componentDidMount(){
setRootViewBackgroundColor('#ccc');
}
}
The downside of this solution is that color is set after JS is loaded.
You need to implement React styling to change the background color.
I wanted to hide the user created search item. ie search > xxx_item. This item should be enabled only to user defined perspective. Below is the actionSet used for the same. Kindly provide me feasible solution.
<extension point="org.eclipse.ui.actionSets">
<actionSet
id="org.eclipse.search.searchActionSet1"
label="Search"
visible="true">
<menu
id="org.eclipse.search.menu"
label="Search"
path="navigate">
<groupMarker name="xxxGroup"/>
</menu>
<action id="com.xxx.udt.ui.MCPOpenFileSearchPage"
definitionId="com.xxx.udt.ui.MCPOpenFileSearchPage"
menubarPath="org.eclipse.search.menu/mcpGroup"
label="%action.MCPFileSearch"
icon="icons/full/search/MCPSearchDialog.png"
helpContextId="file_search_action_context"
class="com.xxx.udt.ui.MCPOpenFileSearchPage" >
</action>
</actionSet>
</extension>
Use the org.eclipse.ui.perspectiveExtensions extension point for this.
In your org.eclipse.ui.actionSets definition of the action set specify visible="false" to make the action set default to not being shown.
For example this is the Eclipse debug breakpoints action set:
<extension point="org.eclipse.ui.actionSets">
<actionSet
label="%BreakpointActionSet.label"
visible="false"
id="org.eclipse.debug.ui.breakpointActionSet">
Then specify the action set in the perspective extensions for the perspective you want to show the set in.
For example the debug break points action set is shown in the debug perspective using:
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.debug.ui.DebugPerspective">
<actionSet
id="org.eclipse.debug.ui.breakpointActionSet">
</actionSet>