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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-display

v0.0.3

Published

A library to render Seven and Sixteen segments displays

Downloads

5

Readme

NgxDisplay

This library renders seven and sixteen segments displays according to the input parameters. Live Demo It exports four components:

  • SevenSegmentComponent <seven-segment>: Renders a seven segments display according to a bitmap, following the standard below:
  • SevenSegmentDigitComponent <seven-segment-digit>: Renders a digit in a seven segments display, according to the table below:

| digit | bitMask (decimal) | digit | bitMask (decimal) | | :------: | :-------: | :------: | :-------: | | 0 | 126 | j | 60 | | 1 | 48 | k | 47 |
| 2 | 109 | l | 14 |
| 3 | 121 | m | 21 |
| 4 | 51 | n | 118 |
| 5 | 91 | o | 29 |
| 6 | 95 | p | 103 |
| 7 | 112 | q | 115 |
| 8 | 127 | r | 5 |
| 9 | 123 | s | 91 |
| a | 119 | t | 15 |
| b | 31 | u | 62 |
| c | 78 | v | 62 |
| d | 61 | w | 28 |
| e | 79 | x | 55 |
| f | 71 | y | 59 |
| g | 95 | z | 109 |
| h | 55 | | 0 |
| i | 6 | - | 1 |

  • SixteenSegmentComponent <sixteen-segment>: Renders a sixteen segments display according to a bitmap, following the standard below:
  • SixteenSegmentDigitComponent <sixteen-segment-digit>: Renders a digit in a sixteen segments display, according to the table below:

| digit | bitMask (decimal) | digit | bitMask (decimal) | | :------: | :-------: | :------: | :-------: | | 0 | 75687 | W | 9780 |
| 1 | 38 | X | 17426 |
| 2 | 70541 | Y | 12716 |
| 3 | 65965 | Z | 66947 |
| 4 | 12332 | a | 7040 |
| 5 | 78225 | b | 15104 |
| 6 | 78761 | c | 4864 |
| 7 | 65573 | d | 2220 |
| 8 | 78765 | e | 5888 |
| 9 | 78253 | f | 38921 |
| A | 78381 | g | 112896 |
| B | 100781 | h | 14848 |
| C | 74625 | i | 2048 |
| D | 100773 | j | 35584 |
| E | 78721 | k | 34834 |
| F | 78337 | l | 8704 |
| G | 74665 | m | 6696 |
| H | 12844 | n | 6656 |
| I | 100737 | o | 6912 |
| J | 932 | p | 111104 |
| K | 12818 | q | 112640 |
| L | 9088 | r | 4608 |
| M | 25126 | s | 80128 |
| N | 25140 | t | 13056 |
| O | 74661 | u | 2816 |
| P | 78349 | v | 1536 |
| Q | 74677 | w | 1584 |
| R | 78365 | x | 17426 |
| S | 78249 | y | 32940 |
| T | 100353 | z | 5376 |
| U | 9124 | | 0 |
| V | 9730 | , | 1024 |
| . | 64 | - | 4104 | | " | 40960 | ||

Usage

First of all, import the NgxDisplayModule in your AppModule :

import { NgModule } from '@angular/core';
import { NgxDisplayModule } from 'NgxDisplayModule';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    ...,
    NgxDisplayModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Seven Segment

<seven-segment
    [randomNoise]="randomNoise"
    [width]="width"
    [height]="height"
    [glowColor]="glowColor"
    [glowBlur]="glowBlur"
    [backgroundColor]="backgroundColor"
    [colorOn]="colorOn"
    [colorOff]="colorOff"
    [bitMask]="bitMask"
></seven-segment>

Where:

  • randomNoise (boolean) = defines if there's or if there's not a random glow
  • width (number) = width of the display
  • height (number)= height of the display
  • glowColor (string) = string containing the color of the glow. Tested with be RGB, HEX, RGBA.
  • glowBlur (number) = length of glow's blur
  • backgroundColor (string) = string containing the display's background color. Tested with be RGB, HEX, RGBA.
  • colorOn (string) = string containing the color of display's segments when they are turned on. Tested with be RGB, HEX, RGBA.
  • colorOff (string) = string containing the color of display's segments when they are turned off. Tested with be RGB, HEX, RGBA.
  • bitMask (number) = bitMask representing the state of the display

Seven Segment Digit

Same as above, except instead of passing a bitmask you pass a character to be drawn in the display:

<seven-segment-digit
    [randomNoise]="randomNoise"
    [width]="width"
    [height]="height"
    [glowColor]="glowColor"
    [glowBlur]="glowBlur"
    [backgroundColor]="backgroundColor"
    [colorOn]="colorOn"
    [colorOff]="colorOff"
    [character]="character"
></seven-segment-digit>

Where:

  • randomNoise (boolean) = defines if there's or if there's not a random glow
  • width (number) = width of the display
  • height (number)= height of the display
  • glowColor (string) = string containing the color of the glow. Tested with be RGB, HEX, RGBA.
  • glowBlur (number) = length of glow's blur
  • backgroundColor (string) = string containing the display's background color. Tested with be RGB, HEX, RGBA.
  • colorOn (string) = string containing the color of display's segments when they are turned on. Tested with be RGB, HEX, RGBA.
  • colorOff (string) = string containing the color of display's segments when they are turned off. Tested with be RGB, HEX, RGBA.
  • character (string) = one of the characters below (it can be either lower case characters or upper case ones. They will be converted to lower case before rendering.):

