Angular Material 15 - How to change border color of a mat-mdc-form-field outline - angular-material-15

How do i change mat-form-field apearance outline underline color in Angular Material **Version 15 **
this post stackoverflow were great helpful but i could not change border color with this because we have not $border propertie on mat.define-typography-level( ) material.angular.io
<p>
<mat-form-field appearance="outline">
<mat-label>Outline form field</mat-label>
<input matInput placeholder="Placeholder">
<mat-icon matSuffix>sentiment_very_satisfied</mat-icon>
<mat-hint>Hint</mat-hint>
</mat-form-field>
</p>
I tried to overide border without success
mat-form-field{
background-color: #f3f6f9; // success
border:2px solid red; // it's add another border so not resolve
}

Related

Calculate triadic colors with Sass color functions?

Is there a way to calculate the two other triadic colors from a single color using the Sass's built-in sass:color module?
For example, if I have #0070f3 as my baseline color, I want to get #f30071 and #8200f3 (as found using Material's color picker tool).
Yes, you can, with adjust-hue passing your base color and a rotation value in degrees.
Triads can vary the rotation, your example gives a second color at 60deg and a third one at 120deg (I guess).
An example here.
HTML code:
<div class="block base"></div>
<div class="block base60"></div>
<div class="block base120"></div>
SASS code:
$base-color: #0070f3
.block
height: 100px
width: 100px
.base
background-color: $base-color
.base60
background-color: adjust-hue($base-color, 60deg)
.base120
background-color: adjust-hue($base-color, 120deg)

how to change the table footer color

for my model, I'm trying to change the color of the paging buttons at the bottom of the data table, but how is this implemented in vuetify. Is there a way to change the color of the buttons and background color of the footer?
<div id="app">
<v-app id="inspire">
<div>
<v-data-table
:headers="headers"
:items="desserts"
:page.sync="page"
:items-per-page=2
hide-default-footer
class="elevation-1"
#page-count="pageCount = $event"
></v-data-table>
<div class="text-center pt-2">
<v-pagination
v-model="page"
:length="pageCount"
></v-pagination>
</div>
</div>
</v-app>
</div>
To change the background of the v-pagination, add a color class to it:
<v-pagination
...
class="red"
/>
To change the color of the active page button, add the color prop to it:
<v-pagination
...
class="red"
color="green"
/>
To change the colors of the previous and next buttons, you may manually add style to the v-pagination__navigation and v-pagination__item classes since there are currently no available props to do it:
<v-pagination
...
class="red"
color="green my-pagination"
/>
.my-pagination {
/* For previous and next buttons */
& .v-pagination__navigation {
background: blue !important;
}
/* For page buttons except the active one */
& .v-pagination__item:not(.v-pagination__item--active) {
background: yellow !important;
}
}
Here's a sample demo at codesandbox:

Theme angular material pagenator background colour

