Added a a sample table for showing the built-in color constants
parent
a958b9a070
commit
bde7fe018e
|
|
@ -1,5 +1,8 @@
|
||||||
# Squib CHANGELOG
|
# Squib CHANGELOG
|
||||||
|
|
||||||
|
## v0.3.0a
|
||||||
|
* Added new sample table for color constants in `samples/colors.rb`
|
||||||
|
|
||||||
## v0.2.0
|
## v0.2.0
|
||||||
* Added `showcase` feature to create a fancy-looking 3D reflection to showcase your cards. Documented, tested, and added a sample for it.
|
* Added `showcase` feature to create a fancy-looking 3D reflection to showcase your cards. Documented, tested, and added a sample for it.
|
||||||
* Added a basic Rakefile, documented in README.
|
* Added a basic Rakefile, documented in README.
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ Colors can be specified in a wide variety of ways, mostly in a hex-string. Take
|
||||||
|
|
||||||
{include:file:samples/colors.rb}
|
{include:file:samples/colors.rb}
|
||||||
|
|
||||||
Under the hood, Squib uses the `rcairo` [color parser](https://github.com/rcairo/rcairo/blob/master/lib/cairo/color.rb) to accept a variety of color specifications, along with over [300 pre-defined constants](https://github.com/rcairo/rcairo/blob/master/lib/cairo/colors.rb).
|
Under the hood, Squib uses the `rcairo` [color parser](https://github.com/rcairo/rcairo/blob/master/lib/cairo/color.rb) to accept a variety of color specifications, along with over [300 pre-defined constants](https://github.com/rcairo/rcairo/blob/master/lib/cairo/colors.rb). The above sample will generate a table of such constants.
|
||||||
|
|
||||||
## Specifying Files
|
## Specifying Files
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,23 @@ Squib::Deck.new(width: 825, height: 1125, cards: 1) do
|
||||||
text color: '#ffff00000000', str: '12-hex', x: 50, y: y+=50
|
text color: '#ffff00000000', str: '12-hex', x: 50, y: y+=50
|
||||||
text color: '#ffff000000009999', str: '12-hex (alpha)', x: 50, y: y+=50
|
text color: '#ffff000000009999', str: '12-hex (alpha)', x: 50, y: y+=50
|
||||||
text color: :burnt_orange, str: 'Symbols of constants too', x: 50, y: y+=50
|
text color: :burnt_orange, str: 'Symbols of constants too', x: 50, y: y+=50
|
||||||
|
|
||||||
save_png prefix: 'colors_'
|
save_png prefix: 'colors_'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# This script generates a table of the built-in constants
|
||||||
|
Squib::Deck.new(width: 3000, height: 1500) do
|
||||||
|
colors = (Cairo::Color.constants - %i(HEX_RE Base RGB CMYK HSV X11))
|
||||||
|
colors.sort_by! {|c| Cairo::Color.parse(c).to_s}
|
||||||
|
x,y,w,h = 0,0,300,50
|
||||||
|
colors.each_with_index do |color, i|
|
||||||
|
rect x: x, y: y, width: w, height: h, fill_color: color
|
||||||
|
text str: color.to_s, x: x + 5, y: y+13, font: 'Sans Bold 16',
|
||||||
|
color: (Cairo::Color.parse(color).to_hsv.v > 0.9) ? '#000': '#fff'
|
||||||
|
y += h
|
||||||
|
if y > @height
|
||||||
|
x += w
|
||||||
|
y = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
save_png prefix: 'color_constants_'
|
||||||
|
end
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue