1.2.3-SNAPSHOT permalink Arrow_down_16x16
  • (color rgb)
  • (color rgb alpha?)
  • (color x y z)
  • (color x y z alpha)


Examples:

(use 'incanter.processing)
(color 255 0 255)
(color 255 0 255 255) ;; with alpha value
(color "0xFF00FF")
(color 0xFF00FF)
(color -65281)
(color 0xFFFF00FF true) ;; with alpha? true
(color 0xFF 0x00 0xFF)
(color 0xFF 0x00 0xFF 0xFF) ;; with alpha value
(color 1.0 0.0 1.0)
(color 1.0 0.0 1.0 1.0) ;; with alpha value

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/processing.clj:296 top

(defn color
"

  Examples:

    (use 'incanter.processing)
    (color 255 0 255)
    (color 255 0 255 255) ;; with alpha value
    (color \"0xFF00FF\")
    (color 0xFF00FF)
    (color -65281)
    (color 0xFFFF00FF true) ;; with alpha? true
    (color 0xFF 0x00 0xFF)
    (color 0xFF 0x00 0xFF 0xFF) ;; with alpha value
    (color 1.0 0.0 1.0)
    (color 1.0 0.0 1.0 1.0) ;; with alpha value

"
([rgb]
  (.getRGB (java.awt.Color. (int rgb))))
;; (cond
;;   (string? rgb)
;;     (.getRGB (java.awt.Color/decode rgb))
;;   (or (integer? rgb) (float? rgb))
;;     (.getRGB (java.awt.Color. (int rgb)))))
([rgb alpha?]
  ;;(.getRGB (java.awt.Color. (color rgb) alpha?)))
  (.getRGB (java.awt.Color. (int rgb) alpha?)))
([x y z]
 (if (or (float? x) (float? y) (float? z))
    (.getRGB (java.awt.Color. (float x) (float y) (float z)))
    (.getRGB (java.awt.Color. (int x) (int y) (int z)))))
([x y z alpha]
 (if (or (float? x) (float? y) (float? z))
    (.getRGB (java.awt.Color. (float x) (float y) (float z) (float alpha)))
    (.getRGB (java.awt.Color. (int x) (int y) (int z) (int alpha))))))
Vars in incanter.processing/color: defn float float? int or
Used in 0 other vars

Comments top

No comments for color. Log in to add a comment.