Hi I'm trying to change the background of a mat-pagenator control in an angular project.
However it appears that the pagenator always appears white. Regardless of the background-color I set in the application.
styles.scss
#import '~#angular/material/theming';
#include mat-core();
$sample-material-app-primary: mat-palette($mat-indigo);
$sample-material-app-accent: mat-palette($mat-pink, A200, A100, A400);
$sample-material-app-warn: mat-palette($mat-red);
$sample-material-app-theme: mat-light-theme($sample-material-app-primary, $sample-material-app-accent, $sample-material-app-warn);
$background: map-get($sample-material-app-theme, background);
$background: map_merge($background, (background: #FF1010));
$theme: map_merge($sample-material-app-theme, (background: $background));
#include angular-material-theme($theme);
#include mat-paginator-theme($theme);
//Just so we can see a background color
html, body { height: 100%; background-color: bisque }
app.component.html
<mat-form-field>
List length:
<input matInput [(ngModel)]="length">
</mat-form-field>
<mat-form-field>
Page size:
<input matInput [(ngModel)]="pageSize">
</mat-form-field>
<mat-form-field>
Page size options:
<input matInput
[ngModel]="pageSizeOptions"
(ngModelChange)="setPageSizeOptions($event)">
</mat-form-field>
<mat-paginator [length]="length"
[pageSize]="pageSize"
[pageSizeOptions]="pageSizeOptions"
(page)="pageEvent = $event">
</mat-paginator>
<div *ngIf="pageEvent">
<h5>Page Change Event Properties</h5>
<div>List length: {{pageEvent.length}}</div>
<div>Page size: {{pageEvent.pageSize}}</div>
<div>Page index: {{pageEvent.pageIndex}}</div>
</div>
result:
the desired result is to set a color for the background of this component(and some others)
The way I'm trying to set the background is based on Angular Material2 theming - how to set app background?
It appears that <mat-paginator> inherits its background colour from card not from the background property.
The same seems to be true for <mat-table> so to set the default styles of these the following worked: (note this is an ugly colour just to prove the colour works)
#import '~#angular/material/theming';
#include mat-core();
$sample-material-app-primary: mat-palette($mat-indigo);
$sample-material-app-accent: mat-palette($mat-pink, A200, A100, A400);
$sample-material-app-warn: mat-palette($mat-red);
$sample-material-app-theme: mat-light-theme($sample-material-app-primary, $sample-material-app-accent, $sample-material-app-warn);
$background: map-get($sample-material-app-theme, background);
$bg-color: #FF1010;
$background: map_merge($background, (background: $bg-color, card: $bg-color, dialog:$bg-color));
$theme: map_merge($sample-material-app-theme, (background: $background));
#include angular-material-theme($theme);
#include mat-paginator-theme($theme);
//Just so we can see a background color
html, body { height: 100%; background-color: bisque }
Note I also added dialog into this as it was also set to white and its likely that it needs the same background colour.

How can I add an md-icon next to an input like in angular material 1?

How can I add md-icon elements next to inputs like in angular material 1 and this screenshot from google contacts:
Google contacts edit form
I know I can use mdPrefix but I like this style better.
Code example:
<md-input-container>
<md-icon mdPrefix>star</md-icon>
<input placeholder="Test" mdInput />
</md-input-container>
The icon inside the input field and I'd like it to be next to it:
Using some css tricks, I was able make something close to the the provided screenshot.
css to position icons:
/deep/ .mat-icon {
color: grey;
width: 24px;
margin: 20px 40px 0 0;
}
html:
<div style="display: flex">
<md-icon >email</md-icon>
<md-input-container >
<input mdInput placeholder="Email">
</md-input-container>
</div>
Code example

Is it possible to animate an object's location in html with Angular 2?

I've been experimenting with animation in Angular 2, and it's really useful for some things. However, I have a navagation menu, and I'd love to animate an object to slide up and down the list to highlight the users selection, something like material design's tabs, but vertical.
Here's my list:
<md-nav-list>
<md-list-item class="inverted nav-list-item" [routerLink]="['/home']">
<p class="mdl-navigation__link">Home</p>
</md-list-item>
<md-list-item class="inverted" [routerLink]="['/counter']">
<p class="mdl-navigation__link">Counter</p>
</md-list-item>
<md-list-item class="inverted" [routerLink]="['/fetch-data']">
<p class="mdl-navigation__link" >Fetch data</p>
</md-list-item>
<md-list-item class="inverted" [routerLink]="['/ship-info']">
<div style="width: 6px; height: 100%; background-color: orange; margin-right: 20px;"></div>
<p class="mdl-navigation__link" >Ship Info</p>
</md-list-item>
<md-list-item class="inverted" [routerLink]="['/data-analysis']">
<p class="mdl-navigation__link" >Data Analysis</p>
</md-list-item>
</md-nav-list>
Is it possible to animate the transition of the orange <div> to slide to a different list item with angular animations? Or am I stuck having the div outside the list, and trying to get the correct pixel position for an animation using TranslateY? The only information I can find in the documentation is on changing an object's properties (like background image), or it's absolute x,y location on the screen (say sliding in/out).

Resources