|digit|digit|digit|digit| |:---:|:---:|:---:|:---:| | 0 | 1 | 2 | 3 | | 4 | 5 | 6 | 7 | | 8 | 9 | a | b | | c | d | e | f | | g | h | i | j | | k | l | m | n | | o | p | q | r | | s | t | u | v | | w | x | y | z | | <space> | - |

Sixteen Segment

<sixteen-segment
    [randomNoise]="randomNoise"
    [width]="width"
    [height]="height"
    [glowColor]="glowColor"
    [glowBlur]="glowBlur"
    [backgroundColor]="backgroundColor"
    [colorOn]="colorOn"
    [colorOff]="colorOff"
    [bitMask]="bitMask"
></sixteen-segment>

Where:

  • randomNoise (boolean) = defines if there's or if there's not a random glow
  • width (number) = width of the display
  • height (number)= height of the display
  • glowColor (string) = string containing the color of the glow. Tested with be RGB, HEX, RGBA.
  • glowBlur (number) = length of glow's blur
  • backgroundColor (string) = string containing the display's background color. Tested with be RGB, HEX, RGBA.
  • colorOn (string) = string containing the color of display's segments when they are turned on. Tested with be RGB, HEX, RGBA.
  • colorOff (string) = string containing the color of display's segments when they are turned off. Tested with be RGB, HEX, RGBA.
  • bitMask (number) = bitMask representing the state of the display

Sixteen Segment Digit

Same as above, except instead of passing a bitmask you pass a character to be drawn in the display:

<sixteen-segment-digit
    [randomNoise]="randomNoise"
    [width]="width"
    [height]="height"
    [glowColor]="glowColor"
    [glowBlur]="glowBlur"
    [backgroundColor]="backgroundColor"
    [colorOn]="colorOn"
    [colorOff]="colorOff"
    [character]="character"
></sixteen-segment-digit>

Where:

  • randomNoise (boolean) = defines if there's or if there's not a random glow
  • width (number) = width of the display
  • height (number)= height of the display
  • glowColor (string) = string containing the color of the glow. Tested with be RGB, HEX, RGBA.
  • glowBlur (number) = length of glow's blur
  • backgroundColor (string) = string containing the display's background color. Tested with be RGB, HEX, RGBA.
  • colorOn (string) = string containing the color of display's segments when they are turned on. Tested with be RGB, HEX, RGBA.
  • colorOff (string) = string containing the color of display's segments when they are turned off. Tested with be RGB, HEX, RGBA.
  • character (string) = one of the characters below:

|digit|digit|digit|digit|digit|digit|digit|digit| |:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | 8 | 9 | a | b | c | d | e | f | | g | h | i | j | k | l | m | n | | o | p | q | r | s | t | u | v | | w | x | y | z | A | B | C | D | | E | F | G | H | I | J | K | L | | M | N | O | P | Q | R | S | T | | U | V | W | X | Y | Z | <space> |,| |.| - | " |

Examples

Example 1: Seven Segment Display alphabet

app.component.html:

<seven-segment-digit 
    [height]="150" 
    [width]="108" 
    [randomNoise]="true" 
    [character]="'0'"  
    [glowBlur]="30" 
    [colorOn]="'#ffdd8f'" 
    [colorOff]="'rgba(255, 255, 255, 0.1)'" 
    [glowColor]="'#ff9a1f'" 
    [backgroundColor]="'#16161a'"
></seven-segment-digit>
<seven-segment-digit 
    [height]="150" 
    [width]="108" 
    [randomNoise]="true" 
    [character]="'1'"  
    [glowBlur]="30" 
    [colorOn]="'#ffdd8f'" 
    [colorOff]="'rgba(255, 255, 255, 0.1)'" 
    [glowColor]="'#ff9a1f'" 
    [backgroundColor]="'#16161a'"
></seven-segment-digit>
...
<seven-segment-digit 
    [height]="150" 
    [width]="108" 
    [randomNoise]="true" 
    [character]="' '"  
    [glowBlur]="30" 
    [colorOn]="'#ffdd8f'" 
    [colorOff]="'rgba(255, 255, 255, 0.1)'" 
    [glowColor]="'#ff9a1f'" 
    [backgroundColor]="'#16161a'"
></seven-segment-digit>

Result (some adicional css were added only for alignment and general background color):

Example 2: Sixteen Segment Display alphabet

app.component.html:

<sixteen-segment-digit 
    [height]="150" 
    [width]="108" 
    [randomNoise]="true" 
    [character]="'0'"  
    [glowBlur]="30" 
    [colorOn]="'#ffdd8f'" 
    [colorOff]="'rgba(255, 255, 255, 0.1)'" 
    [glowColor]="'#ff9a1f'" 
    [backgroundColor]="'#16161a'"
></sixteen-segment-digit>
<sixteen-segment-digit 
    [height]="150" 
    [width]="108" 
    [randomNoise]="true" 
    [character]="'1'"  
    [glowBlur]="30" 
    [colorOn]="'#ffdd8f'" 
    [colorOff]="'rgba(255, 255, 255, 0.1)'" 
    [glowColor]="'#ff9a1f'" 
    [backgroundColor]="'#16161a'"
></sixteen-segment-digit>
...
<sixteen-segment-digit 
    [height]="150" 
    [width]="108" 
    [randomNoise]="true" 
    [character]="' '"  [glowBlu
    r]="30" 
    [colorOn]="'#ffdd8f'" 
    [colorOff]="'rgba(255, 255, 255, 0.1)'" 
    [glowColor]="'#ff9a1f'" 
    [backgroundColor]="'#16161a'"
></sixteen-segment-digit>

Result (some adicional css were added only for alignment and general background color):