Skip to content

Commit aebd159

Browse files
committed
expand
1 parent 48cc55d commit aebd159

File tree

4 files changed

+45
-41
lines changed

4 files changed

+45
-41
lines changed

external_library/gem/ruby_wordcram/fruits.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
require 'ruby_wordcram'
55

66
# Other suggested sources for usable palette are http://colorbrewer2.org/
7+
# and http://paletton.com
78

89
PALETTE = %w(#b2c248 #c40000 #a61733 #f7ca18 #32cd23 #ffc800 #f27935 #ffe5b4 #913d88 #f22613 #c72c48 #ff43a4).freeze
910
FRUITS = %w(avocado cherry\ red cranberry lemon lime mango orange peach plum pomegranate raspberry strawberry).freeze

external_library/gem/toxiclibs/color_utils/color_theme.rb

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,10 @@
2525
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2626

2727
require 'toxiclibs'
28-
include_package 'toxi.color'
29-
include_package 'toxi.util.datatypes'
3028

3129
SWATCH_HEIGHT = 40.0
3230
SWATCH_WIDTH = 5.0
3331
SWATCH_GAP = 1
34-
3532
MAX_SIZE = 150.0
3633
NUM_DISCS = 300
3734
attr_reader :show_discs, :list
@@ -50,15 +47,15 @@ def setup
5047

5148
def 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

external_library/gem/toxiclibs/color_utils/monochrome_palette.rb

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
require 'toxiclibs'
2+
3+
attr_reader :mono, :complement
4+
5+
def settings
6+
size 500, 400
7+
end
8+
9+
def setup
10+
sketch_title 'Monochrome and Complement Blue Swatch'
11+
@mono = Toxi::MonochromeTheoryStrategy.new.create_list_from_color(Toxi::TColor::BLUE)
12+
@complement = Toxi::ComplementaryStrategy.new.create_list_from_color(Toxi::TColor::BLUE)
13+
render_palette(mono)
14+
render_palette(complement, 200)
15+
end
16+
17+
def draw
18+
end
19+
20+
def key_pressed
21+
File.open(data_path('palette.rb'), 'w') do |file|
22+
file.write("# Monochrome Blue\n")
23+
file.write(mono.to_ruby_string)
24+
file.write("# Complement Blue\n")
25+
file.write(complement.to_ruby_string)
26+
end
27+
end
28+
29+
def render_palette(palette, ypos = 0)
30+
x = 0
31+
palette.each do |col|
32+
fill col.toARGB
33+
rect x, ypos, x + 100, 100
34+
x += 100
35+
end
36+
end

0 commit comments

Comments
 (0)