-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Edit more examples for doc and flake8 goodness
- Loading branch information
Showing
22 changed files
with
244 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,102 @@ | ||
size(450,450) | ||
background(1,1,1) | ||
""" | ||
Colors library showcase 1 | ||
from the Nodebox colors library example (is it?) | ||
""" | ||
|
||
size(450, 450) | ||
background(1, 1, 1) | ||
|
||
colors=ximport("colors") | ||
#print(dir(colors)) | ||
|
||
clr = colors.lab(78,29,37,1) | ||
clr = colors.lab(78, 29, 37, 1) | ||
clr1 = colors.named_color("olive") | ||
clr2 = colors.mediumorchid() | ||
clr3 = colors.named_color("#DD7100") | ||
clr4 = colors.named_color("yellowy") | ||
clr5 = clr3.blend(clr4,0.5) | ||
clr5 = clr3.blend(clr4, 0.5) | ||
clr6 = colors.complement(clr5)[1] | ||
clr7 = colors.silver() | ||
|
||
if clr7.is_gray: | ||
print("yes, it's gray") | ||
else: | ||
print("no, no gray here") | ||
|
||
if clr7.is_transparent: | ||
print("yes, you can see through") | ||
else: | ||
print("no, opaque") | ||
|
||
|
||
clr6.swatch(200,40,20,20) | ||
clr5.swatch(222,40,20,20) | ||
clr6.swatch(200, 40, 20, 20) | ||
clr5.swatch(222, 40, 20, 20) | ||
|
||
colori = colors.list(clr, clr1, clr2, clr3, clr4, clr5, clr6, clr7) | ||
print colori | ||
|
||
|
||
|
||
|
||
print(colori) | ||
|
||
#draw test | ||
# draw test | ||
fill(clr) | ||
circle(50,40,40) | ||
circle(50, 40, 40) | ||
fill(colors.complement(clr)[1]) | ||
circle(90,40,40) | ||
circle(90, 40, 40) | ||
fill(clr1) | ||
circle(90,80,40) | ||
circle(90, 80, 40) | ||
fill(colors.complement(clr1)[1]) | ||
circle(130,80,40) | ||
circle(130, 80, 40) | ||
fill(clr2) | ||
circle(130,120,40) | ||
circle(130, 120, 40) | ||
fill(colors.complement(clr2)[1]) | ||
circle(170,120,40) | ||
circle(170, 120, 40) | ||
fill(clr3) | ||
circle(170,160,40) | ||
circle(170, 160, 40) | ||
fill(colors.complement(clr3)[1]) | ||
circle(210,160,40) | ||
circle(210, 160, 40) | ||
fill(clr4) | ||
circle(210,200,40) | ||
circle(210, 200, 40) | ||
fill(colors.complement(clr4)[1]) | ||
circle(250,200,40) | ||
circle(250, 200, 40) | ||
fill(clr5) | ||
circle(250,240,40) | ||
circle(250, 240, 40) | ||
fill(colors.complement(clr5)[1]) | ||
circle(290,240,40) | ||
circle(290, 240, 40) | ||
fill(clr6) | ||
circle(290,280,40) | ||
circle(290, 280, 40) | ||
fill(colors.complement(clr6)[1]) | ||
circle(330,280,40) | ||
circle(330, 280, 40) | ||
fill(clr7) | ||
circle(330,320,40) | ||
circle(330, 320, 40) | ||
fill(clr7.darken(step=0.4)) | ||
circle(370,320,40) | ||
circle(370, 320, 40) | ||
|
||
x=0 | ||
x = 0 | ||
for colore in colori: | ||
fill(colore) | ||
rect(x,0,20,20) | ||
rect(x, 0, 20, 20) | ||
x += 20 | ||
x += 20 | ||
for colore in colori.darken(step=0.1): | ||
fill(colore) | ||
rect(x,0,20,20) | ||
rect(x, 0, 20, 20) | ||
x += 20 | ||
x += 20 | ||
fill(colori.average) | ||
rect(x,0,20,20) | ||
rect(x, 0, 20, 20) | ||
x += 20 | ||
fill(colori.darken(step=0.1).average) | ||
rect(x,0,20,20) | ||
rect(x, 0, 20, 20) | ||
|
||
#color triad | ||
# color triad | ||
triade = colors.triad(clr3, angle=120) | ||
x = 200 | ||
for colore in triade: | ||
fill(colore) | ||
rect(x,80,20,20) | ||
rect(x, 80, 20, 20) | ||
x += 20 | ||
|
||
triade = colors.triad(clr4, angle=120) | ||
x = 260 | ||
for colore in triade: | ||
fill(colore) | ||
rect(x,120,20,20) | ||
rect(x, 120, 20, 20) | ||
x += 20 | ||
|
||
|
||
|
||
|
||
|
||
|
||
#colori.swarm(100,50) | ||
|
||
|
||
# colori.swarm(100, 50) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
""" | ||
Colors lib visual showcase | ||
""" | ||
|
||
size(450,450) | ||
background(1,1,1) | ||
colors = ximport("colors") | ||
|
||
size(450, 450) | ||
background(1, 1, 1) | ||
|
||
colors=ximport("colors") | ||
|
||
clr8 = colors.rgb(0.0, 0.4, 0.6) | ||
x = 10 | ||
for name in colors.rules: | ||
scheme = colors.rule(name, clr8) | ||
scheme.swatch(x, 10) | ||
x += 40 | ||
fill(0.0,0.4,0.6) | ||
rect(300,200,70,70) | ||
fill(0.0, 0.4, 0.6) | ||
rect(300, 200, 70, 70) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.