Open Closed

Change LeptonX style to light or dark by code #5566


User avatar
0
justinlee0516 created
  • ABP Framework version: v7.2.3
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

ABP commercial has LeptonX theme as its default theme. There are 4 styles in LeptonX: Light, Dark, Dim, and System. My app has Angular UI. And the default theme style seems to be System - it changes to Light or Dark automatically when the OS settings change.

I cannot find any documentation on how to change this behavior. I want to fix the style to Light mode always in Angular UI.

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

7 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hi,

    Could you please try to change ConfigureTheme in YourProject.Host -> HttpApiHostModule.cs from System to Light

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    justinlee0516 created

    Thanks for your reply. But I am using Angular UI, and that does not work.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hi, I am also using Angular UI, it works at my end. Could you please check your solution explorer at backend it has solution ***.HttpAPI.Host at the end of list.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    mahmut.gundogdu created

    We will add easier way to define default theme. I have opened issue. But for a now. go to your app.module.ts

    import {LPX_THEMES,LPX_THEME_STYLES_DEFAULTS} from "@volosoft/ngx-lepton-x";
    
    const defaultThemes = [...LPX_THEME_STYLES_DEFAULTS].map((theme) => {
      const defaultTheme = theme.styleName  === "dim";
      return {...theme,defaultTheme}
    })
    
    
    // add this as proveder/
    
    {
        provide:LPX_THEMES,
        useValue: defaultThemes
    }
    

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    CI created

    Oi, I made this configuration, but my google browser is in dark mode and the abp is getting dark mode, there is also a way to force light?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    justinlee0516 created

    Hi, I am also using Angular UI, it works at my end. Could you please check your solution explorer at backend it has solution ***.HttpAPI.Host at the end of list.

    Yes. You should test in Chrome Incognito Window.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    justinlee0516 created

    Found the solution.

    -- app.component.cs --

    import { ThemeService, StyleNames, lightTheme } from '@volosoft/ngx-lepton-x';
    
    export class AppComponent {
      
      constructor(private themeService: ThemeService) {
        if (this.themeService.selectedStyle.styleName != StyleNames.Light) {
          this.themeService.setTheme(lightTheme);
        }
      }
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.