Coder Social home page Coder Social logo

angular-themer's Introduction

AngularJS Theme Switcher

Features

  • Add option to select themes in your angular application
  • Configurable via app configuration.

Demo

Check out angular-themer in action at the demo page.

Installation

You can install angular-themer with:

bower install angular-themer

Alternatively you could download the src folder manually and include it in your project.

<html>
	<head>
	    <title>angular-themer demo</title>
    	<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.js"></script>
    	<script src="../src/themer.js"></script>
    	<!-- Include selected theme -->
    	<link themer-link>
	</head>
	<body>
		...
		<!-- include switcher element -->
    	<div themer-switcher></div>
		...
	</body>
	</head>
</html>

In your module, add themer dependency and configure.

angular.module('yourModule', ['angular-themer'])
	.config(['themerProvider', function (themerProvider) {
		var styles = [
			{ key: 'DARK', label: 'Dark Theme', href: 'dark.css'},
			{ key: 'LIGHT', label: 'Light Theme', href: ['light.css', 'fonts.css']}
		];
		themerProvider.setStyles(styles);
		themerProvider.setSelected(styles[0].key);
	}])
;

The href property can be either a string for a single css file or an array of strings for multiple css files.

Changelog

0.3.1

  • Bugfix: fix not working ng-repeat in theme options (#5)

0.3.0

  • Added ability to add a class to theme selector
  • BREAKING CHANGE: Any css which assumes the select will be a child element will probably break

0.2.6

  • Added support for multiple css files per style

0.2.2

  • Removed setSelected(); added setSelected(key) instead
  • Added key to each style
  • Added watchers to watch internal changes

0.2.1

  • First usable version
  • Configuration at bootstrap

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.