Permalink
Browse files

Facelift and minor fixes.

- README rewritten with an example, in org-mode

- license changed to BOOST, version bumped to 0.2

- new dependencies, in particular let-plus, appropriate structure accessor forms provided

- colors are now structures, not classes

- removed alpha channel stuff, does not belong here

- autogenerated color names now have a small docstring

- code prettified a bit, minor renamings

- some files renamed
  • Loading branch information...
1 parent f952c69 commit a4612469b6d8eea092976331cf9c2ec9824e1f59 @tpapp committed Jun 28, 2012
Showing with 916 additions and 944 deletions.
  1. +2 −2 Makefile
  2. +0 −7 README
  3. +41 −0 README.org
  4. +6 −10 cl-colors.asd
  5. +662 −669 colornames.lisp
  6. +148 −200 colors.lisp
  7. +18 −8 package.lisp
  8. +39 −0 parse-x11-colors.lisp
  9. +0 −48 parse-x11.lisp
View
@@ -3,6 +3,6 @@
SBCL=/usr/bin/sbcl
-colornames.lisp: /usr/share/X11/rgb.txt parse-x11.lisp
+colornames.lisp: /usr/share/X11/rgb.txt parse-x11-colors.lisp
rm -f colornames.lisp
- $(SBCL) --load parse-x11.lisp --eval '(quit)'
+ $(SBCL) --load parse-x11-colors.lisp --eval '(quit)'
View
7 README
@@ -1,7 +0,0 @@
-The purpose of this simple package to provide named colors that can be
-used by other packages. Each color is stored in a structure, and
-named colors are defined as constants (eg +black+, +blue+, +slateblue+
-etc). Currently, the colors were converted from X11's rgb.txt, but
-may be expanded in the future. Alpha channels and HSV conversion are
-supported. The library of course doesn't depend on X11, the converted
-file is included.
View
@@ -0,0 +1,41 @@
+* cl-colors: a simple color library for Common Lisp
+
+This is a very simple color library for Common Lisp, providing
+
+1. Types for representing colors in HSV and RGB spaces.
+2. Simple conversion functions between the above types (and also hexadecimal representation for RGB).
+3. Some predefined colors (currently X11 color names -- of course the library does not depend on X11).
+
+** Examples
+
+#+BEGIN_SRC lisp
+(let ((color1 (hsv 107 62/100 52/100)) ; greenish
+ (color2 (rgb 14/15 26/51 14/15)) ; = violet from X11
+ (color3 (as-rgb "ff9e00"))) ; from hexadecimal
+ (list ;
+ (as-rgb color1) ; converting to RGB
+ (rgb-combination color1 +blue+ 0.4) ; HSV autoconverted to RGB
+ (hsv-combination color2 +blue+ 0.4) ; RGB autoconverted to HSV
+ color3))
+#+END_SRC
+evaluates to
+#+BEGIN_EXAMPLE
+'(#S(RGB :RED 20059/75000 :GREEN 13/25 :BLUE 247/1250)
+ #S(RGB :RED 0.160472 :GREEN 0.312 :BLUE 0.51856) ; observe float contagion
+ #S(HSV :HUE 60.0 :SATURATION 0.6722689 :VALUE 0.96000004)
+ #S(RGB :RED 1 :GREEN 158/255 :BLUE 0))
+#+END_EXAMPLE
+
+Observe the float contagion: =cl-colors= functions don't care about the type of the numbers as long as they are a subtype of =real= and within the right range.
+
+** Documentation
+
+This library is so simple that it does not need a lot of documentation --- just look at the docsstrings in =colors.lisp=.
+
+** Regeneration of the X11 color names
+
+Normally you should not need to do this, the sources already contain the autogenerated file =colornames.lisp=. However, if for some reason you need to regenerate this, you can use =make=. Even though the library itself does not depend on X11, regenerating this file will require the appropriate file in X11.
+
+** Bugs and issues
+
+Please report them on [[https://github.com/tpapp/cl-colors/issues][Github]].
View
@@ -1,14 +1,10 @@
-(defpackage #:cl-colors-asd
- (:use :cl :asdf))
-
-(in-package :cl-colors-asd)
-
(defsystem #:cl-colors
:description "Simple color library for Common Lisp"
- :version "0.1"
+ :version "0.2"
:author "Tamas K Papp"
- :license "LLGPL"
+ :license "Boost Software License - Version 1.0"
+ :serial t
:components ((:file "package")
- (:file "colors" :depends-on ("package"))
- (:file "colornames" :depends-on ("colors")))
- :depends-on (:cl-utilities))
+ (:file "colors")
+ (:file "colornames"))
+ :depends-on (:alexandria :let-plus))
View

Large diffs are not rendered by default.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit a461246

Please sign in to comment.