This project provides a simple web service that generates a dynamic SVG image showing a visitor count. It increments a counter every time the endpoint is called and returns an SVG image displaying the updated count.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
-
You need to have Node.js installed on your machine to run this project. You can download and install Node.js from Node.js official website.
-
Follow these steps to get a development env running:
-
Clone the repository to your local machine:
git clone https://github.com/montasim/github-readme-counter.git
-
Change into the project directory:
cd github-readme-counter
-
Install the necessary packages:
yarn install
-
Start the server:
yarn start
This will start the server on the port specified in your environment variables or default to a system assigned port.
-
Once the server is running, you can make a request to the SVG generator endpoint:
http://localhost:3000/count.svg
This service allows you to customize the appearance of the SVG image through URL parameters. This way, you can easily integrate the counter with different styles and themes of your web pages or applications.
The SVG image's background and text colors are customizable through URL parameters. Here are the parameters you can use:
backgroundColor
: Specifies the hex code for the background color of the SVG. The default color is black (000000
).textColor
: Specifies the hex code for the color of the text displaying the count. The default color is magenta (EB008B
).
To change the background color to white (FFFFFF
) and the text color to blue (0000FF
), you would access the service using the following URL:
http://localhost:3000/count.svg?backgroundColor=FFFFFF&textColor=0000FF
- Ensure to provide the color codes without the
#
symbol as the service automatically handles it. - Colors must be provided in hex format.
- Incorrect or unsupported color values might cause the service to revert to default colors.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
๏ผญโข๏ผฎ๏ผดฮ๏ผณ๏ผฉ๏ผญ |
This project is licensed under the MIT License - see the LICENSE.md file for details