2525# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2626
2727require 'toxiclibs'
28- include_package 'toxi.color'
29- include_package 'toxi.util.datatypes'
3028
3129SWATCH_HEIGHT = 40.0
3230SWATCH_WIDTH = 5.0
3331SWATCH_GAP = 1
34-
3532MAX_SIZE = 150.0
3633NUM_DISCS = 300
3734attr_reader :show_discs , :list
@@ -50,15 +47,15 @@ def setup
5047
5148def draw
5249 # first define our new theme
53- t = ColorTheme . new ( 'test' )
50+ t = Toxi :: ColorTheme . new ( 'test' )
5451 # add different color options, each with their own weight
5552 t . add_range ( 'soft ivory' , 0.5 )
5653 t . add_range ( 'intense goldenrod' , 0.25 )
5754 t . add_range ( 'warm saddlebrown' , 0.15 )
5855 t . add_range ( 'fresh teal' , 0.05 )
5956 t . add_range ( 'bright yellowgreen' , 0.05 )
6057 # now add another rand hue which is using only bright shades
61- t . add_range ( ColorRange ::BRIGHT , TColor . new_random , rand ( 0.02 ..0.05 ) )
58+ t . add_range ( Toxi :: ColorRange ::BRIGHT , Toxi :: TColor . new_random , rand ( 0.02 ..0.05 ) )
6259 # use the TColor theme to create a list of 160 Colors
6360 @list = t . get_colors ( 160 )
6461 if show_discs
@@ -70,19 +67,19 @@ def draw
7067 list . sort_by_distance ( false )
7168 swatches ( list , 32 , yoff )
7269 yoff += SWATCH_HEIGHT + 10
73- list . sort_by_criteria ( AccessCriteria ::LUMINANCE , false )
70+ list . sort_by_criteria ( Toxi :: AccessCriteria ::LUMINANCE , false )
7471 swatches ( list , 32 , yoff )
7572 yoff += SWATCH_HEIGHT + 10
76- list . sort_by_criteria ( AccessCriteria ::BRIGHTNESS , false )
73+ list . sort_by_criteria ( Toxi :: AccessCriteria ::BRIGHTNESS , false )
7774 swatches ( list , 32 , yoff )
7875 yoff += SWATCH_HEIGHT + 10
79- list . sort_by_criteria ( AccessCriteria ::SATURATION , false )
76+ list . sort_by_criteria ( Toxi :: AccessCriteria ::SATURATION , false )
8077 swatches ( list , 32 , yoff )
8178 yoff += SWATCH_HEIGHT + 10
82- list . sort_by_criteria ( AccessCriteria ::HUE , false )
79+ list . sort_by_criteria ( Toxi :: AccessCriteria ::HUE , false )
8380 swatches ( list , 32 , yoff )
8481 yoff += SWATCH_HEIGHT + 10
85- list . sort_by_proximity_to ( NamedColor ::WHITE , RGBDistanceProxy . new , false )
82+ list . sort_by_proximity_to ( Toxi :: NamedColor ::WHITE , Toxi :: RGBDistanceProxy . new , false )
8683 swatches ( list , 32 , yoff )
8784 end
8885 #
@@ -101,7 +98,7 @@ def key_pressed
10198 @show_discs = !show_discs
10299 redraw
103100 when 'p' , 'P'
104- File . open ( data_path ( 'color .rb' ) , 'w' ) do |file |
101+ File . open ( data_path ( 'color_theme .rb' ) , 'w' ) do |file |
105102 file . write ( "# Test Theme\n " )
106103 file . write ( list . to_ruby_string )
107104 end
0 commit comments