Skip to content

Commit

Permalink
added sample 30-1, a tip of COLORS, into 00516
Browse files Browse the repository at this point in the history
  • Loading branch information
ashbb committed Feb 16, 2009
1 parent cd1f237 commit a7bbab4
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.mdown
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Table of contents
- [00513 Shoes.setup (sample27.rb, sample50.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00513_Shoes.setup.mdown)
- [00514 Downloader (sample28.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00514_Downloader.mdown)
- [00515 Assign Shoes URL dynamically (sample29.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00515_Assign_Shoes_URL_dynamically.mdown)
- [00516 Classes List and Colors List (sample30.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00516_Classes_List_and_Colors_List.mdown)
- [00516 Classes List and Colors List (sample30.rb, sample30-1.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00516_Classes_List_and_Colors_List.mdown)
- [00517 start, stop and restart (sample31.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00517_start,_stop_and_restart.mdown)
- [00518 Combination of image objects show/hide and mouse hover/leave (sample32.rb, sample33.rb, sample34.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00518_Combination_of_image_objects_show_hide_and_mouse_hover_leave.mdown)
- [00519 arc and cap (sample35.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00519_arc_and_cap.mdown)
Expand Down
2 changes: 1 addition & 1 deletion changelog.mdown
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Change log:
-----------
Feb 16th, 2009: Merged citizen428's pull requests edited 00501 to 00505. <br>
Feb 16th, 2009: Merged citizen428's pull requests edited 00501 to 00505 and added sample 30-1, a tip of COLORS, into 00516. <br>
Feb 12th, 2009: Merged citizen428's pull requests edited 00300 to 00410. <br>
Feb 10th, 2009: Clarified link to installation instructions in chapter 00200. <br>
Feb 10th, 2009: Minor additions and corrections to chapter 00100. <br>
Expand Down
Binary file added images/sample30-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions mdowns/00516_Classes_List_and_Colors_List.mdown
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,26 @@ We can also see them with the following sample code. <br>
\_why is thinking about some more method related colors. <br>
e.g. invert, dark?, light?, black?, white?, opaque?, transparent? <br>
We might be able to get them in the near future. <br>


Note
----
I used send() method in the above sample30. But I noticed an alternative way. See the below sample30-1.

# sample30-1.rb
Shoes.app :width => 642, :height => 700, :resizable => false do
COLORS.sort_by{|sym,| sym.to_s}.each do |color, v|
flow :width => 160, :height => 20 do
fill v
rect 0, 0, 160, 20
inscription color, :stroke => v.dark? ? white : black
end
end
end

**NOTE**: There is no need to use `.to_s` in the map or sort\_by method's block by right. But with Shoes 2, the below error will occur if it's ommited. I guess this is a bug of Shoes...

**sample30-1.png**

![sample30-1.png](http://github.com/ashbb/shoes_tutorial_html/raw/master/images/sample30-1.png)

10 changes: 10 additions & 0 deletions src/sample30-1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# sample30-1.rb
Shoes.app :width => 642, :height => 700, :resizable => false do
COLORS.sort_by{|sym,| sym.to_s}.each do |color, v|
flow :width => 160, :height => 20 do
fill v
rect 0, 0, 160, 20
inscription color, :stroke => v.dark? ? white : black
end
end
end

0 comments on commit a7bbab4

Please sign in to comment.