npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

angular-ui-flag

v1.0.3

Published

Angular directive to display world flags

Readme

angular-ui-flag

Angular directive to draw SVG flags.

Demo available on GitHub.io

Installation

  • Install via npm
npm install angular-ui-flag
  • Include the <script/> tag somewhere in your header:
<script src="/node_modules/angular-ui-flag/angular-ui-flag.js"></script>
  • Add the module to your Angular app module list:
var app = angular.module('app', [
	'angular-ui-flag',
]);
  • Add the <ui-flag/> directive somewhere in your views:
<ui-flag style="flagStyle"></ui-flag>

See the demo app for more usage examples.

Configuration

The <ui-flag/> HTML element takes a single property: style which is a nested object of the properties in the below table.

| Property Path | Type | Description | |---------------------|--------|----------------------------------------------------------| | frame | Object | The main SVG element properties | | frame.height | Number | The height of the SVG element | | frame.width | Number | The width of the SVG element | | background | Object | Background layer properties | | background.svg | String | URL path to the SVG element to use for the background | | background.color1 | String | CSS color code (alpha is ok) to use for the first color | | background.color2 | String | CSS color code (alpha is ok) to use for the second color | | background.color3 | String | CSS color code (alpha is ok) to use for the third color | | foreground.svg | String | URL path to the SVG element to use for the foreground | | foreground.color1 | String | CSS color code (alpha is ok) to use for the first color | | foreground.color2 | String | CSS color code (alpha is ok) to use for the second color | | foreground.color3 | String | CSS color code (alpha is ok) to use for the third color | | feature.svg | String | URL path to the SVG element to use for the feature | | feature.color1 | String | CSS color code (alpha is ok) to use for the first color | | feature.color2 | String | CSS color code (alpha is ok) to use for the second color | | feature.color3 | String | CSS color code (alpha is ok) to use for the third color |

Flag concepts

This module splits a flag into three different layers, each of which can contain up to 3 colors:

  1. Background - The primary flag background. This should also contain an element with the feature ID to dictate where the feature will be placed
  2. Foreground - An overlay over the background layer
  3. Feature - A sprite style image placed in the absolute foreground. The location of this is determined by the background layer

Making new flag components

If you have an idea for any of the above three aspects of a flag please submit a pull request.

NOTES:

  • All component should have a corresponding entry in the /svg/{bg,fg,ft}/index.json file indicating its title and how many colors its supports
  • Any component can have 0 - 3 colors. These must be set to #FF0000, #00FF00 and #0000FF for the first to third color respectively
  • Every background component (anything in /svg/bg) needs to have at least one <rect/> or <path/> element which has the ID feature
  • Transparency is ok for the foreground and feature components