Coder Social home page Coder Social logo

identikon's Introduction

a b c

identikon

A small collection of Racket scripts for generating identicons. This is very much alpha and will be changing a lot as I learn more about Racket. Identicons can be saved as PNG or SVG. Obligatory blog post.

Install

$ raco pkg install identikon

Dependencies

You will need to install sugar, quickcheck and css-tools.

Usage

Requiring identikon in Dr. Racket or Emacs with racket-mode or Geiser will give you access to the identikon function in the REPL:

(require identikon)

; Generate a default 300px identicon for "racket"
(identikon 300 300 "racket")

; Generate a q*bert style 300px identicon for "racket"
(identikon 300 300 "racket" "qbert")

; Generate a q*bert style 300px identicon for "racket" and save as an svg
(identikon 300 300 "racket" "qbert" "svg")

; start having real fun with identicons
(require identikon
         2htdp/image)

(define foo (identikon 200 200 "foo"))
(define bar (identikon 200 200 "bar"))
(beside
 (above foo bar)
 (above bar foo))

Note: Trying to use identikon in a standard CLI racket REPL will just return an (object:image% ...) instead of rendering the image. You could save an image to the filesystem this way: (identikon 300 300 "racket" "default" "svg"). If you're accessing the CLI REPL via either racket-mode or Geiser in Emacs then the images will render just fine like so:

geiser

CLI interface (via Raco)

-h  Help
-s  (multi) Size (all identikons are currently squares)
-i  String to convert to identicon
-f  File or input stream used to generate identikon
-r  (optional) Ruleset to use
-t  (optional) Filetype to save as: "png" or "svg"; defaults to png

$ raco identikon -s 300 -i "FooBarBaz"

$ raco identikon -s 300 -i "FooBarBaz" -r "squares"

$ raco identikon -s 300 -i "FooBarBaz" -r "squares" -t "svg"

$ raco identikon -s 300 -s 200 -s 100 -i "FooBarBaz" -r "stars" -t "svg"

Built-in rule sets

Each identicon has a rules file (ex: default.rkt) which is responsible for taking the input data and generating an image as it sees fit. There are a few existing rule sets to play with.

default.rkt

d

qbert.rkt

s

squares.rkt

s

circles.rkt

c

angles.rkt

a

angles2.rkt

a

nineblock.rkt

n

stars.rkt

s

rings.rkt

r

identikon's People

Contributors

darrenn avatar samth avatar bowmanb avatar racket-dep-fixer avatar

Watchers

James Cloos avatar

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.