Module P5.Color
Makers
val make : ?sketch:Sketch.t -> ?alpha:int -> int -> int -> int -> tmake r g bcreates a new colour using the values forr, g, b. You can also provide an optional alpha value.
val make_gray : ?sketch:Sketch.t -> ?alpha:int -> int -> tmake vcreates a new colour usingvfor ther, g, bvalues.
val make_string : ?sketch:Sketch.t -> string -> tMaking a colour with a string. The p5 reference explains in detail what can and cannot be passed as an argument here.
Accessors
val brightness : ?sketch:Sketch.t -> t -> intbrightness cextracts the HSB brightness value from a colour
Mutators
val set_green : t -> int -> unitset_green c vsets the green component of the colourcto valuev
val set_red : t -> int -> unitset_red c vsets the red component of the colourcto valuev
val set_blue : t -> int -> unitset_blue c vsets the blue component of the colourcto valuev
val set_alpha : t -> int -> unitset_alpha c vsets the alpha component of the colourcto valuev
val to_string : t -> Jstr.tto_string cconverts the colourcto a string
Useful Functions
Settings
val background_image : ?sketch:Sketch.t -> Image.t -> unitbackground imgsets the canvas' background to theImage.timg
val clear : ?sketch:Sketch.t -> unit -> unitClears the buffer
val color_mode : ?sketch:Sketch.t -> ?max:int -> mode -> unitcolor_mode ?max modesets the colour mode and the range for all values
val color_mode_with_max : ?sketch:Sketch.t -> ?max_alpha:int -> max_1:int -> max_2:int -> max_3:int -> mode -> unitSame as
color_modebut gives you more control over each of the ranges for a particularmode
val no_fill : ?sketch:Sketch.t -> unit -> unitDisables filling geometry
val stroke : ?sketch:Sketch.t -> t -> unitstroke csets the colour used to draw lines and borders around shapes
val no_stroke : ?sketch:Sketch.t -> unit -> unitno_stroke ()disables drawing the outline
val erase : ?sketch:Sketch.t -> ?fill_strength:int -> ?stroke_strength:int -> unit -> uniterase ()causes all subsequent draws to subtract from the canvas.fill_strengthandstroke_strengthwill control how much the two properties will be erased. By default they are255i.e. full strength