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

repo-iconify

v1.0.0

Published

Superimpose a small textual tag on an image, useful for dynamic repo icon generation

Downloads

3

Readme

repo-iconify

A simple shell script that overlays text over an image, for use in creating unique logos for your VCS repositories.

Example

The easiest way to describe what this does is to show an example. This is the logo for this repository.

logo

It was generated with the following configuration, stored within a .repo-iconify file in the current directory.

InputFile=~/.face
Color=white
Background="#EF6C00"
Text=ICON
Direction=east
Suffix=" "
Offset=+0-70

This file can be summarized as follows:

  • The base image (input file) is my Linux profile picture, found in ~/.face
  • Text color is set to white
  • Background color is set to a hex value, which is a shade of orange
  • The actual text contents is the word "ICON"
  • Direction (location of text) is set to east (the right of the image)
  • After $Text, the suffix (a single space) is added for spacing
  • Offset is set to horizontal: 0px, vertical -70px. This has the effect of shifting the text up 70 pixels

Full Specification

Generate an icon by running repo-iconify in the current directory. To get a good looking one, you will want to specify preferences in a .repo-iconify configuration file. On runtime, repo-iconify traverses through the directory tree, and applies all configurations found within, prioritizing ones lower down (closer to the current directory).

Options

The following is a list of options than can be specified in a .repo-iconify file.

  • InputFile Path to image source
  • Color Color of text
  • Background Color of background
  • Outline Color of text outline
  • Text Text string, required nonempty
  • Prefix Prefix to text
  • Suffix Suffix to text
  • Point Text size, in pts
  • Stroke Outline weight, in pts (acts as text weight if outline color is same as text, as default)
  • Direction Text position, one of {north, south, east, west, northeast, ...}
  • Offset Offset from direction, horizontal then vertical concatenated. Example: -10+20 means left 10 pixels, down 20 pixels
  • OutputFile Path of image output, with file extension (proper file will be created, depending on extension given)

As a .repo-iconify file is simply a script that is executed, these options can be complex and reference each other, as well as other macros provided, like so:

Direction=east
Offset=+0-$((Height / 4))

The $(( ... )) operator is the Bash arithmetic operator, and thus we are shifting the text up 1/4th of the height of the full image, centering it on the north-northeast line.

Macros

The previous point brings up the subject of macros, which are procedurally generated variables you can use in your configuration files. These are:

  • Root=true Setting Root to true in a configuration sets the current directory as pthe root of the configuration tree, and prevents further traversal up the directory tree in search of higher configuration files
  • GenerateImageData Placing this line in a configuration file, provided that InputFile has already been defined in that file or in a higher file, and provided that that file exists, generates the following macros for your disposal:
    • Height Height of the image, in px
    • Width Width of the image, in px
    • MinDim Minimum dimension, the minimum of Height and Width
  • FullText This variable should not be declared in most cases, as it is generated by the program as the concatenation of Prefix, Text, and Suffix. However, if it is overwritten in a config, then Prefix, Text, and Suffix are ignored.

Defaults

In lieu of any modifications within a .repo-iconify, these are the default settings given. Note that this will not work, as Text is set empty, and thus the program will error out.

InputFile=~/.face
Color=white
Background=black
Outline=$Color
Text=""
Direction=east
Offset=+0+0
OutputFile=logo.png
Point=$((MinDim * 7 / 10 / 4))
Stroke=$((Point / 20))
FullText="$Prefix$Text$Suffix"

The Point field is set as the minimum dimension of image, multiplied by 0.7 (which is the approximate point/pixels ratio, 7.5 pt font being 10 px high), and then divided by 4, to make a quarter of the minimum dimension (which, if the minimum dimension is height, is equivalent to the quarter the height of the image).

The Stroke is set to 1/20th of the Point, which is slightly bold.

Command Line Arguments

Although, with the default configuration, repo-iconify will not process (as $Text is not specified), you do not need to create a .repo-iconify configuration file yourself to use this utility. An easier way is to specify command line arguments on runtime to repo-iconify, and the program will append (or replace) these options in the local (current directory) .repo-iconify config and then execute them with these changes reflected. For example, the icon displayed at the top of this README could have been accomplished with running:

repo-iconify Color=white Background="EF6C00" Text=ICON Suffix=" " Offset=+0-70