Closed nangahamandine closed 7 months ago
Sounds interesting @nangahamandine I can work on this
Sounds interesting @nangahamandine I can work on this
Oh I am already working on this
@nangahamandine Thanks; this is undoubtedly a helpful feature. Let's try to keep the API clean of stateful elements. That means specifications should apply only to a shape and shouldn't alter how subsequent shapes behave. We don't need to expose the RGB
function to the user. RGB
could be an optional parameter for creating shapes. Another way to create colours is not needed at all. RGB
in itself is quite versatile, so let's drop the hex codes.
To give you an idea of what must happen; get an optional argument for setting color while creating a shape. For example
val circle: ?x:int -> ?y:int -> ?stroke:(int, int, int) -> int -> shape
let black_circle = circle 50 in
let red_circle = circle ~stroke:(255, 0, 0) in
show [black_circle; red_circle]
Should we have stroke
and fill
instead of colour
to avoid confusion
on whether colour
will change the stroke color or fill color?
On Tue, Oct 17, 2023, 1:30 PM Sudha Parimala @.***> wrote:
@nangahamandine https://github.com/nangahamandine Thanks; this is undoubtedly a helpful feature. Let's try to keep the API clean of stateful elements. That means specifications should apply only to a shape and shouldn't alter how subsequent shapes behave. We don't need to expose the RGB function to the user. RGB could be an optional parameter for creating shapes. I don't think another way to create colours is needed at all. RGB in itself is quite versatile, so let's drop the hex codes.
To give you an idea of what needs to happen; get an optional argument for setting color while creating a shape. For example
val circle: ?x:int -> ?y:int -> ?colour:(int, int, int) -> int -> shape let black_circle = circle 50 inlet red_circle = circle ~colour:(255, 0, 0) in show [black_circle; red_circle]
— Reply to this email directly, view it on GitHub https://github.com/Sudha247/ocaml-joy/issues/46#issuecomment-1765878498, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI7MKYJTLAGWGNUCMQT3X5LX7Y3LBAVCNFSM6AAAAAA6BIFPAGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRVHA3TQNBZHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Yes, that makes sense. Edited my comment above ^^
@nangahamandine Thanks; this is undoubtedly a helpful feature. Let's try to keep the API clean of stateful elements. That means specifications should apply only to a shape and shouldn't alter how subsequent shapes behave. We don't need to expose the
RGB
function to the user.RGB
could be an optional parameter for creating shapes. Another way to create colours is not needed at all.RGB
in itself is quite versatile, so let's drop the hex codes.To give you an idea of what must happen; get an optional argument for setting color while creating a shape. For example
val circle: ?x:int -> ?y:int -> ?stroke:(int, int, int) -> int -> shape let black_circle = circle 50 in let red_circle = circle ~stroke:(255, 0, 0) in show [black_circle; red_circle]
Okay, understood. I'll stick to the functions for RGB values
Thank you for the updates. I'll employ the necessary changes.
Add new functions for custom color creation as follows:
For RGB:
rgb : int -> int -> int -> color
- This function will create custom colors using RGB values and users can specify the red, green, and blue components as integers in the range 0-255. For examplelet my_red = rgb 255 0 0
For hexadecimal:
hex : string -> color
- This function will create custom colors using hexadecimal color codes and users can input the color code as a string. For example "#RRGGBB".Modify existing functions for custom color usage For example,
set_color : color -> unit
- Theset_color
function is modified to accept custom colors so it will enable users to set the current drawing color to the specified custom color.