Git Product home page Git Product logo

dynamic-theming-demo's Introduction

Angular Dynamic Theming Demo

This project was generated with Angular CLI version 11.0.1.

Quick notes

This application creates the theme colors dynamically from a given configuration.

The configuration for this project has been defined in src/app/default-theme.ts. You can change the values there and play around with the colors.

In the AppModule we provide an APP_INITIALIZER DI Token, and load some theme configuration. We can load the theme from HTTP, storage, in-memory. We then set up the theme variables and attach them to the <html> tag of the application.

The variable set up is done in src/app/theming.service.ts.

We then use SCSS variables to capture these CSS variables and we use the variables everywhere we need to.

By defining primary/accent/warn colors, we also update the material design theme, and the material design color is generated dynamically.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

dynamic-theming-demo's People

Contributors

peshou avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.