I'm trying to register custom SVG icons to use as Material icons, specifically national flags.
In Angular I would use MatIconRegistry.addSvgIcon(..) in conjunction with DomSanitizer.
In AngularDart I've found DomSanitizationService, but so far I'm unable to find the equivalent of MatIconRegistry.
We use a mix-in if you want to override any material-icons in an angular_component here: https://github.com/dart-lang/angular_components/blob/7f254c89cbbd512cc284a7e9d03bb687f9948bd9/angular_components/lib/material_icon/_mixins.scss#L51
If you are just working with icons separately and it isn't overriding one that is already included. I suggest just working with the SVG itself outside of material-icon.
Related
I'm trying to implement microfrontend with Vaadin 14. I've managed to accomplish a working version thanks to the Vaadin official documentation and various examples on github, using WebComponentExporter. However I cannot find any information about using css in these exported webcomponents. I've tried putting #CssImport everywhere, with no success.
I'm pretty much in the same situation as Stuart in this unanswered Vaadin forum question: https://vaadin.com/forum/thread/18466808/cssimport-when-using-component-exporter
Since that forum is now read only, I'm hoping to find a solution here.
Try follow this tutorial https://vaadin.com/docs/v14/flow/integrations/embedding/tutorial-webcomponent-theming:
Add #Theme annotation on top of your exporter class:
#Theme(themeFolder = "my-theme")
public class MyComponentExporter extends WebComponentExporter<MyComponent> {
// ...
}
Add styles.css to your ${project.root}/frontend/themes/my-theme/ and put there your styles which will apply to your component shadow DOM (to target the document DOM, place your styles in document.css), like this:
:host {
// MyComponent's background color to blue
background-color: blue;
}
I tested it with V14 + Vaadin Portlet + Liferay 7.3 and it works in both production and dev modes. Vaadin Portlets are based on embedded components, so it should work also for regular servlet-based Vaadin applications.
Try to compile with the production profile. The microfrontends examples do not comment on it but if you are not with the production profile they do not work, at least in my case.
Check that the webpack.config.js file is not filtering the css files.
Check that the css files are in the correct frontend folder.
I am new to angular and wanted to change the angular material themes dyamically ,I know how to make differnt themes that is by making scss file ,define 3 colors, include mat properties and functions, but then I was adding that file refrence statically in angular.json, but if I have many custom angular material themes I want to refrence the css files dynamalically.
So is there any easy quick and rather optimized way to do that?
P.S I have gone through many post and docs but seems to be confusing in order when it comes to change the theme dyamically like for example if I have toggle then how to refrence the different style rather than the default one?
Any answer would be higly appreciated..!!
One solution is to build the material color palette in real time. These are the necessary steps:
Define the color palette in CSS variables and then access them.
Assign these variables to the material angular theme.
Using the "tinycolor" library we create a service to generate the
palette based on a color.
With JavaScript we update the CSS variables in the DOM.
Here you have an example:
https://stackblitz.com/edit/angular-material-theming-playground
I am using XF.Material library for my Xamarin Forms project, as per the instructions I have created Material Resources in App.xaml and passed configuration name as a parameter to the initializer. bur for some reason I do not see any application-specific style (Colors and Fonts) instead it is using Material style (Purple color).
I have also tried creating MaterialConfiguration instance in the code-behind and assigned it to the initializer but still, it is not taking any custom style.
Yes, I have added the plist entry as per the instructions.....
What am I missing any idea???
UPDATE:
I have tried adding dynamic configuration like below but snackbar did not take it!!
Each material component example is wrapped in a card e.g:
How can i replicate this wrapper? Is the style is custom made for the site is or is easy reproducible using Angular Material?
The Angular material website is open source, so you can have a look at it for yourself.
Specifically, the component you are looking for is this one.
I have a question. When i am creating an application in rhomobile jquery.mobile.structure-1.0.css present inside /public/jqmobile. My question
1) What is the use of jquery.mobile.structure-1.0.css
2) jquery.mobile.structure-1.0.css was not included anywhere (in layout.erb) the application. Then why jquery.mobile.structure-1.0.css is present. I try to find the use of jquery.mobile.structure-1.0.css but not getting good result. Any one can explain?
The structure CSS is used to make a completely custom theme, where you do not want to rely on any of the default themes that come with jQuery Mobile. It's a very basic bare bones stylesheet. You can use it in place of the main jQuery Mobile stylesheet, then you create your own stylesheet to override and customize.
Personally I seperate the structure css out so I can make changes to my themes without causing any major issues to the new theme.css architecture. Makes it a bit easier to make upgrades as new versions come out. Though it is a little tricky to verify that there are no new additions to the themes. I wouldn't use overrides on the base themes a,b,c,d, - I find it's better to build your own themes using those as bases, e,f,g, etc...