Ngx-admin: Error on add new theme

Created on 29 Nov 2017  路  5Comments  路  Source: akveo/ngx-admin

I have an error to activate the dark theme from the example:

theme.scss:

// @nebular theming framework
@import '~@nebular/theme/styles/theming';
// @nebular out of the box themes
@import '~@nebular/theme/styles/themes';

// which themes you what to enable (empty to enable all)
$nb-enabled-themes: (default, cosmic);

$nb-themes: nb-register-theme((
 // app wise variables for each theme
  sidebar-header-gap: 2rem,
  sidebar-header-height: initial,
  layout-content-width: 1400px,

  font-main: Roboto,
  font-secondary: Exo,
), default, default);

$nb-themes: nb-register-theme((
  // app wise variables for each theme
  sidebar-header-gap: 2rem,
  sidebar-header-height: initial,
  layout-content-width: 1400px,

  font-main: Roboto,
  font-secondary: Exo,
), cosmic, cosmic);

// dark theme
$nb-themes: nb-register-theme((
  // app wise variables for each theme
  sidebar-header-gap: 2rem,
  sidebar-header-height: initial,
  layout-content-width: 1400px,

  font-main: Roboto,
  font-secondary: Exo,
  color-bg: black,
  color-fg: gray,
), dark, cosmic);

them_switcher line 46, to change the themes:
return theme ? 'cosmic' : 'dark';

Error:

ThemeSwitcherComponent.html:5 ERROR Error: NbThemeConfig: no theme 'dark' found registered.
    at NbJSThemesRegistry.webpackJsonp.../../../../@nebular/theme/services/js-themes-registry.service.js.NbJSThemesRegistry.get (js-themes-registry.service.js:68)
    at MapSubscriber.project (theme.service.js:71)
    at MapSubscriber.webpackJsonp.../../../../rxjs/_esm5/operators/map.js.MapSubscriber._next (map.js:79)
    at MapSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber.next (Subscriber.js:91)
    at RefCountSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._next (Subscriber.js:127)
    at RefCountSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber.next (Subscriber.js:91)
    at Subject.webpackJsonp.../../../../rxjs/_esm5/Subject.js.Subject.next (Subject.js:56)
    at ConnectableSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._next (Subscriber.js:127)
    at ConnectableSubscriber.webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber.next (Subscriber.js:91)
    at ReplaySubject.webpackJsonp.../../../../rxjs/_esm5/Subject.js.Subject.next (Subject.js:56)

Most helpful comment

ok found. under style was the them.dark.ts file missing and under module, i must load it. nothing in the documentation, sorry for this issues

All 5 comments

Read the Error Message - there is no Theme Named "dark"
maybe check scss files and theme module

on the last nb-register-theme is the name dark to register or not?

nb-register-theme?

I mean the "nb-enabled-themes" in the styles
Check these if there are set correctly

i follow this official guide, there only default and cosmic enabled...

https://akveo.github.io/nebular/#/docs/guides/enabling-theme-system

Edit:

// @nebular theming framework
@import '~@nebular/theme/styles/theming';
// @nebular out of the box themes
@import '~@nebular/theme/styles/themes';

// which themes you what to enable (empty to enable all)
$nb-enabled-themes: (default, cosmic, dark);

$nb-themes: nb-register-theme((
 // app wise variables for each theme
  sidebar-header-gap: 2rem,
  sidebar-header-height: initial,
  layout-content-width: 1400px,

  font-main: Roboto,
  font-secondary: Exo,
), default, default);

$nb-themes: nb-register-theme((
  // app wise variables for each theme
  sidebar-header-gap: 2rem,
  sidebar-header-height: initial,
  layout-content-width: 1400px,

  font-main: Roboto,
  font-secondary: Exo,
), cosmic, cosmic);

// dark theme
$nb-themes: nb-register-theme((
  // app wise variables for each theme
  sidebar-header-gap: 2rem,
  sidebar-header-height: initial,
  layout-content-width: 1400px,

  font-main: Roboto,
  font-secondary: Exo,
  color-bg: black,
  color-fg: gray,
), dark, cosmic);

Thanks, docu is wrong!

Edit2:
Error the same, but the first change works

ok found. under style was the them.dark.ts file missing and under module, i must load it. nothing in the documentation, sorry for this issues

Was this page helpful?
0 / 5 - 0 ratings

Related issues

argnist picture argnist  路  4Comments

pulfabio picture pulfabio  路  4Comments

lopn picture lopn  路  4Comments

queirozfcom picture queirozfcom  路  4Comments

burtonator picture burtonator  路  3Comments