Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pretty-checkbox custom two colors #90

Open
mbagiella opened this issue Nov 23, 2020 · 0 comments
Open

pretty-checkbox custom two colors #90

mbagiella opened this issue Nov 23, 2020 · 0 comments

Comments

@mbagiella
Copy link

mbagiella commented Nov 23, 2020

Hi,
First of all, thank you for this usefull module.

I'm trying to customize the color to enable DarkMode and LightMode. (I'm using angular 11 with Angular Material)

My main css (style.scss) [not working]

`
@import '~pretty-checkbox/src/scss/variables';

$pretty--color-default:black;
$pretty--colors:(
primary: black
);

.light {
$pretty--color-default:white;
$pretty--colors:(
primary: white
);
}
`

How can I achieve this ?

EDIT:

I found how to achieve this but I'm pretty sure there is a more cleaner way to do it

`
$dark-primary: mat-palette($mat-grey, 900);
$light-primary: mat-palette($mat-grey, 100);
$warn: mat-palette($mat-red);

$dark-theme: mat-dark-theme($dark-primary, $light-primary, $warn);
$light-theme: mat-light-theme($light-primary, $dark-primary, $warn);

@mixin theme-color-grabber($dark-theme) {

.pretty input:checked ~ .state.p-primary-o label:before,
.pretty.p-toggle .state.p-primary-o label:before{
border-color: mat-color($primary);
}

.pretty.p-default:not(.p-fill) input:checked ~ .state.p-primary-o label:after {
background-color: mat-color($primary) !important;
}

.state {
label{
&:before {
border-color: mat-color($primary);
}
}
}
@include angular-material-theme($dark-theme);
@include theme-color-grabber($dark-theme);

.light {
@include angular-material-theme($light-theme);
@include theme-color-grabber($light-theme);
}
`

I'm not sure it was the best way to achieve this, tho :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant