akveo / akveo/nebular

Custom themes overrides default themes CSS variables within nb-install-component()

Ouverte
#2,253 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
8.1k
Forks
1.5k
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

### Issue type

**I'm submitting a ...** (check one with "x")

* [ X] bug report
* [ ] feature request

### Issue description

**Current behavior:**

I have a custom theme installed, I want to change a nb-icon color depending on theme selected.
The nb-install-component() SCSS function works as expected but it use the custom CSS variables of the custom theme on top, overriding other default theme variables (text-basic-color) (default, dark, cosmic).

When I pick the custom theme using NbThemeService and swipe back to a default theme it works as expected.

In resume it overrides CSS rules while you havent selected it (custom theme)

**Expected behavior:**

Custom themes variable values within nb-install-component() shouldnt override the other default themes

**Steps to reproduce:**

Install a custom theme

`$nb-themes: nb-register-theme((), custom-theme, dark);`

Register it on the module

`NbThemeModule.forRoot({name: 'custom-theme'})`

(I think the problem comes from the code above)

Use nb-install-component()

```
@import '../../../../../../../assets/styles/themes/themes.scss';

@include nb-install-component {
div {
border: 8px solid nb-theme(text-basic-color);
border-color: nb-theme(text-basic-color) transparent transparent transparent;
}
}
```
Now the custom theme will override the CSS variables registered placing theme on top.

Example:

Theme selected: Dark
the `

` will have the custom CSS `text-basic-color` instead of the dark one.

Once you change to the custom theme and swipe back to the dark theme, just on this case, CSS rules will work as expected

### Other information:
**npm, node, OS, Browser**

I know this is a weird bug hard to find, I have a feeling the problem comes when you register the custom theme on the NbThemeModule({ name: 'custom-theme' }), I think this makes the custom theme as default overriding other rules.

**Angular, Nebular**
Angular 8.x.x
Nebular 4.x.x

```

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.