Docs tweaks for colors.scad, constants.scad

This commit is contained in:
Revar Desmera 2023-05-11 20:53:31 -07:00
parent afadd9301a
commit fb23e0267a
2 changed files with 24 additions and 11 deletions

View file

@ -16,17 +16,21 @@ use <builtins.scad>
// Section: Coloring Objects // Section: Coloring Objects
// Module: recolor() // Module: recolor()
// Synopsis: Sets the color for attachable children and all their descendants. // Synopsis: Sets the color for attachable children and their descendants.
// Topics: Attachments // Topics: Attachments
// See Also: color_this(), hsl(), hsv() // See Also: color_this(), hsl(), hsv()
// Usage: // Usage:
// recolor([c]) CHILDREN; // recolor([c]) CHILDREN;
// Description: // Description:
// Sets the color for attachable children and all their descendants. This only works with attachables and you cannot // Sets the color for attachable children and their descendants, down until another {{recolor()}}
// have any color() modules above it in any parents, only other recolor() or color_this() modules. // or {{color_this()}}. This only works with attachables and you cannot have any color() modules
// This works by setting the special `$color` variable, which attachable objects make use of to set the color. // above it in any parents, only other {{recolor()}} or {{color_this()}} modules. This works by
// setting the special `$color` variable, which attachable objects make use of to set the color.
// Arguments: // Arguments:
// c = Color name or RGBA vector. Default: The default color in your color scheme. // c = Color name or RGBA vector. Default: The default color in your color scheme.
// Side Effects:
// Changes the value of `$color`.
// Sets the color of child attachments.
// Example: // Example:
// cuboid([10,10,5]) // cuboid([10,10,5])
// recolor("green")attach(TOP,BOT) cuboid([9,9,4.5]) // recolor("green")attach(TOP,BOT) cuboid([9,9,4.5])
@ -56,6 +60,9 @@ module recolor(c="default")
// which attachable objects make use of to set the color. // which attachable objects make use of to set the color.
// Arguments: // Arguments:
// c = Color name or RGBA vector. Default: the default color in your color scheme // c = Color name or RGBA vector. Default: the default color in your color scheme
// Side Effects:
// Changes the value of `$color` and `$save_color`.
// Sets the color of child attachments.
// Example: // Example:
// cuboid([10,10,5]) // cuboid([10,10,5])
// color_this("green")attach(TOP,BOT) cuboid([9,9,4.5]) // color_this("green")attach(TOP,BOT) cuboid([9,9,4.5])
@ -123,14 +130,17 @@ module rainbow(list, stride=1, maxhues, shuffle=false, seed)
// hsl(h,[s],[l],[a]) CHILDREN; // hsl(h,[s],[l],[a]) CHILDREN;
// rgb = hsl(h,[s],[l],[a]); // rgb = hsl(h,[s],[l],[a]);
// Description: // Description:
// When called as a function, returns the [R,G,B] color for the given hue `h`, saturation `s`, and lightness `l` from the HSL colorspace. If you supply // When called as a function, returns the `[R,G,B]` color for the given hue `h`, saturation `s`, and
// the `a` value then you'll get a length 4 list [R,G,B,A]. // lightness `l` from the HSL colorspace. If you supply the `a` value then you'll get a length 4
// When called as a module, sets the color using the color() module to the given hue `h`, saturation `s`, and lightness `l` from the HSL colorspace. // list `[R,G,B,A]`. When called as a module, sets the color using the color() module to the given
// hue `h`, saturation `s`, and lightness `l` from the HSL colorspace.
// Arguments: // Arguments:
// h = The hue, given as a value between 0 and 360. 0=red, 60=yellow, 120=green, 180=cyan, 240=blue, 300=magenta. // h = The hue, given as a value between 0 and 360. 0=red, 60=yellow, 120=green, 180=cyan, 240=blue, 300=magenta.
// s = The saturation, given as a value between 0 and 1. 0 = grayscale, 1 = vivid colors. Default: 1 // s = The saturation, given as a value between 0 and 1. 0 = grayscale, 1 = vivid colors. Default: 1
// l = The lightness, between 0 and 1. 0 = black, 0.5 = bright colors, 1 = white. Default: 0.5 // l = The lightness, between 0 and 1. 0 = black, 0.5 = bright colors, 1 = white. Default: 0.5
// a = Specifies the alpha channel as a value between 0 and 1. 0 = fully transparent, 1=opaque. Default: 1 // a = Specifies the alpha channel as a value between 0 and 1. 0 = fully transparent, 1=opaque. Default: 1
// Side Effects:
// When called as a module, sets the color of all children.
// Example: // Example:
// hsl(h=120,s=1,l=0.5) sphere(d=60); // hsl(h=120,s=1,l=0.5) sphere(d=60);
// Example: // Example:
@ -161,14 +171,17 @@ module hsl(h,s=1,l=0.5,a=1)
// hsv(h,[s],[v],[a]) CHILDREN; // hsv(h,[s],[v],[a]) CHILDREN;
// rgb = hsv(h,[s],[v],[a]); // rgb = hsv(h,[s],[v],[a]);
// Description: // Description:
// When called as a function, returns the [R,G,B] color for the given hue `h`, saturation `s`, and value `v` from the HSV colorspace. If you supply // When called as a function, returns the `[R,G,B]` color for the given hue `h`, saturation `s`, and
// the `a` value then you'll get a length 4 list [R,G,B,A]. // value `v` from the HSV colorspace. If you supply the `a` value then you'll get a length 4 list
// When called as a module, sets the color using the color() module to the given hue `h`, saturation `s`, and value `v` from the HSV colorspace. // `[R,G,B,A]`. When called as a module, sets the color using the color() module to the given hue
// `h`, saturation `s`, and value `v` from the HSV colorspace.
// Arguments: // Arguments:
// h = The hue, given as a value between 0 and 360. 0=red, 60=yellow, 120=green, 180=cyan, 240=blue, 300=magenta. // h = The hue, given as a value between 0 and 360. 0=red, 60=yellow, 120=green, 180=cyan, 240=blue, 300=magenta.
// s = The saturation, given as a value between 0 and 1. 0 = grayscale, 1 = vivid colors. Default: 1 // s = The saturation, given as a value between 0 and 1. 0 = grayscale, 1 = vivid colors. Default: 1
// v = The value, between 0 and 1. 0 = darkest black, 1 = bright. Default: 1 // v = The value, between 0 and 1. 0 = darkest black, 1 = bright. Default: 1
// a = Specifies the alpha channel as a value between 0 and 1. 0 = fully transparent, 1=opaque. Default: 1 // a = Specifies the alpha channel as a value between 0 and 1. 0 = fully transparent, 1=opaque. Default: 1
// Side Effects:
// When called as a module, sets the color of all children.
// Example: // Example:
// hsv(h=120,s=1,v=1) sphere(d=60); // hsv(h=120,s=1,v=1) sphere(d=60);
// Example: // Example:

View file

@ -171,7 +171,7 @@ FWD = FRONT;
FORWARD = FRONT; FORWARD = FRONT;
// Constant: BACK // Constant: BACK
// Synopsis: The back-wards (Y+) direction vector constant `[0,1,0]`. // Synopsis: The backwards (Y+) direction vector constant `[0,1,0]`.
// Topics: Constants, Vectors // Topics: Constants, Vectors
// See Also: LEFT, RIGHT, FRONT, UP, DOWN, CENTER // See Also: LEFT, RIGHT, FRONT, UP, DOWN, CENTER
// Description: Vector pointing back. [0,1,0] // Description: Vector pointing back. [0,1,0]