Skip to content

Instantly share code, notes, and snippets.

@rosylilly
Created May 19, 2012 11:02
Show Gist options
  • Save rosylilly/2730475 to your computer and use it in GitHub Desktop.
Save rosylilly/2730475 to your computer and use it in GitHub Desktop.
schemeでrgb->hex hex->rgb変換
(define-module color-convert
(export hex->rgb)
(export rgb->hex)
(export rgb->hls))
(select-module color-convert)
(use srfi-13)
(define (hex->rgb hex)
(map
(lambda (h) (string->number h 16))
(map list->string
(slices (string->list hex) 2))))
(define (rgb->hex r g b)
(string-concatenate
(map
(lambda (c) (number->string c 16 #t))
'(r g b))))
(provide "color-convert")
@rosylilly
Copy link
Author

星くんに)は全部くっつけるんだよって言われたから直したよ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment