If you click this link it takes you to a few examples on their page.
https://ng.ant.design/components/button/en
I am able to access the buttons and change the color but not the actual blue border. I have tried :active, :hover, :focus, etc..
This is how I access the button for some custom css
.ant-btn-circle {
background-color: $theme-foreground !important;
color: rgb(var(--MainColor)) !important;
}
.ant-btn-circle:focus {
background-color: rgb(var(--MainColor)) !important;
color: $theme-foreground !important;
outline: 0 !important;
}
The outline portion doesn't seem to work... Any tips?
I see something like this that has the blue color but I dont know what it is. --antd-wave-shadow-color
html {
font-family: sans-serif;
line-height: 1.15;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-ms-overflow-style: scrollbar;
--antd-wave-shadow-color: #1890ff;
}
Only solution I found so far is creating a theme.less file in your src and adding this:
#import "../node_modules/ng-zorro-antd/ng-zorro-antd.less";
#primary-color: #6D6E70;
So I guess it is the primary color. Would be nice to set it custom. In the css.
I managed to resolve this by setting the transition period for the button's border-color property to 0ms.
So using your example:
.ant-btn-circle {
transition: border-color 0ms;
}
I was working for iOS 13 with Xcode 11 beta. Is there any way to support dark mode on web views? I have created a color set for all the other views except WKWebviews. How to change web view background and text color for dark mode?
Assuming your question is asking how to change the colors of the HTML content you are displaying in a WKWebView based on whether light or dark mode is in effect, there is nothing you do in your app's code. All changes need to be in the CSS being used by your HTML content.
I have some local HTML files I use in a WKWebView. I was able to support dark mode by updating my css file.
Let's say you currently have a css file with the following:
body {
background-color: white;
color: black;
}
a:link {
color: #0078b5;
text-decoration: none;
}
Those are fine in light mode. To also support dark mode, you can add an #media section to your css:
#media (prefers-color-scheme: dark) {
body {
background-color: rgb(38,38,41);
color: white;
}
a:link {
color: #0096e2;
}
a:visited {
color: #9d57df;
}
}
When in dark mode, the colors in this #media section will override the corresponding colors defined outside the #media section.
Swift 5
For WKWebView, below code worked for me.
extension RichTextController : WKNavigationDelegate {
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
let cssString = "#media (prefers-color-scheme: dark) {body {color: white;}a:link {color: #0096e2;}a:visited {color: #9d57df;}}"
let jsString = "var style = document.createElement('style'); style.innerHTML = '\(cssString)'; document.head.appendChild(style);"
webView.evaluateJavaScript(jsString, completionHandler: nil)
}
}
More simple, just invert all colors & style except for images :
#media (prefers-color-scheme: dark) {
html{
filter: invert(1) hue-rotate(.5turn);
}
img {
filter: invert(1) hue-rotate(.5turn);
}
}
Same challenge I faced when I was migrating my iOS app because we do login using WKWebView and when I consulted I found below example to handle this situation. Just need to create variable for the color and need to handle this in CSS.
Before
body { color: black; }
h1 { color: white; }
.header {
background-color: #FFFFFF;
color: white;
}
After
:root {
color-scheme: light dark;
--h1-color: #333;
--header-bg-clr: #FFF1FF;
--header-txt-clr: white;
}
#media (prefers-color-scheme: dark) {
:root {
color-scheme: light dark;
--h1-color: #333;
--header-bg-clr: #FFF1FF;
--header-txt-clr: white;
}
}
body { }
h1 { color: var(--h1-color); }
.header {
background-color: var (--header-bg-clr);
color: var(--header-txt-clr);
}
After Integrating this change you can use Safari to test (First you need to enable the developer menu option in Sarafi, Preferences, Advanced). Open wen inspector (using Command + Options + I) and you will see this screen with the option to toggle light/dark mode.
NOTE Just to add little more information. You can also handle different images just like colors.
BEFORE
<img src="day.jpg">
AFTER
<picture>
<source srcset="light.jpg" media="(prefers-color-scheme: light)">
<img src="day.jpg">
</picture>
Root tag will invert all the components color except the table and images will be in negative form.
To perform perfect color invert check the below CSS file
#media (prefers-color-scheme: dark) {
/* root tag inverting all the components color except the table.*/
: root {
color-scheme: light dark;
filter: invert(100%);
-webkit-filter: invert(100%)
}
/*table tag needed for inverting table content.*/
table {
filter: invert(100%);
}
/* If We do color invert in : root , images will be color inverted and it will be in negative. If we invert again these negative images, it will be positive.*/
img {
filter: invert(100%);
}
}
In Qt Designer, I've set a default print/preview stylesheet in the Preferences, to match the stylesheet of the application that will contain my UIs. When previewing, all of the contained widgets are styled correctly, but my top-level form isn't. Why? And what can I do?
For example, using this stylesheet:
MyFormBase
{ background: black; color: white; }
QLabel
{ background: transparent; color: yellow; }
and a UI structure like
MyForm form (subclass of MyFormBase)
QLabel label
The label has yellow text, but it's displayed on Designer's default (grey) background.
When the Designer creates a preview, it constructs a plain QWidget as the top level window. So any style applied using the class name of the top-level form doesn't match.
Examination of Designer's internals shows that it applies a property to mark the top-level window; we can select using that to style the top-level form:
[_q_custom_style_disabled="true"], /* for preview in Designer */
MyFormBase
{ background: black; color: white; }
QLabel
{ background: transparent; color: yellow; }
Note that the _q_custom_style_disabled property is not a documented feature of Designer, so it may be subject to change without warning.
If you have many selectors that depend on top widget (e.g. if you have MyFormBase > QLabel), or if you're concerned about the hack above, you might want to apply a custom property:
[role~=Page"]
{ background: black; color: white; }
[role~=Page"] > QLabel
{ background: transparent; color: yellow; }
Obviously, you then have to remember to apply the property to the topmost widget on each of your forms!
I'm using checkbox of angular-material2. Currently the default color of checkbox is coming as purple color.
Looks like they have changed default color of checkbox from "primary" to accent.
Is there a way to get "primary"(green) color instead of purple without overriding css.
I tried giving color="primary" to but that didn't worked.
Code : <md-checkbox></md-checkbox>
Import statement:
import {MdCheckbox} from '#angular2-material/checkbox';
Plunker http://plnkr.co/edit/sFC0kfdzj7fxtUC3GXdr?p=preview
Based on feedback from comments, updated my answer by removing '::ng-deep', but please read comment by #colin-fox, and understand how this will behave in global styling and at component level, many thanks!
For Angular Material 7, works for outline color and inside filled in color
.mat-checkbox-checked.mat-accent .mat-checkbox-ripple .mat-ripple-element {
opacity: 0.03 !important;
background-color: #005691!important;
}
.mat-checkbox-checked.mat-accent .mat-checkbox-background,.mat-checkbox-indeterminate.mat-accent .mat-checkbox-background {
background-color: #005691;
}
You don't have to add css if you'r using theme, just add attribute color to <mat-checkbox>
<mat-checkbox color="primary">Primary</mat-checkbox>
The color of a <mat-checkbox> can be changed by using the color property. By default, checkboxes use the theme's accent color. This can be changed to 'primary' or 'warn'
Checkbox | Angular Material
One of the standard ways to do this is to utilize the /deep/ selector
mat-checkbox {
color: rgb(0,178,0);
/deep/ .mat-checkbox-background {
background-color: rgb(0,178,0);
}
/deep/ &.mat-checkbox-focused{
.mat-ink-ripple{
background-color: rgba(0, 178, 0, .26);
}
}
}
That will allow you to override styles in components where Shadow Dom is enabled.
This solution works well for me
.mat-checkbox-ripple .mat-ripple-element,
.mat-checkbox-checked.mat-accent .mat-checkbox-background {
background-color: $your-color !important;
}
Default color depends upon the theme which you #import.
But angular material also provide way to customize the theme or for customizing the components like changing the color of checkbox.
Steps of doing this as follow :-
1.) Import the _theming.scss file
#import "../node_modules/#angular/material/theming";
2.) Specify the accent color i.e. color of check box you want to apply like below :-
// customising of the mat-checkbox accordiing Theme. i am using pink indigo theme
bydefault so here I am changing the checkbox color from pink to grey.
$candy-app-primary: mat-palette($mat-indigo);
// here I am specify the grey instead of Pink.
$candy-app-accent: mat-palette($mat-grey, 600, 500, 900);
$candy-app-warn: mat-palette($mat-red);
// Create the theme object (a Sass map containing all of the palettes).
$candy-app-theme: mat-light-theme($candy-app-primary, $candy-app-accent, $candy-app-warn);
// here I am only calling checkbox mixin because i only want to change the checkbox color
#include mat-checkbox-theme($candy-app-theme);
Hope it will help.
Angular 7+
This will work for checkbox as well as the initial ripple color. If you just change the background for the checkbox, the initial ripple color won't update. This resolves the issue.
SCSS:
::ng-deep .mat-checkbox-checked.mat-accent {
.mat-checkbox-ripple .mat-ripple-element {
background-color: $your-color !important;
}
.mat-checkbox-background, .mat-checkbox-indeterminate.mat-accent .mat-checkbox-background {
background-color: $your-color;
}
}
::ng-deep .mat-checkbox.mat-accent {
.mat-checkbox-ripple .mat-ripple-element {
background-color: $your-color !important;
}
}
A combination of answers worked for me in angular 9
.mat-checkbox-checked.mat-accent .mat-checkbox-ripple .mat-ripple-element {
opacity: 0.03 !important;
background-color: #005691 !important;
}
.mat-checkbox-checked.mat-accent .mat-checkbox-background,
.mat-checkbox-indeterminate.mat-accent .mat-checkbox-background {
background-color: #005691 !important;
}
.mat-checkbox-ripple .mat-ripple-element,
.mat-checkbox-checked.mat-accent .mat-checkbox-background {
background-color: #005691 !important;
}
With beta.2 of Angular Material, the color attribute should work.
There were some issues with it before beta.2
See the commit that fixed that issue.
There are two methods(that i know ) to change the background color of mat-checkbox (angular 9)-
method 1 - by using color property of the mat-checkbox .
<mat-checkbox
id="{{ subtask.name }}"
[color]="accent"
>
Check
</mat-checkbox>
Limitation - You can only use color according to the angular material theme by this method .
method 2 - If you want to give custom colors to the mat-checkbox first track down the classes till the target class you want to change color of. tracking of nested classes
after that write like this in your style.css(global) file-
1st checkbox
.l0
.mat-checkbox-checked
.mat-checkbox-layout
.mat-checkbox-inner-container
.mat-checkbox-background {
background-color: #ffbf00 !important;
}
2nd checkbox
.l1
.mat-checkbox-checked
.mat-checkbox-layout
.mat-checkbox-inner-container
.mat-checkbox-background {
background-color: #4caf50 !important;
}
Result - different color for different mat-checkbox
This should take care of the default checkbox color
md-checkbox .md-icon {
background: green;
}
md-checkbox.md-default-theme.md-checked .md-icon {
background: green;
}
read more here at Angular Material Documentation
The following will keep frame grey when unchecked but change to custom color when checked:
relevant-scss-file.scss
mat-checkbox {
&.mat-checkbox-disabled.mat-checkbox-checked .mat-checkbox-background {
background: rgb(0,178,0);
}
}
Since deep is deprecated. In my view the right way to do it is using encapsulation: ViewEncapsulation.None.
ex:
#Component({
selector: '...',
templateUrl: '...',
styleUrls: ['...'],
encapsulation: ViewEncapsulation.None,
})
Then you just need to change the class
.mat-checkbox-background {
background-color: green;
}
You just need to be careful to deal with global css stuff. In SASS nested classes should handle it properly.
You can have more details here: https://stackoverflow.com/a/54672579/783364
For me what has worked is the following:
<mat-checkbox class="tn-checkbox">Check me!</mat-checkbox>
In the css (or in my case sass):
.#{$wf__ns}checkbox {
.mat-checkbox-ripple {
.mat-ripple-element {
background: $cool-blue !important;
}
}
&.mat-checkbox-checked {
.mat-checkbox-background {
background: $cool-blue;
}
.mat-checkbox-ripple {
.mat-ripple-element {
background: $cool-blue !important;
}
}
}
}
Explanation:
The checked background color is changed to mat-checkbox-background within mat-checkbox-checked. IF you want to modify the background color when it is not checked just copy that part and copy it outside of mat-checkbox-checked.
As for the ripple classes, it turns out that the material has an animation when you press the button. That class controls the color of the animation, if you don't change it it will remain the same (pink).
If you do not change it by pressing the checkbox you will see a strange pink effect.
The other answers do not work for me although I rely on the first to develop it.
It may be from my version of angular that I leave below:
Angular CLI: 8.3.25
Node: 13.3.0
Angular: 8.2.14
You can change the color of the border this way.(angular)
::ng-deep .mat-checkbox {
.mat-checkbox-ripple .mat-ripple-element {
background-color: #07abe9 !important;
}
.mat-checkbox-frame {
border-color: #07abe9 !important;
}
}
This worked for me with Angular 10:
In your styles.scss:
//Change background color
.mat-checkbox-checked.mat-accent .mat-checkbox-background,
.mat-checkbox-indeterminate.mat-accent .mat-checkbox-background {
background-color: #1f45cc;
}
//Change the border color for both checked and unchecked cases
.mat-checkbox-frame {
border-color: #1f45cc;
}
.mat-checkbox-ripple .mat-ripple-element,.mat-checkbox-checked.mat-accent .mat-checkbox-background {
background-color: $your-color!important;
}
.mat-checkbox-checked.mat-primary .mat-checkbox-background, .mat-checkbox-indeterminate.mat-primary .mat-checkbox-background{
background-color: $your-color!important;
}
This is what works. On our JHIPSTER project, we have a global.scss. Here is what you need to do if you do have a global.
Wrap your component html with a class. Forexample:
<div class="supplier-details-container">
<!-- rest of your html here -->
</div>
In the global.scss or global.css write your css/scss like so (Im using red to test):
.supplier-details-container .mat-checkbox-ripple .mat-ripple-element,.mat-checkbox-checked.mat-accent .mat-checkbox-background {
background-color: red !important;
}
Basically using css hierarchy wrapping the native angular material css with your component class that you use to wrap your component html.
Let me know if it works or not. We can debug.
Update for Angular Material 15:
.mat-mdc-checkbox.mat-mdc-checkbox-checked .mdc-checkbox__background, .mdc-checkbox__ripple {
background-color: green !important;
border-color: green !important;
}
this solution works well for me
/deep/.mat-checkbox-checked.mat-accent .mat-checkbox-background, .mat-checkbox-indeterminate.mat-accent .mat-checkbox-background {
background-color: #3490d3;
}
Pixate seems to be unable to style UISearchBar's UITextField. Neither the text, corner radius etc. is styled, no matter how broadly I select text-field.
Also, there is an annoying dark hairline at the top and bottom of the UISearchBar as soon as I try to style it (e.g. give it a background color) using Pixate.
Furthermore, the cancel button label suddenly has white text and I found no way to overwrite it to any other color.
So the question is: Am I missing something or does Pixate in fact not support this (yet)?
What I want it to look like:
What it looks like using Pixate.
The stylesheet:
table-view {
separator-style: single-line;
separator-color: #eeeeee;
background-color: #eeeeee;
}
table-view-cell {
background-color: white;
}
search-bar {
background-color: #eeeeee;
}
Treat it like you would a normal CSS selector.
search-bar button {
color: white;
}